mirror of
https://github.com/acpica/acpica/
synced 2025-01-21 00:42:02 +03:00
Update copyrights for 2004
date 2004.01.13.23.06.00; author rmoore1; state Exp;
This commit is contained in:
parent
2b07674837
commit
8cefa0408e
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: dswexec - Dispatcher method execution callbacks;
|
||||
* dispatch to interpreter.
|
||||
* $Revision: 1.104 $
|
||||
* $Revision: 1.106 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -518,7 +518,7 @@ AcpiDsExecEndOp (
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
|
||||
* Local is uninitialized.
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswscope - Scope stack manipulation
|
||||
* $Revision: 1.44 $
|
||||
* $Revision: 1.60 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -117,12 +117,11 @@
|
||||
#define __DSWSCOPE_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acinterp.h"
|
||||
#include "acdispat.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
MODULE_NAME ("dswscope")
|
||||
ACPI_MODULE_NAME ("dswscope")
|
||||
|
||||
|
||||
#define STACK_POP(head) head
|
||||
@ -145,6 +144,8 @@ AcpiDsScopeStackClear (
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsScopeStackClear");
|
||||
|
||||
|
||||
while (WalkState->ScopeInfo)
|
||||
{
|
||||
@ -153,9 +154,9 @@ AcpiDsScopeStackClear (
|
||||
ScopeInfo = WalkState->ScopeInfo;
|
||||
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("Popped object type %X\n", ScopeInfo->Common.Value));
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value)));
|
||||
AcpiUtDeleteGenericState (ScopeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,34 +176,34 @@ AcpiDsScopeStackClear (
|
||||
ACPI_STATUS
|
||||
AcpiDsScopeStackPush (
|
||||
ACPI_NAMESPACE_NODE *Node,
|
||||
ACPI_OBJECT_TYPE8 Type,
|
||||
ACPI_OBJECT_TYPE Type,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
ACPI_GENERIC_STATE *OldScopeInfo;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsScopeStackPush");
|
||||
ACPI_FUNCTION_TRACE ("DsScopeStackPush");
|
||||
|
||||
|
||||
if (!Node)
|
||||
{
|
||||
/* invalid scope */
|
||||
/* Invalid scope */
|
||||
|
||||
REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
|
||||
ACPI_REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Make sure object type is valid */
|
||||
|
||||
if (!AcpiAmlValidateObjectType (Type))
|
||||
if (!AcpiUtValidObjectType (Type))
|
||||
{
|
||||
REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
|
||||
ACPI_REPORT_WARNING (("DsScopeStackPush: Invalid object type: 0x%X\n", Type));
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a new scope object */
|
||||
|
||||
ScopeInfo = AcpiCmCreateGenericState ();
|
||||
ScopeInfo = AcpiUtCreateGenericState ();
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -210,13 +211,37 @@ AcpiDsScopeStackPush (
|
||||
|
||||
/* Init new scope object */
|
||||
|
||||
ScopeInfo->Scope.Node = Node;
|
||||
ScopeInfo->Common.Value = (UINT16) Type;
|
||||
ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE;
|
||||
ScopeInfo->Scope.Node = Node;
|
||||
ScopeInfo->Common.Value = (UINT16) Type;
|
||||
|
||||
WalkState->ScopeDepth++;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"[%.2d] Pushed scope ", (UINT32) WalkState->ScopeDepth));
|
||||
|
||||
OldScopeInfo = WalkState->ScopeInfo;
|
||||
if (OldScopeInfo)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
||||
"[%4.4s] (%s)",
|
||||
AcpiUtGetNodeName (OldScopeInfo->Scope.Node),
|
||||
AcpiUtGetTypeName (OldScopeInfo->Common.Value)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
||||
"[\\___] (%s)", "ROOT"));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
||||
", New scope -> [%4.4s] (%s)\n",
|
||||
AcpiUtGetNodeName (ScopeInfo->Scope.Node),
|
||||
AcpiUtGetTypeName (ScopeInfo->Common.Value)));
|
||||
|
||||
/* Push new scope object onto stack */
|
||||
|
||||
AcpiCmPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
|
||||
AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -243,25 +268,44 @@ AcpiDsScopeStackPop (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
ACPI_GENERIC_STATE *NewScopeInfo;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsScopeStackPop");
|
||||
ACPI_FUNCTION_TRACE ("DsScopeStackPop");
|
||||
|
||||
|
||||
/*
|
||||
* Pop scope info object off the stack.
|
||||
*/
|
||||
|
||||
ScopeInfo = AcpiCmPopGenericState (&WalkState->ScopeInfo);
|
||||
ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo);
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("Popped object type %X\n", ScopeInfo->Common.Value));
|
||||
WalkState->ScopeDepth--;
|
||||
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
|
||||
(UINT32) WalkState->ScopeDepth,
|
||||
AcpiUtGetNodeName (ScopeInfo->Scope.Node),
|
||||
AcpiUtGetTypeName (ScopeInfo->Common.Value)));
|
||||
|
||||
NewScopeInfo = WalkState->ScopeInfo;
|
||||
if (NewScopeInfo)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
||||
"[%4.4s] (%s)\n",
|
||||
AcpiUtGetNodeName (NewScopeInfo->Scope.Node),
|
||||
AcpiUtGetTypeName (NewScopeInfo->Common.Value)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
||||
"[\\___] (ROOT)\n"));
|
||||
}
|
||||
|
||||
AcpiUtDeleteGenericState (ScopeInfo);
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswstate - Dispatcher parse tree walk management routines
|
||||
* $Revision: 1.42 $
|
||||
* $Revision: 1.77 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -118,14 +118,12 @@
|
||||
#define __DSWSTATE_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acparser.h"
|
||||
#include "acdispat.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
MODULE_NAME ("dswstate")
|
||||
ACPI_MODULE_NAME ("dswstate")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -133,11 +131,12 @@
|
||||
* FUNCTION: AcpiDsResultInsert
|
||||
*
|
||||
* PARAMETERS: Object - Object to push
|
||||
* Index - Where to insert the object
|
||||
* WalkState - Current Walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Push an object onto this walk's result stack
|
||||
* DESCRIPTION: Insert an object onto this walk's result stack
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -150,27 +149,29 @@ AcpiDsResultInsert (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultInsert");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultInsert: No result object pushed! State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
if (Index >= ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultInsert: Index out of range: %X Obj=%p State=%p Num=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Index out of range: %X Obj=%p State=%p Num=%X\n",
|
||||
Index, Object, WalkState, State->Results.NumResults));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (!Object)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultInsert: Null Object! Index=%X Obj=%p State=%p Num=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
|
||||
Index, Object, WalkState, State->Results.NumResults));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
@ -178,9 +179,9 @@ AcpiDsResultInsert (
|
||||
State->Results.ObjDesc [Index] = Object;
|
||||
State->Results.NumResults++;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
|
||||
WalkState, State->Results.NumResults, WalkState->CurrentResult));
|
||||
|
||||
return (AE_OK);
|
||||
@ -192,6 +193,7 @@ AcpiDsResultInsert (
|
||||
* FUNCTION: AcpiDsResultRemove
|
||||
*
|
||||
* PARAMETERS: Object - Where to return the popped object
|
||||
* Index - Where to extract the object
|
||||
* WalkState - Current Walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
@ -210,29 +212,30 @@ AcpiDsResultRemove (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultRemove");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultRemove: No result object pushed! State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
if (Index >= ACPI_OBJ_MAX_OPERAND)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultRemove: Index out of range: %X State=%p Num=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Index out of range: %X State=%p Num=%X\n",
|
||||
Index, WalkState, State->Results.NumResults));
|
||||
}
|
||||
|
||||
|
||||
/* Check for a valid result object */
|
||||
|
||||
if (!State->Results.ObjDesc [Index])
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultStackRemove: Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, Index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
@ -244,9 +247,9 @@ AcpiDsResultRemove (
|
||||
*Object = State->Results.ObjDesc [Index];
|
||||
State->Results.ObjDesc [Index] = NULL;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
Index, WalkState, State->Results.NumResults));
|
||||
|
||||
return (AE_OK);
|
||||
@ -272,21 +275,22 @@ AcpiDsResultPop (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 Index;
|
||||
ACPI_NATIVE_UINT Index;
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultPop");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
if (!State->Results.NumResults)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPop: Result stack is empty! State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
@ -295,7 +299,7 @@ AcpiDsResultPop (
|
||||
|
||||
State->Results.NumResults--;
|
||||
|
||||
for (Index = OBJ_NUM_OPERANDS; Index; Index--)
|
||||
for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
|
||||
{
|
||||
/* Check for a valid result object */
|
||||
|
||||
@ -304,22 +308,19 @@ AcpiDsResultPop (
|
||||
*Object = State->Results.ObjDesc [Index -1];
|
||||
State->Results.ObjDesc [Index -1] = NULL;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
Index -1, WalkState, State->Results.NumResults));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
(UINT32) Index -1, WalkState, State->Results.NumResults));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPop: No result objects! State=%p\n",
|
||||
WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResultPopFromBottom
|
||||
@ -339,25 +340,24 @@ AcpiDsResultPopFromBottom (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 Index;
|
||||
ACPI_NATIVE_UINT Index;
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPopFromBottom: Warning: No result object pushed! State=%p\n",
|
||||
WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Warning: No result object pushed! State=%p\n", WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
||||
if (!State->Results.NumResults)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPopFromBottom: No result objects! State=%p\n",
|
||||
WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
@ -365,7 +365,6 @@ AcpiDsResultPopFromBottom (
|
||||
|
||||
*Object = State->Results.ObjDesc [0];
|
||||
|
||||
|
||||
/* Push entire stack down one element */
|
||||
|
||||
for (Index = 0; Index < State->Results.NumResults; Index++)
|
||||
@ -379,18 +378,15 @@ AcpiDsResultPopFromBottom (
|
||||
|
||||
if (!*Object)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPopFromBottom: Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, Index));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, (UINT32) Index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultPopFromBottom: Obj=%p [%s], Results=%p State=%p\n",
|
||||
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
State, WalkState));
|
||||
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@ -416,37 +412,36 @@ AcpiDsResultPush (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultPush");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPush: No result stack frame\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n"));
|
||||
return (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
if (State->Results.NumResults == OBJ_NUM_OPERANDS)
|
||||
if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPush: Result stack overflow: Obj=%p State=%p Num=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Result stack overflow: Obj=%p State=%p Num=%X\n",
|
||||
Object, WalkState, State->Results.NumResults));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
|
||||
if (!Object)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsResultPush: Null Object! Obj=%p State=%p Num=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n",
|
||||
Object, WalkState, State->Results.NumResults));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
||||
State->Results.ObjDesc [State->Results.NumResults] = Object;
|
||||
State->Results.NumResults++;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
|
||||
WalkState, State->Results.NumResults, WalkState->CurrentResult));
|
||||
|
||||
return (AE_OK);
|
||||
@ -457,12 +452,11 @@ AcpiDsResultPush (
|
||||
*
|
||||
* FUNCTION: AcpiDsResultStackPush
|
||||
*
|
||||
* PARAMETERS: Object - Object to push
|
||||
* WalkState - Current Walk state
|
||||
* PARAMETERS: WalkState - Current Walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION: Push an object onto the WalkState result stack.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -472,17 +466,19 @@ AcpiDsResultStackPush (
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultStackPush");
|
||||
|
||||
State = AcpiCmCreateGenericState ();
|
||||
|
||||
State = AcpiUtCreateGenericState ();
|
||||
if (!State)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
AcpiCmPushGenericState (&WalkState->Results, State);
|
||||
State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT;
|
||||
AcpiUtPushGenericState (&WalkState->Results, State);
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPush: Results=%p State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
|
||||
State, WalkState));
|
||||
|
||||
return (AE_OK);
|
||||
@ -497,7 +493,7 @@ AcpiDsResultStackPush (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION: Pop an object off of the WalkState result stack.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -507,25 +503,25 @@ AcpiDsResultStackPop (
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsResultStackPop");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (WalkState->Results == NULL)
|
||||
{
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPop: Underflow - State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
|
||||
WalkState));
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
State = AcpiUtPopGenericState (&WalkState->Results);
|
||||
|
||||
State = AcpiCmPopGenericState (&WalkState->Results);
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPop: Result=%p RemainingResults=%X State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Result=%p RemainingResults=%X State=%p\n",
|
||||
State, State->Results.NumResults, WalkState));
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -551,16 +547,16 @@ AcpiDsObjStackDeleteAll (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
|
||||
|
||||
|
||||
/* The stack size is configurable, but fixed */
|
||||
|
||||
for (i = 0; i < OBJ_NUM_OPERANDS; i++)
|
||||
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
|
||||
{
|
||||
if (WalkState->Operands[i])
|
||||
{
|
||||
AcpiCmRemoveReference (WalkState->Operands[i]);
|
||||
AcpiUtRemoveReference (WalkState->Operands[i]);
|
||||
WalkState->Operands[i] = NULL;
|
||||
}
|
||||
}
|
||||
@ -587,14 +583,15 @@ AcpiDsObjStackPush (
|
||||
void *Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPush");
|
||||
|
||||
|
||||
/* Check for stack overflow */
|
||||
|
||||
if (WalkState->NumOperands >= OBJ_NUM_OPERANDS)
|
||||
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPush: overflow! Obj=%p State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"overflow! Obj=%p State=%p #Ops=%X\n",
|
||||
Object, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
@ -604,14 +601,15 @@ AcpiDsObjStackPush (
|
||||
WalkState->Operands [WalkState->NumOperands] = Object;
|
||||
WalkState->NumOperands++;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
Object, AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type),
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsObjStackPopObject
|
||||
@ -631,19 +629,20 @@ AcpiDsObjStackPopObject (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPopObject");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Missing operand/stack empty! State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Missing operand/stack empty! State=%p #Ops=%X\n",
|
||||
WalkState, WalkState->NumOperands));
|
||||
*Object = NULL;
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
|
||||
/* Pop the stack */
|
||||
|
||||
WalkState->NumOperands--;
|
||||
@ -652,9 +651,10 @@ AcpiDsObjStackPopObject (
|
||||
|
||||
if (!WalkState->Operands [WalkState->NumOperands])
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Null operand! State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Null operand! State=%p #Ops=%X\n",
|
||||
WalkState, WalkState->NumOperands));
|
||||
*Object = NULL;
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
@ -663,12 +663,13 @@ AcpiDsObjStackPopObject (
|
||||
*Object = WalkState->Operands [WalkState->NumOperands];
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
*Object, AcpiCmGetTypeName ((*Object)->Common.Type),
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
*Object, AcpiUtGetObjectTypeName (*Object),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -692,6 +693,8 @@ AcpiDsObjStackPop (
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPop");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
{
|
||||
@ -699,8 +702,8 @@ AcpiDsObjStackPop (
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
@ -711,7 +714,7 @@ AcpiDsObjStackPop (
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -741,14 +744,17 @@ AcpiDsObjStackPopAndDelete (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
{
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
@ -759,12 +765,12 @@ AcpiDsObjStackPopAndDelete (
|
||||
ObjDesc = WalkState->Operands [WalkState->NumOperands];
|
||||
if (ObjDesc)
|
||||
{
|
||||
AcpiCmRemoveReference (WalkState->Operands [WalkState->NumOperands]);
|
||||
AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -792,7 +798,7 @@ AcpiDsObjStackGetValue (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
|
||||
|
||||
|
||||
/* Can't do it if the stack is empty */
|
||||
@ -809,8 +815,7 @@ AcpiDsObjStackGetValue (
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
|
||||
return_PTR (WalkState->Operands[(NATIVE_UINT)(WalkState->NumOperands - 1) -
|
||||
return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) -
|
||||
Index]);
|
||||
}
|
||||
|
||||
@ -819,29 +824,32 @@ AcpiDsObjStackGetValue (
|
||||
*
|
||||
* FUNCTION: AcpiDsGetCurrentWalkState
|
||||
*
|
||||
* PARAMETERS: WalkList - Get current active state for this walk list
|
||||
* PARAMETERS: Thread - Get current active state for this Thread
|
||||
*
|
||||
* RETURN: Pointer to the current walk state
|
||||
*
|
||||
* DESCRIPTION: Get the walk state that is at the head of the list (the "current"
|
||||
* walk state.
|
||||
* walk state.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_WALK_STATE *
|
||||
AcpiDsGetCurrentWalkState (
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
|
||||
{
|
||||
ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE, ("DsGetCurrentWalkState, =%p\n", WalkList->WalkState));
|
||||
|
||||
if (!WalkList)
|
||||
if (!Thread)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (WalkList->WalkState);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current WalkState %p\n",
|
||||
Thread->WalkStateList));
|
||||
|
||||
return (Thread->WalkStateList);
|
||||
}
|
||||
|
||||
|
||||
@ -858,18 +866,16 @@ AcpiDsGetCurrentWalkState (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static void
|
||||
void
|
||||
AcpiDsPushWalkState (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE ("DsPushWalkState");
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsPushWalkState");
|
||||
|
||||
|
||||
WalkState->Next = WalkList->WalkState;
|
||||
WalkList->WalkState = WalkState;
|
||||
WalkState->Next = Thread->WalkStateList;
|
||||
Thread->WalkStateList = WalkState;
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
@ -891,26 +897,26 @@ AcpiDsPushWalkState (
|
||||
|
||||
ACPI_WALK_STATE *
|
||||
AcpiDsPopWalkState (
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsPopWalkState");
|
||||
ACPI_FUNCTION_TRACE ("DsPopWalkState");
|
||||
|
||||
|
||||
WalkState = WalkList->WalkState;
|
||||
WalkState = Thread->WalkStateList;
|
||||
|
||||
if (WalkState)
|
||||
{
|
||||
/* Next walk state becomes the current walk state */
|
||||
|
||||
WalkList->WalkState = WalkState->Next;
|
||||
Thread->WalkStateList = WalkState->Next;
|
||||
|
||||
/*
|
||||
* Don't clear the NEXT field, this serves as an indicator
|
||||
* that there is a parent WALK STATE
|
||||
* WalkState->Next = NULL;
|
||||
* NO: WalkState->Next = NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
@ -923,12 +929,12 @@ AcpiDsPopWalkState (
|
||||
* FUNCTION: AcpiDsCreateWalkState
|
||||
*
|
||||
* PARAMETERS: Origin - Starting point for this walk
|
||||
* WalkList - Owning walk list
|
||||
* Thread - Current thread state
|
||||
*
|
||||
* RETURN: Pointer to the new walk state.
|
||||
*
|
||||
* DESCRIPTION: Allocate and initialize a new walk state. The current walk state
|
||||
* is set to this new state.
|
||||
* DESCRIPTION: Allocate and initialize a new walk state. The current walk
|
||||
* state is set to this new state.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -937,59 +943,32 @@ AcpiDsCreateWalkState (
|
||||
ACPI_OWNER_ID OwnerId,
|
||||
ACPI_PARSE_OBJECT *Origin,
|
||||
ACPI_OPERAND_OBJECT *MthDesc,
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsCreateWalkState");
|
||||
ACPI_FUNCTION_TRACE ("DsCreateWalkState");
|
||||
|
||||
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
AcpiGbl_WalkStateCacheRequests++;
|
||||
|
||||
/* Check the cache first */
|
||||
|
||||
if (AcpiGbl_WalkStateCache)
|
||||
WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
|
||||
if (!WalkState)
|
||||
{
|
||||
/* There is an object available, use it */
|
||||
|
||||
WalkState = AcpiGbl_WalkStateCache;
|
||||
AcpiGbl_WalkStateCache = WalkState->Next;
|
||||
|
||||
AcpiGbl_WalkStateCacheHits++;
|
||||
AcpiGbl_WalkStateCacheDepth--;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState));
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* The cache is empty, create a new object */
|
||||
|
||||
/* Avoid deadlock with AcpiCmCallocate */
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
|
||||
WalkState = AcpiCmCallocate (sizeof (ACPI_WALK_STATE));
|
||||
if (!WalkState)
|
||||
{
|
||||
return_PTR (NULL);
|
||||
}
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
WalkState->DataType = ACPI_DESC_TYPE_WALK;
|
||||
WalkState->OwnerId = OwnerId;
|
||||
WalkState->Origin = Origin;
|
||||
WalkState->MethodDesc = MthDesc;
|
||||
WalkState->WalkList = WalkList;
|
||||
WalkState->Thread = Thread;
|
||||
|
||||
WalkState->ParserState.StartOp = Origin;
|
||||
|
||||
/* Init the method args/local */
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
AcpiDsMethodDataInit (WalkState);
|
||||
#endif
|
||||
|
||||
@ -1001,15 +980,136 @@ AcpiDsCreateWalkState (
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Put the new state at the head of the walk list */
|
||||
|
||||
AcpiDsPushWalkState (WalkState, WalkList);
|
||||
if (Thread)
|
||||
{
|
||||
AcpiDsPushWalkState (WalkState, Thread);
|
||||
}
|
||||
|
||||
return_PTR (WalkState);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitAmlWalk
|
||||
*
|
||||
* PARAMETERS: WalkState - New state to be initialized
|
||||
* Op - Current parse op
|
||||
* MethodNode - Control method NS node, if any
|
||||
* AmlStart - Start of AML
|
||||
* AmlLength - Length of AML
|
||||
* Params - Method args, if any
|
||||
* ReturnObjDesc - Where to store a return object, if any
|
||||
* PassNumber - 1, 2, or 3
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsInitAmlWalk (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_NAMESPACE_NODE *MethodNode,
|
||||
UINT8 *AmlStart,
|
||||
UINT32 AmlLength,
|
||||
ACPI_OPERAND_OBJECT **Params,
|
||||
ACPI_OPERAND_OBJECT **ReturnObjDesc,
|
||||
UINT32 PassNumber)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
|
||||
ACPI_PARSE_OBJECT *ExtraOp;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
|
||||
|
||||
|
||||
WalkState->ParserState.Aml =
|
||||
WalkState->ParserState.AmlStart = AmlStart;
|
||||
WalkState->ParserState.AmlEnd =
|
||||
WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
|
||||
|
||||
/* The NextOp of the NextWalk will be the beginning of the method */
|
||||
|
||||
WalkState->NextOp = NULL;
|
||||
WalkState->Params = Params;
|
||||
WalkState->CallerReturnDesc = ReturnObjDesc;
|
||||
|
||||
Status = AcpiPsInitScope (&WalkState->ParserState, Op);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
if (MethodNode)
|
||||
{
|
||||
WalkState->ParserState.StartNode = MethodNode;
|
||||
WalkState->WalkType = ACPI_WALK_METHOD;
|
||||
WalkState->MethodNode = MethodNode;
|
||||
WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
|
||||
|
||||
/* Push start scope on scope stack and make it current */
|
||||
|
||||
Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Init the method arguments */
|
||||
|
||||
Status = AcpiDsMethodDataInitArgs (Params, ACPI_METHOD_NUM_ARGS, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Setup the current scope.
|
||||
* Find a Named Op that has a namespace node associated with it.
|
||||
* search upwards from this Op. Current scope is the first
|
||||
* Op with a namespace node.
|
||||
*/
|
||||
ExtraOp = ParserState->StartOp;
|
||||
while (ExtraOp && !ExtraOp->Common.Node)
|
||||
{
|
||||
ExtraOp = ExtraOp->Common.Parent;
|
||||
}
|
||||
|
||||
if (!ExtraOp)
|
||||
{
|
||||
ParserState->StartNode = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParserState->StartNode = ExtraOp->Common.Node;
|
||||
}
|
||||
|
||||
if (ParserState->StartNode)
|
||||
{
|
||||
/* Push start scope on scope stack and make it current */
|
||||
|
||||
Status = AcpiDsScopeStackPush (ParserState->StartNode,
|
||||
ParserState->StartNode->Type, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = AcpiDsInitCallbacks (WalkState, PassNumber);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsDeleteWalkState
|
||||
@ -1029,7 +1129,7 @@ AcpiDsDeleteWalkState (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
|
||||
|
||||
|
||||
if (!WalkState)
|
||||
@ -1039,11 +1139,14 @@ AcpiDsDeleteWalkState (
|
||||
|
||||
if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsDeleteWalkState: **** %p not a valid walk state\n", WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", WalkState));
|
||||
return;
|
||||
}
|
||||
|
||||
if (WalkState->ParserState.Scope)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState));
|
||||
}
|
||||
|
||||
/* Always must free any linked control states */
|
||||
|
||||
@ -1052,7 +1155,7 @@ AcpiDsDeleteWalkState (
|
||||
State = WalkState->ControlState;
|
||||
WalkState->ControlState = State->Common.Next;
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
/* Always must free any linked parse states */
|
||||
@ -1062,7 +1165,7 @@ AcpiDsDeleteWalkState (
|
||||
State = WalkState->ScopeInfo;
|
||||
WalkState->ScopeInfo = State->Common.Next;
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
/* Always must free any stacked result states */
|
||||
@ -1072,38 +1175,10 @@ AcpiDsDeleteWalkState (
|
||||
State = WalkState->Results;
|
||||
WalkState->Results = State->Common.Next;
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
}
|
||||
|
||||
|
||||
/* If walk cache is full, just free this wallkstate object */
|
||||
|
||||
if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH)
|
||||
{
|
||||
AcpiCmFree (WalkState);
|
||||
}
|
||||
|
||||
/* Otherwise put this object back into the cache */
|
||||
|
||||
else
|
||||
{
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
|
||||
/* Clear the state */
|
||||
|
||||
MEMSET (WalkState, 0, sizeof (ACPI_WALK_STATE));
|
||||
WalkState->DataType = ACPI_DESC_TYPE_WALK;
|
||||
|
||||
/* Put the object at the head of the global cache list */
|
||||
|
||||
WalkState->Next = AcpiGbl_WalkStateCache;
|
||||
AcpiGbl_WalkStateCache = WalkState;
|
||||
AcpiGbl_WalkStateCacheDepth++;
|
||||
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -1125,24 +1200,10 @@ void
|
||||
AcpiDsDeleteWalkStateCache (
|
||||
void)
|
||||
{
|
||||
ACPI_WALK_STATE *Next;
|
||||
ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsDeleteWalkStateCache");
|
||||
|
||||
|
||||
/* Traverse the global cache list */
|
||||
|
||||
while (AcpiGbl_WalkStateCache)
|
||||
{
|
||||
/* Delete one cached state object */
|
||||
|
||||
Next = AcpiGbl_WalkStateCache->Next;
|
||||
AcpiCmFree (AcpiGbl_WalkStateCache);
|
||||
AcpiGbl_WalkStateCache = Next;
|
||||
AcpiGbl_WalkStateCacheDepth--;
|
||||
}
|
||||
|
||||
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
|
||||
* $Revision: 1.42 $
|
||||
* $Revision: 1.75 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -118,127 +118,64 @@
|
||||
#define __EXCONFIG_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "acinterp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acevents.h"
|
||||
#include "actables.h"
|
||||
#include "acdispat.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
MODULE_NAME ("exconfig")
|
||||
ACPI_MODULE_NAME ("exconfig")
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExLoadTableOp
|
||||
* FUNCTION: AcpiExAddTable
|
||||
*
|
||||
* PARAMETERS: RgnDesc - Op region where the table will be obtained
|
||||
* DdbHandle - Where a handle to the table will be returned
|
||||
* PARAMETERS: Table - Pointer to raw table
|
||||
* ParentNode - Where to load the table (scope)
|
||||
* DdbHandle - Where to return the table handle.
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table
|
||||
* DESCRIPTION: Common function to Install and Load an ACPI table with a
|
||||
* returned table handle.
|
||||
*
|
||||
****************************************************************************/
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiExLoadTableOp (
|
||||
ACPI_OPERAND_OBJECT *RgnDesc,
|
||||
ACPI_STATUS
|
||||
AcpiExAddTable (
|
||||
ACPI_TABLE_HEADER *Table,
|
||||
ACPI_NAMESPACE_NODE *ParentNode,
|
||||
ACPI_OPERAND_OBJECT **DdbHandle)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *TableDesc = NULL;
|
||||
UINT8 *TablePtr;
|
||||
UINT8 *TableDataPtr;
|
||||
ACPI_TABLE_HEADER TableHeader;
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
UINT32 i;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExLoadTable");
|
||||
|
||||
/* TBD: [Unhandled] Object can be either a field or an opregion */
|
||||
ACPI_FUNCTION_TRACE ("ExAddTable");
|
||||
|
||||
|
||||
/* Get the table header */
|
||||
/* Create an object to be the table handle */
|
||||
|
||||
TableHeader.Length = 0;
|
||||
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
(UINT32 *) ((UINT8 *) &TableHeader + i));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate a buffer for the entire table */
|
||||
|
||||
TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
|
||||
if (!TablePtr)
|
||||
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the header to the buffer */
|
||||
|
||||
MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
|
||||
TableDataPtr = TablePtr + sizeof (ACPI_TABLE_HEADER);
|
||||
|
||||
|
||||
/* Get the table from the op region */
|
||||
|
||||
for (i = 0; i < TableHeader.Length; i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
(UINT32 *) (TableDataPtr + i));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Table must be either an SSDT or a PSDT */
|
||||
|
||||
if ((!STRNCMP (TableHeader.Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
|
||||
(!STRNCMP (TableHeader.Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength)))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
|
||||
TableHeader.Signature));
|
||||
Status = AE_BAD_SIGNATURE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Create an object to be the table handle */
|
||||
|
||||
TableDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
|
||||
if (!TableDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr;
|
||||
TableInfo.Length = TableHeader.Length;
|
||||
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
|
||||
TableInfo.BasePointer = TablePtr;
|
||||
ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
|
||||
|
||||
Status = AcpiTbInstallTable (NULL, &TableInfo);
|
||||
TableInfo.Type = 5;
|
||||
TableInfo.Pointer = Table;
|
||||
TableInfo.Length = (ACPI_SIZE) Table->Length;
|
||||
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
|
||||
|
||||
Status = AcpiTbInstallTable (&TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
@ -246,41 +183,332 @@ AcpiExLoadTableOp (
|
||||
|
||||
/* Add the table to the namespace */
|
||||
|
||||
/* TBD: [Restructure] - change to whatever new interface is appropriate */
|
||||
/*
|
||||
Status = AcpiLoadNamespace ();
|
||||
Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
*/
|
||||
/* TBD: [Errors] Unload the table on failure ? */
|
||||
/*
|
||||
/* Uninstall table on error */
|
||||
|
||||
(void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
|
||||
goto Cleanup;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* TBD: [Investigate] we need a pointer to the table desc */
|
||||
|
||||
/* Init the table handle */
|
||||
|
||||
TableDesc->Reference.Opcode = AML_LOAD_OP;
|
||||
TableDesc->Reference.Object = TableInfo.InstalledDesc;
|
||||
ObjDesc->Reference.Opcode = AML_LOAD_OP;
|
||||
ObjDesc->Reference.Object = TableInfo.InstalledDesc;
|
||||
*DdbHandle = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
||||
*DdbHandle = TableDesc;
|
||||
|
||||
Cleanup:
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExLoadTableOp
|
||||
*
|
||||
* PARAMETERS: WalkState - Current state with operands
|
||||
* ReturnDesc - Where to store the return object
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExLoadTableOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OPERAND_OBJECT **ReturnDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
|
||||
ACPI_TABLE_HEADER *Table;
|
||||
ACPI_NAMESPACE_NODE *ParentNode;
|
||||
ACPI_NAMESPACE_NODE *StartNode;
|
||||
ACPI_NAMESPACE_NODE *ParameterNode = NULL;
|
||||
ACPI_OPERAND_OBJECT *DdbHandle;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExLoadTableOp");
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Make sure that the signature does not match one of the tables that
|
||||
* is already loaded.
|
||||
*/
|
||||
Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
|
||||
if (Status == AE_OK)
|
||||
{
|
||||
/* Signature matched -- don't allow override */
|
||||
|
||||
return_ACPI_STATUS (AE_ALREADY_EXISTS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the ACPI table */
|
||||
|
||||
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
|
||||
Operand[1]->String.Pointer,
|
||||
Operand[2]->String.Pointer, &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status != AE_NOT_FOUND)
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Table not found, return an Integer=0 and AE_OK */
|
||||
|
||||
DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
|
||||
if (!DdbHandle)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
DdbHandle->Integer.Value = 0;
|
||||
*ReturnDesc = DdbHandle;
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Default nodes */
|
||||
|
||||
StartNode = WalkState->ScopeInfo->Scope.Node;
|
||||
ParentNode = AcpiGbl_RootNode;
|
||||
|
||||
/* RootPath (optional parameter) */
|
||||
|
||||
if (Operand[3]->String.Length > 0)
|
||||
{
|
||||
/*
|
||||
* Find the node referenced by the RootPathString. This is the
|
||||
* location within the namespace where the table will be loaded.
|
||||
*/
|
||||
Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
|
||||
ACPI_NS_SEARCH_PARENT, &ParentNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* ParameterPath (optional parameter) */
|
||||
|
||||
if (Operand[4]->String.Length > 0)
|
||||
{
|
||||
if ((Operand[4]->String.Pointer[0] != '\\') &&
|
||||
(Operand[4]->String.Pointer[0] != '^'))
|
||||
{
|
||||
/*
|
||||
* Path is not absolute, so it will be relative to the node
|
||||
* referenced by the RootPathString (or the NS root if omitted)
|
||||
*/
|
||||
StartNode = ParentNode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the node referenced by the ParameterPathString
|
||||
*/
|
||||
Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
|
||||
ACPI_NS_SEARCH_PARENT, &ParameterNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the table into the namespace */
|
||||
|
||||
Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Parameter Data (optional) */
|
||||
|
||||
if (ParameterNode)
|
||||
{
|
||||
/* Store the parameter data into the optional parameter object */
|
||||
|
||||
Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
|
||||
WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
(void) AcpiExUnloadTable (DdbHandle);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
*ReturnDesc = DdbHandle;
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExLoadOp
|
||||
*
|
||||
* PARAMETERS: ObjDesc - Region or Field where the table will be
|
||||
* obtained
|
||||
* Target - Where a handle to the table will be stored
|
||||
* WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table from a field or operation region
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExLoadOp (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc,
|
||||
ACPI_OPERAND_OBJECT *Target,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *DdbHandle;
|
||||
ACPI_OPERAND_OBJECT *BufferDesc = NULL;
|
||||
ACPI_TABLE_HEADER *TablePtr = NULL;
|
||||
UINT8 *TableDataPtr;
|
||||
ACPI_TABLE_HEADER TableHeader;
|
||||
UINT32 i;
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExLoadOp");
|
||||
|
||||
|
||||
/* Object can be either an OpRegion or a Field */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_REGION:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
|
||||
/* Get the table header */
|
||||
|
||||
TableHeader.Length = 0;
|
||||
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
((UINT8 *) &TableHeader) + i);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate a buffer for the entire table */
|
||||
|
||||
TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
|
||||
if (!TablePtr)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the header to the buffer */
|
||||
|
||||
ACPI_MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
|
||||
TableDataPtr = ACPI_PTR_ADD (UINT8, TablePtr, sizeof (ACPI_TABLE_HEADER));
|
||||
|
||||
/* Get the table from the op region */
|
||||
|
||||
for (i = 0; i < TableHeader.Length; i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
((UINT8 *) TableDataPtr + i));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
|
||||
/*
|
||||
* The length of the field must be at least as large as the table.
|
||||
* Read the entire field and thus the entire table. Buffer is
|
||||
* allocated during the read.
|
||||
*/
|
||||
Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/* The table must be either an SSDT or a PSDT */
|
||||
|
||||
if ((!ACPI_STRNCMP (TablePtr->Signature,
|
||||
AcpiGbl_TableData[ACPI_TABLE_PSDT].Signature,
|
||||
AcpiGbl_TableData[ACPI_TABLE_PSDT].SigLength)) &&
|
||||
(!ACPI_STRNCMP (TablePtr->Signature,
|
||||
AcpiGbl_TableData[ACPI_TABLE_SSDT].Signature,
|
||||
AcpiGbl_TableData[ACPI_TABLE_SSDT].SigLength)))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
|
||||
TablePtr->Signature));
|
||||
Status = AE_BAD_SIGNATURE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Store the DdbHandle into the Target operand */
|
||||
|
||||
Status = AcpiExStore (DdbHandle, Target, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
(void) AcpiExUnloadTable (DdbHandle);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
ACPI_MEM_FREE (TableDesc);
|
||||
ACPI_MEM_FREE (TablePtr);
|
||||
if (BufferDesc)
|
||||
{
|
||||
AcpiUtRemoveReference (BufferDesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_MEM_FREE (TablePtr);
|
||||
}
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExUnloadTable
|
||||
*
|
||||
@ -290,18 +518,18 @@ Cleanup:
|
||||
*
|
||||
* DESCRIPTION: Unload an ACPI table
|
||||
*
|
||||
****************************************************************************/
|
||||
******************************************************************************/
|
||||
|
||||
static ACPI_STATUS
|
||||
ACPI_STATUS
|
||||
AcpiExUnloadTable (
|
||||
ACPI_OPERAND_OBJECT *DdbHandle)
|
||||
{
|
||||
ACPI_STATUS Status = AE_NOT_IMPLEMENTED;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
|
||||
ACPI_TABLE_DESC *TableInfo;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExUnloadTable");
|
||||
ACPI_FUNCTION_TRACE ("ExUnloadTable");
|
||||
|
||||
|
||||
/*
|
||||
@ -311,9 +539,8 @@ AcpiExUnloadTable (
|
||||
* validated here.
|
||||
*/
|
||||
if ((!DdbHandle) ||
|
||||
(!VALID_DESCRIPTOR_TYPE (DdbHandle, ACPI_DESC_TYPE_INTERNAL)) ||
|
||||
(((ACPI_OPERAND_OBJECT *)DdbHandle)->Common.Type !=
|
||||
INTERNAL_TYPE_REFERENCE))
|
||||
(ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
|
||||
(ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE))
|
||||
{
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
@ -326,74 +553,15 @@ AcpiExUnloadTable (
|
||||
* Delete the entire namespace under this table Node
|
||||
* (Offset contains the TableId)
|
||||
*/
|
||||
Status = AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
|
||||
|
||||
/* Delete the table itself */
|
||||
|
||||
AcpiTbUninstallTable (TableInfo->InstalledDesc);
|
||||
(void) AcpiTbUninstallTable (TableInfo->InstalledDesc);
|
||||
|
||||
/* Delete the table descriptor (DdbHandle) */
|
||||
|
||||
AcpiUtRemoveReference (TableDesc);
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExReconfiguration
|
||||
*
|
||||
* PARAMETERS: WalkState - Current state of the parse tree walk
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Reconfiguration opcodes such as LOAD and UNLOAD
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExReconfiguration (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExReconfiguration");
|
||||
|
||||
#define DdbHandle Operand[0]
|
||||
#define RegionDesc Operand[1]
|
||||
|
||||
|
||||
|
||||
switch (WalkState->Opcode)
|
||||
{
|
||||
|
||||
case AML_LOAD_OP:
|
||||
|
||||
Status = AcpiExLoadTableOp (RegionDesc, &DdbHandle);
|
||||
break;
|
||||
|
||||
|
||||
case AML_UNLOAD_OP:
|
||||
|
||||
Status = AcpiExUnloadTable (DdbHandle);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad opcode=%X\n", WalkState->Opcode));
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconvrt - Object conversion routines
|
||||
* $Revision: 1.37 $
|
||||
* $Revision: 1.50 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -246,10 +246,15 @@ AcpiExConvertToInteger (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Save the Result, delete original descriptor, store new descriptor */
|
||||
/* Save the Result */
|
||||
|
||||
RetDesc->Integer.Value = Result;
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
@ -273,7 +278,7 @@ AcpiExConvertToInteger (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert an ACPI Object to an Buffer
|
||||
* DESCRIPTION: Convert an ACPI Object to a Buffer
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -293,54 +298,53 @@ AcpiExConvertToBuffer (
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* No conversion necessary */
|
||||
|
||||
*ResultDesc = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/*
|
||||
* Create a new Buffer object
|
||||
* Create a new Buffer object.
|
||||
* Need enough space for one integer
|
||||
*/
|
||||
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
|
||||
RetDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Need enough space for one integer */
|
||||
|
||||
NewBuf = ACPI_MEM_CALLOCATE (AcpiGbl_IntegerByteWidth);
|
||||
if (!NewBuf)
|
||||
{
|
||||
ACPI_REPORT_ERROR
|
||||
(("ExConvertToBuffer: Buffer allocation failure\n"));
|
||||
AcpiUtRemoveReference (RetDesc);
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the integer to the buffer */
|
||||
|
||||
NewBuf = RetDesc->Buffer.Pointer;
|
||||
for (i = 0; i < AcpiGbl_IntegerByteWidth; i++)
|
||||
{
|
||||
NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8));
|
||||
}
|
||||
|
||||
/* Complete buffer object initialization */
|
||||
|
||||
RetDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
RetDesc->Buffer.Length = AcpiGbl_IntegerByteWidth;
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
*ResultDesc = ObjDesc;
|
||||
break;
|
||||
|
||||
/*
|
||||
* Create a new Buffer object
|
||||
* Size will be the string length
|
||||
*/
|
||||
RetDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) ObjDesc->String.Length);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
*ResultDesc = ObjDesc;
|
||||
/* Copy the string to the buffer */
|
||||
|
||||
NewBuf = RetDesc->Buffer.Pointer;
|
||||
ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
|
||||
ObjDesc->String.Length);
|
||||
break;
|
||||
|
||||
|
||||
@ -350,7 +354,22 @@ AcpiExConvertToBuffer (
|
||||
|
||||
/* Mark buffer initialized */
|
||||
|
||||
(*ResultDesc)->Common.Flags |= AOPOBJ_DATA_VALID;
|
||||
RetDesc->Common.Flags |= AOPOBJ_DATA_VALID;
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -359,11 +378,14 @@ AcpiExConvertToBuffer (
|
||||
*
|
||||
* FUNCTION: AcpiExConvertAscii
|
||||
*
|
||||
* PARAMETERS: Integer
|
||||
* PARAMETERS: Integer - Value to be converted
|
||||
* Base - 10 or 16
|
||||
* String - Where the string is returned
|
||||
* DataWidth - Size of data item to be converted
|
||||
*
|
||||
* RETURN: Actual string length
|
||||
*
|
||||
* DESCRIPTION: Convert an ACPI Integer to a hex string
|
||||
* DESCRIPTION: Convert an ACPI Integer to a hex or decimal string
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -371,7 +393,8 @@ UINT32
|
||||
AcpiExConvertToAscii (
|
||||
ACPI_INTEGER Integer,
|
||||
UINT32 Base,
|
||||
UINT8 *String)
|
||||
UINT8 *String,
|
||||
UINT8 DataWidth)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
@ -379,12 +402,23 @@ AcpiExConvertToAscii (
|
||||
char HexDigit;
|
||||
ACPI_INTEGER Digit;
|
||||
UINT32 Remainder;
|
||||
UINT32 Length = sizeof (ACPI_INTEGER);
|
||||
BOOLEAN LeadingZero = TRUE;
|
||||
UINT32 Length;
|
||||
BOOLEAN LeadingZero;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
if (DataWidth < sizeof (ACPI_INTEGER))
|
||||
{
|
||||
LeadingZero = FALSE;
|
||||
Length = DataWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeadingZero = TRUE;
|
||||
Length = sizeof (ACPI_INTEGER);
|
||||
}
|
||||
|
||||
|
||||
switch (Base)
|
||||
{
|
||||
@ -452,8 +486,8 @@ AcpiExConvertToAscii (
|
||||
String [0] = ACPI_ASCII_ZERO;
|
||||
k = 1;
|
||||
}
|
||||
String [k] = 0;
|
||||
|
||||
String [k] = 0;
|
||||
return (k);
|
||||
}
|
||||
|
||||
@ -482,7 +516,6 @@ AcpiExConvertToString (
|
||||
{
|
||||
ACPI_OPERAND_OBJECT *RetDesc;
|
||||
UINT32 i;
|
||||
UINT32 Index;
|
||||
UINT32 StringLength;
|
||||
UINT8 *NewBuf;
|
||||
UINT8 *Pointer;
|
||||
@ -493,6 +526,21 @@ AcpiExConvertToString (
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
if (MaxLength >= ObjDesc->String.Length)
|
||||
{
|
||||
*ResultDesc = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Must copy the string first and then truncate it */
|
||||
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
StringLength = AcpiGbl_IntegerByteWidth * 2;
|
||||
@ -523,7 +571,7 @@ AcpiExConvertToString (
|
||||
|
||||
/* Convert */
|
||||
|
||||
i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf);
|
||||
i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf, sizeof (ACPI_INTEGER));
|
||||
|
||||
/* Null terminate at the correct place */
|
||||
|
||||
@ -539,27 +587,22 @@ AcpiExConvertToString (
|
||||
}
|
||||
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
StringLength = ObjDesc->Buffer.Length * 3;
|
||||
if (Base == 10)
|
||||
/* Find the string length */
|
||||
|
||||
Pointer = ObjDesc->Buffer.Pointer;
|
||||
for (StringLength = 0; StringLength < ObjDesc->Buffer.Length; StringLength++)
|
||||
{
|
||||
StringLength = ObjDesc->Buffer.Length * 4;
|
||||
/* Exit on null terminator */
|
||||
|
||||
if (!Pointer[StringLength])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MaxLength > ACPI_MAX_STRING_CONVERSION)
|
||||
@ -595,52 +638,15 @@ AcpiExConvertToString (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert each byte of the buffer to two ASCII characters plus a space.
|
||||
*/
|
||||
Pointer = ObjDesc->Buffer.Pointer;
|
||||
Index = 0;
|
||||
for (i = 0, Index = 0; i < ObjDesc->Buffer.Length; i++)
|
||||
{
|
||||
Index = AcpiExConvertToAscii ((ACPI_INTEGER) Pointer[i], Base, &NewBuf[Index]);
|
||||
/* Copy the appropriate number of buffer characters */
|
||||
|
||||
NewBuf[Index] = ' ';
|
||||
Index++;
|
||||
}
|
||||
ACPI_MEMCPY (NewBuf, Pointer, StringLength);
|
||||
|
||||
/* Null terminate */
|
||||
|
||||
NewBuf [Index-1] = 0;
|
||||
NewBuf [StringLength] = 0;
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf);
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
if (MaxLength >= ObjDesc->String.Length)
|
||||
{
|
||||
*ResultDesc = ObjDesc;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Must copy the string first and then truncate it */
|
||||
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
RetDesc->String.Length = StringLength;
|
||||
break;
|
||||
|
||||
|
||||
@ -648,6 +654,21 @@ AcpiExConvertToString (
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -695,7 +716,7 @@ AcpiExConvertToTargetType (
|
||||
|
||||
switch (DestinationType)
|
||||
{
|
||||
case INTERNAL_TYPE_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
/*
|
||||
* Named field can always handle conversions
|
||||
*/
|
||||
@ -706,8 +727,8 @@ AcpiExConvertToTargetType (
|
||||
|
||||
if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Target does not allow conversion of type %s to %s\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Explicit operator, will store (%s) over existing type (%s)\n",
|
||||
AcpiUtGetObjectTypeName (SourceDesc),
|
||||
AcpiUtGetTypeName (DestinationType)));
|
||||
Status = AE_TYPE;
|
||||
@ -722,8 +743,8 @@ AcpiExConvertToTargetType (
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case INTERNAL_TYPE_BANK_FIELD:
|
||||
case INTERNAL_TYPE_INDEX_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
/*
|
||||
* These types require an Integer operand. We can convert
|
||||
* a Buffer or a String to an Integer if necessary.
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
|
||||
* $Revision: 1.121 $
|
||||
* $Revision: 1.120 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes
|
||||
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
|
||||
* $Revision: 1.117 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,8 +10,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -115,567 +116,505 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __AMMISC_C__
|
||||
#define __EXMISC_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "acinterp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdispat.h"
|
||||
|
||||
|
||||
#define _COMPONENT INTERPRETER
|
||||
MODULE_NAME ("ammisc");
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exmisc")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecFatal
|
||||
* FUNCTION: AcpiExGetObjectReference
|
||||
*
|
||||
* PARAMETERS: none
|
||||
* PARAMETERS: ObjDesc - Create a reference to this object
|
||||
* ReturnDesc - Where to store the reference
|
||||
* WalkState - Current state
|
||||
*
|
||||
* RETURN: Status. If the OS returns from the OSD call, we just keep
|
||||
* on going.
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Execute Fatal operator
|
||||
*
|
||||
* ACPI SPECIFICATION REFERENCES:
|
||||
* DefFatal := FatalOp FatalType FatalCode FatalArg
|
||||
* FatalType := ByteData
|
||||
* FatalCode := DWordData
|
||||
* FatalArg := TermArg=>Integer
|
||||
* DESCRIPTION: Obtain and return a "reference" to the target object
|
||||
* Common code for the RefOfOp and the CondRefOfOp.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlExecFatal (
|
||||
AcpiExGetObjectReference (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc,
|
||||
ACPI_OPERAND_OBJECT **ReturnDesc,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_OBJECT_INTERNAL *TypeDesc;
|
||||
ACPI_OBJECT_INTERNAL *CodeDesc;
|
||||
ACPI_OBJECT_INTERNAL *ArgDesc;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *ReferenceObj;
|
||||
ACPI_OPERAND_OBJECT *ReferencedObj;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlExecFatal");
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
|
||||
|
||||
|
||||
/* Resolve operands */
|
||||
*ReturnDesc = NULL;
|
||||
|
||||
Status = AcpiAmlResolveOperands (AML_FATAL_OP, WALK_OPERANDS);
|
||||
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
|
||||
AcpiPsGetOpcodeName (AML_FATAL_OP),
|
||||
3, "after AcpiAmlResolveOperands");
|
||||
|
||||
/* Get operands */
|
||||
|
||||
Status |= AcpiDsObjStackPopObject (&ArgDesc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&CodeDesc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&TypeDesc, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
|
||||
{
|
||||
/* Invalid parameters on object stack */
|
||||
case ACPI_DESC_TYPE_OPERAND:
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AcpiAmlExecFatal/AML_FATAL_OP: bad operand(s) (0x%X)\n",
|
||||
Status));
|
||||
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE)
|
||||
{
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
goto Cleanup;
|
||||
/*
|
||||
* Must be a reference to a Local or Arg
|
||||
*/
|
||||
switch (ObjDesc->Reference.Opcode)
|
||||
{
|
||||
case AML_LOCAL_OP:
|
||||
case AML_ARG_OP:
|
||||
|
||||
/* The referenced object is the pseudo-node for the local/arg */
|
||||
|
||||
ReferencedObj = ObjDesc->Reference.Object;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %X\n",
|
||||
ObjDesc->Reference.Opcode));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_DESC_TYPE_NAMED:
|
||||
|
||||
/*
|
||||
* A named reference that has already been resolved to a Node
|
||||
*/
|
||||
ReferencedObj = ObjDesc;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p has invalid descriptor [%s]\n",
|
||||
ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/* DefFatal := FatalOp FatalType FatalCode FatalArg */
|
||||
/* Create a new reference object */
|
||||
|
||||
ReferenceObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
|
||||
if (!ReferenceObj)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
|
||||
TypeDesc->Number.Value, CodeDesc->Number.Value, ArgDesc->Number.Value));
|
||||
ReferenceObj->Reference.Opcode = AML_REF_OF_OP;
|
||||
ReferenceObj->Reference.Object = ReferencedObj;
|
||||
*ReturnDesc = ReferenceObj;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
|
||||
|
||||
/*
|
||||
* TBD: [Unhandled] call OSD interface to notify OS of fatal error
|
||||
* requiring shutdown!
|
||||
*/
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Free the operands */
|
||||
|
||||
AcpiCmRemoveReference (ArgDesc);
|
||||
AcpiCmRemoveReference (CodeDesc);
|
||||
AcpiCmRemoveReference (TypeDesc);
|
||||
|
||||
|
||||
/* If we get back from the OS call, we might as well keep going. */
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR, ("AmlExecFatal: FatalOp executed\n"));
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecIndex
|
||||
* FUNCTION: AcpiExConcatTemplate
|
||||
*
|
||||
* PARAMETERS: none
|
||||
* PARAMETERS: *ObjDesc - Object to be converted. Must be an
|
||||
* Integer, Buffer, or String
|
||||
* WalkState - Current walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Execute Index operator
|
||||
*
|
||||
* ALLOCATION: Deletes one operand descriptor -- other remains on stack
|
||||
*
|
||||
* ACPI SPECIFICATION REFERENCES:
|
||||
* DefIndex := IndexOp BuffPkgObj IndexValue Result
|
||||
* IndexValue := TermArg=>Integer
|
||||
* NameString := <RootChar NamePath> | <PrefixPath NamePath>
|
||||
* Result := SuperName
|
||||
* SuperName := NameString | ArgObj | LocalObj | DebugObj | DefIndex
|
||||
* Local4Op | Local5Op | Local6Op | Local7Op
|
||||
* DESCRIPTION: Concatenate two resource templates
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlExecIndex (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OBJECT_INTERNAL **ReturnDesc)
|
||||
AcpiExConcatTemplate (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc1,
|
||||
ACPI_OPERAND_OBJECT *ObjDesc2,
|
||||
ACPI_OPERAND_OBJECT **ActualReturnDesc,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_OBJECT_INTERNAL *ObjDesc;
|
||||
ACPI_OBJECT_INTERNAL *IdxDesc;
|
||||
ACPI_OBJECT_INTERNAL *ResDesc;
|
||||
ACPI_OBJECT_INTERNAL *RetDesc = NULL;
|
||||
ACPI_OBJECT_INTERNAL *TmpDesc;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *ReturnDesc;
|
||||
UINT8 *NewBuf;
|
||||
UINT8 *EndTag1;
|
||||
UINT8 *EndTag2;
|
||||
ACPI_SIZE Length1;
|
||||
ACPI_SIZE Length2;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlExecIndex");
|
||||
ACPI_FUNCTION_TRACE ("ExConcatTemplate");
|
||||
|
||||
|
||||
/* Resolve operands */
|
||||
/* First operand can be either a package or a buffer */
|
||||
/* Find the EndTags in each resource template */
|
||||
|
||||
Status = AcpiAmlResolveOperands (AML_INDEX_OP, WALK_OPERANDS);
|
||||
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
|
||||
AcpiPsGetOpcodeName (AML_INDEX_OP),
|
||||
3, "after AcpiAmlResolveOperands");
|
||||
|
||||
/* Get all operands */
|
||||
|
||||
Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&IdxDesc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
EndTag1 = AcpiUtGetResourceEndTag (ObjDesc1);
|
||||
EndTag2 = AcpiUtGetResourceEndTag (ObjDesc2);
|
||||
if (!EndTag1 || !EndTag2)
|
||||
{
|
||||
/* Invalid parameters on object stack */
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AcpiAmlExecIndex/AML_INDEX_OP: bad operand(s) (0x%X)\n",
|
||||
Status));
|
||||
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/* Compute the length of each part */
|
||||
|
||||
/* Create the internal return object */
|
||||
Length1 = ACPI_PTR_DIFF (EndTag1, ObjDesc1->Buffer.Pointer);
|
||||
Length2 = ACPI_PTR_DIFF (EndTag2, ObjDesc2->Buffer.Pointer) +
|
||||
2; /* Size of END_TAG */
|
||||
|
||||
RetDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
|
||||
if (!RetDesc)
|
||||
/* Create a new buffer object for the result */
|
||||
|
||||
ReturnDesc = AcpiUtCreateBufferObject (Length1 + Length2);
|
||||
if (!ReturnDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the templates to the new descriptor */
|
||||
|
||||
/*
|
||||
* At this point, the ObjDesc operand is either a Package or a Buffer
|
||||
*/
|
||||
NewBuf = ReturnDesc->Buffer.Pointer;
|
||||
ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
|
||||
ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
|
||||
|
||||
if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
|
||||
{
|
||||
/* Object to be indexed is a Package */
|
||||
/* Compute the new checksum */
|
||||
|
||||
if (IdxDesc->Number.Value >= ObjDesc->Package.Count)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecIndex: Index value out of range\n"));
|
||||
Status = AE_AML_PACKAGE_LIMIT;
|
||||
goto Cleanup;
|
||||
}
|
||||
NewBuf[ReturnDesc->Buffer.Length - 1] =
|
||||
AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
|
||||
(ReturnDesc->Buffer.Length - 1));
|
||||
|
||||
if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) &&
|
||||
(ResDesc->Reference.OpCode == AML_ZERO_OP))
|
||||
{
|
||||
/*
|
||||
* There is no actual result descriptor (the ZeroOp Result
|
||||
* descriptor is a placeholder), so just delete the placeholder and
|
||||
* return a reference to the package element
|
||||
*/
|
||||
/* Return the completed template descriptor */
|
||||
|
||||
AcpiCmRemoveReference (ResDesc);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Each element of the package is an internal object. Get the one
|
||||
* we are after.
|
||||
*/
|
||||
|
||||
TmpDesc = ObjDesc->Package.Elements[IdxDesc->Number.Value];
|
||||
RetDesc->Reference.OpCode = AML_INDEX_OP;
|
||||
RetDesc->Reference.TargetType = TmpDesc->Common.Type;
|
||||
RetDesc->Reference.Object = TmpDesc;
|
||||
|
||||
Status = AcpiAmlExecStore (RetDesc, ResDesc);
|
||||
RetDesc->Reference.Object = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The local return object must always be a reference to the package element,
|
||||
* not the element itself.
|
||||
*/
|
||||
RetDesc->Reference.OpCode = AML_INDEX_OP;
|
||||
RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
|
||||
RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Number.Value];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Object to be indexed is a Buffer */
|
||||
|
||||
if (IdxDesc->Number.Value >= ObjDesc->Buffer.Length)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecIndex: Index value out of range\n"));
|
||||
Status = AE_AML_BUFFER_LIMIT;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
RetDesc->Reference.OpCode = AML_INDEX_OP;
|
||||
RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
|
||||
RetDesc->Reference.Object = ObjDesc;
|
||||
RetDesc->Reference.Offset = IdxDesc->Number.Value;
|
||||
|
||||
Status = AcpiAmlExecStore (RetDesc, ResDesc);
|
||||
}
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Always delete operands */
|
||||
|
||||
AcpiCmRemoveReference (ObjDesc);
|
||||
AcpiCmRemoveReference (IdxDesc);
|
||||
|
||||
/* Delete return object on error */
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
AcpiCmRemoveReference (ResDesc);
|
||||
|
||||
if (RetDesc)
|
||||
{
|
||||
AcpiCmRemoveReference (RetDesc);
|
||||
RetDesc = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the return object and exit */
|
||||
|
||||
*ReturnDesc = RetDesc;
|
||||
return_ACPI_STATUS (Status);
|
||||
*ActualReturnDesc = ReturnDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecMatch
|
||||
* FUNCTION: AcpiExDoConcatenate
|
||||
*
|
||||
* PARAMETERS: none
|
||||
* PARAMETERS: ObjDesc1 - First source object
|
||||
* ObjDesc2 - Second source object
|
||||
* ActualReturnDesc - Where to place the return object
|
||||
* WalkState - Current walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Execute Match operator
|
||||
*
|
||||
* ACPI SPECIFICATION REFERENCES:
|
||||
* DefMatch := MatchOp SearchPkg Opcode1 Operand1
|
||||
* Opcode2 Operand2 StartIndex
|
||||
* Opcode1 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT
|
||||
* Opcode2 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT
|
||||
* Operand1 := TermArg=>Integer
|
||||
* Operand2 := TermArg=>Integer
|
||||
* SearchPkg := TermArg=>PackageObject
|
||||
* StartIndex := TermArg=>Integer
|
||||
* DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlExecMatch (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OBJECT_INTERNAL **ReturnDesc)
|
||||
AcpiExDoConcatenate (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc1,
|
||||
ACPI_OPERAND_OBJECT *ObjDesc2,
|
||||
ACPI_OPERAND_OBJECT **ActualReturnDesc,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_OBJECT_INTERNAL *PkgDesc;
|
||||
ACPI_OBJECT_INTERNAL *Op1Desc;
|
||||
ACPI_OBJECT_INTERNAL *V1Desc;
|
||||
ACPI_OBJECT_INTERNAL *Op2Desc;
|
||||
ACPI_OBJECT_INTERNAL *V2Desc;
|
||||
ACPI_OBJECT_INTERNAL *StartDesc;
|
||||
ACPI_OBJECT_INTERNAL *RetDesc = NULL;
|
||||
ACPI_STATUS Status;
|
||||
UINT32 Index;
|
||||
UINT32 MatchValue = (UINT32) -1;
|
||||
UINT32 i;
|
||||
ACPI_INTEGER ThisInteger;
|
||||
ACPI_OPERAND_OBJECT *ReturnDesc;
|
||||
char *NewBuf;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlExecMatch");
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* Resolve all operands */
|
||||
|
||||
Status = AcpiAmlResolveOperands (AML_MATCH_OP, WALK_OPERANDS);
|
||||
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
|
||||
AcpiPsGetOpcodeName (AML_MATCH_OP),
|
||||
6, "after AcpiAmlResolveOperands");
|
||||
|
||||
/* Get all operands */
|
||||
|
||||
Status |= AcpiDsObjStackPopObject (&StartDesc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&V2Desc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&Op2Desc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&V1Desc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&Op1Desc, WalkState);
|
||||
Status |= AcpiDsObjStackPopObject (&PkgDesc, WalkState);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Invalid parameters on object stack */
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("ExecMatch/AML_MATCH_OP: bad operand(s) (0x%X)\n",
|
||||
Status));
|
||||
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Validate match comparison sub-opcodes */
|
||||
|
||||
if ((Op1Desc->Number.Value > MAX_MATCH_OPERATOR) ||
|
||||
(Op2Desc->Number.Value > MAX_MATCH_OPERATOR))
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecMatch: operation encoding out of range\n"));
|
||||
Status = AE_AML_OPERAND_VALUE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Index = StartDesc->Number.Value;
|
||||
if (Index >= (UINT32) PkgDesc->Package.Count)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecMatch: start position value out of range\n"));
|
||||
Status = AE_AML_PACKAGE_LIMIT;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
|
||||
if (!RetDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Examine each element until a match is found. Within the loop,
|
||||
* "continue" signifies that the current element does not match
|
||||
* and the next should be examined.
|
||||
* Upon finding a match, the loop will terminate via "break" at
|
||||
* the bottom. If it terminates "normally", MatchValue will be -1
|
||||
* (its initial value) indicating that no match was found. When
|
||||
* returned as a Number, this will produce the Ones value as specified.
|
||||
* There are three cases to handle:
|
||||
*
|
||||
* 1) Two Integers concatenated to produce a new Buffer
|
||||
* 2) Two Strings concatenated to produce a new String
|
||||
* 3) Two Buffers concatenated to produce a new Buffer
|
||||
*/
|
||||
|
||||
for ( ; Index < PkgDesc->Package.Count; ++Index)
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc1))
|
||||
{
|
||||
/*
|
||||
* Treat any NULL or non-numeric elements as non-matching.
|
||||
* TBD [Unhandled] - if an element is a Name,
|
||||
* should we examine its value?
|
||||
*/
|
||||
if (!PkgDesc->Package.Elements[Index] ||
|
||||
ACPI_TYPE_NUMBER != PkgDesc->Package.Elements[Index]->Common.Type)
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/* Result of two Integers is a Buffer */
|
||||
/* Need enough buffer space for two integers */
|
||||
|
||||
ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth * 2);
|
||||
if (!ReturnDesc)
|
||||
{
|
||||
continue;
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Within these switch statements:
|
||||
* "break" (exit from the switch) signifies a match;
|
||||
* "continue" (proceed to next iteration of enclosing
|
||||
* "for" loop) signifies a non-match.
|
||||
*/
|
||||
switch (Op1Desc->Number.Value)
|
||||
NewBuf = (char *) ReturnDesc->Buffer.Pointer;
|
||||
|
||||
/* Convert the first integer */
|
||||
|
||||
ThisInteger = ObjDesc1->Integer.Value;
|
||||
for (i = 0; i < AcpiGbl_IntegerByteWidth; i++)
|
||||
{
|
||||
|
||||
case MATCH_MTR: /* always true */
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MEQ: /* true if equal */
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
!= V1Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MLE: /* true if less than or equal */
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
> V1Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MLT: /* true if less than */
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
>= V1Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MGE: /* true if greater than or equal */
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
< V1Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MGT: /* true if greater than */
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
<= V1Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: /* undefined */
|
||||
|
||||
continue;
|
||||
NewBuf[i] = (char) ThisInteger;
|
||||
ThisInteger >>= 8;
|
||||
}
|
||||
|
||||
/* Convert the second integer */
|
||||
|
||||
switch(Op2Desc->Number.Value)
|
||||
ThisInteger = ObjDesc2->Integer.Value;
|
||||
for (; i < (ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); i++)
|
||||
{
|
||||
|
||||
case MATCH_MTR:
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MEQ:
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
!= V2Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MLE:
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
> V2Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MLT:
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
>= V2Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MGE:
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
< V2Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MATCH_MGT:
|
||||
|
||||
if (PkgDesc->Package.Elements[Index]->Number.Value
|
||||
<= V2Desc->Number.Value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
continue;
|
||||
NewBuf[i] = (char) ThisInteger;
|
||||
ThisInteger >>= 8;
|
||||
}
|
||||
|
||||
/* Match found: exit from loop */
|
||||
|
||||
MatchValue = Index;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/* Result of two Strings is a String */
|
||||
|
||||
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING);
|
||||
if (!ReturnDesc)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Operand0 is string */
|
||||
|
||||
NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) ObjDesc1->String.Length +
|
||||
(ACPI_SIZE) ObjDesc2->String.Length + 1);
|
||||
if (!NewBuf)
|
||||
{
|
||||
ACPI_REPORT_ERROR
|
||||
(("ExDoConcatenate: String allocation failure\n"));
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Concatenate the strings */
|
||||
|
||||
ACPI_STRCPY (NewBuf, ObjDesc1->String.Pointer);
|
||||
ACPI_STRCPY (NewBuf + ObjDesc1->String.Length,
|
||||
ObjDesc2->String.Pointer);
|
||||
|
||||
/* Complete the String object initialization */
|
||||
|
||||
ReturnDesc->String.Pointer = NewBuf;
|
||||
ReturnDesc->String.Length = ObjDesc1->String.Length +
|
||||
ObjDesc2->String.Length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* Result of two Buffers is a Buffer */
|
||||
|
||||
ReturnDesc = AcpiUtCreateBufferObject (
|
||||
(ACPI_SIZE) ObjDesc1->Buffer.Length +
|
||||
(ACPI_SIZE) ObjDesc2->Buffer.Length);
|
||||
if (!ReturnDesc)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
NewBuf = (char *) ReturnDesc->Buffer.Pointer;
|
||||
|
||||
/* Concatenate the buffers */
|
||||
|
||||
ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer,
|
||||
ObjDesc1->Buffer.Length);
|
||||
ACPI_MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer,
|
||||
ObjDesc2->Buffer.Length);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Invalid object type, should not happen here */
|
||||
|
||||
Status = AE_AML_INTERNAL;
|
||||
ReturnDesc = NULL;
|
||||
}
|
||||
|
||||
/* MatchValue is the return value */
|
||||
|
||||
RetDesc->Number.Value = MatchValue;
|
||||
*ActualReturnDesc = ReturnDesc;
|
||||
return (AE_OK);
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Free the operands */
|
||||
|
||||
AcpiCmRemoveReference (StartDesc);
|
||||
AcpiCmRemoveReference (V2Desc);
|
||||
AcpiCmRemoveReference (Op2Desc);
|
||||
AcpiCmRemoveReference (V1Desc);
|
||||
AcpiCmRemoveReference (Op1Desc);
|
||||
AcpiCmRemoveReference (PkgDesc);
|
||||
AcpiUtRemoveReference (ReturnDesc);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/* Delete return object on error */
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExDoMathOp
|
||||
*
|
||||
* PARAMETERS: Opcode - AML opcode
|
||||
* Operand0 - Integer operand #0
|
||||
* Operand1 - Integer operand #1
|
||||
*
|
||||
* RETURN: Integer result of the operation
|
||||
*
|
||||
* DESCRIPTION: Execute a math AML opcode. The purpose of having all of the
|
||||
* math functions here is to prevent a lot of pointer dereferencing
|
||||
* to obtain the operands.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
if (ACPI_FAILURE (Status) &&
|
||||
(RetDesc))
|
||||
ACPI_INTEGER
|
||||
AcpiExDoMathOp (
|
||||
UINT16 Opcode,
|
||||
ACPI_INTEGER Operand0,
|
||||
ACPI_INTEGER Operand1)
|
||||
{
|
||||
|
||||
|
||||
switch (Opcode)
|
||||
{
|
||||
AcpiCmRemoveReference (RetDesc);
|
||||
RetDesc = NULL;
|
||||
case AML_ADD_OP: /* Add (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 + Operand1);
|
||||
|
||||
|
||||
case AML_BIT_AND_OP: /* And (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 & Operand1);
|
||||
|
||||
|
||||
case AML_BIT_NAND_OP: /* NAnd (Operand0, Operand1, Result) */
|
||||
|
||||
return (~(Operand0 & Operand1));
|
||||
|
||||
|
||||
case AML_BIT_OR_OP: /* Or (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 | Operand1);
|
||||
|
||||
|
||||
case AML_BIT_NOR_OP: /* NOr (Operand0, Operand1, Result) */
|
||||
|
||||
return (~(Operand0 | Operand1));
|
||||
|
||||
|
||||
case AML_BIT_XOR_OP: /* XOr (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 ^ Operand1);
|
||||
|
||||
|
||||
case AML_MULTIPLY_OP: /* Multiply (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 * Operand1);
|
||||
|
||||
|
||||
case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result) */
|
||||
|
||||
return (Operand0 << Operand1);
|
||||
|
||||
|
||||
case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
|
||||
|
||||
return (Operand0 >> Operand1);
|
||||
|
||||
|
||||
case AML_SUBTRACT_OP: /* Subtract (Operand0, Operand1, Result) */
|
||||
|
||||
return (Operand0 - Operand1);
|
||||
|
||||
default:
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExDoLogicalOp
|
||||
*
|
||||
* PARAMETERS: Opcode - AML opcode
|
||||
* Operand0 - Integer operand #0
|
||||
* Operand1 - Integer operand #1
|
||||
*
|
||||
* RETURN: TRUE/FALSE result of the operation
|
||||
*
|
||||
* DESCRIPTION: Execute a logical AML opcode. The purpose of having all of the
|
||||
* functions here is to prevent a lot of pointer dereferencing
|
||||
* to obtain the operands and to simplify the generation of the
|
||||
* logical value.
|
||||
*
|
||||
* Note: cleanest machine code seems to be produced by the code
|
||||
* below, rather than using statements of the form:
|
||||
* Result = (Operand0 == Operand1);
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiExDoLogicalOp (
|
||||
UINT16 Opcode,
|
||||
ACPI_INTEGER Operand0,
|
||||
ACPI_INTEGER Operand1)
|
||||
{
|
||||
|
||||
|
||||
switch (Opcode)
|
||||
{
|
||||
|
||||
case AML_LAND_OP: /* LAnd (Operand0, Operand1) */
|
||||
|
||||
if (Operand0 && Operand1)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
|
||||
|
||||
if (Operand0 == Operand1)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
|
||||
|
||||
if (Operand0 > Operand1)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
|
||||
|
||||
if (Operand0 < Operand1)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_LOR_OP: /* LOr (Operand0, Operand1) */
|
||||
|
||||
if (Operand0 || Operand1)
|
||||
{
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Set the return object and exit */
|
||||
|
||||
*ReturnDesc = RetDesc;
|
||||
return_ACPI_STATUS (Status);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exmutex - ASL Mutex Acquire/Release functions
|
||||
* $Revision: 1.25 $
|
||||
* $Revision: 1.20 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -128,7 +128,7 @@
|
||||
*
|
||||
* FUNCTION: AcpiExUnlinkMutex
|
||||
*
|
||||
* PARAMETERS: ObjDesc - The mutex to be unlinked
|
||||
* PARAMETERS: *ObjDesc - The mutex to be unlinked
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -148,8 +148,6 @@ AcpiExUnlinkMutex (
|
||||
return;
|
||||
}
|
||||
|
||||
/* Doubly linked list */
|
||||
|
||||
if (ObjDesc->Mutex.Next)
|
||||
{
|
||||
(ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev;
|
||||
@ -170,8 +168,8 @@ AcpiExUnlinkMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExLinkMutex
|
||||
*
|
||||
* PARAMETERS: ObjDesc - The mutex to be linked
|
||||
* ListHead - head of the "AcquiredMutex" list
|
||||
* PARAMETERS: *ObjDesc - The mutex to be linked
|
||||
* *ListHead - head of the "AcquiredMutex" list
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -211,8 +209,8 @@ AcpiExLinkMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExAcquireMutex
|
||||
*
|
||||
* PARAMETERS: TimeDesc - The 'time to delay' object descriptor
|
||||
* ObjDesc - The object descriptor for this op
|
||||
* PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
|
||||
* *ObjDesc - The object descriptor for this op
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -257,22 +255,19 @@ AcpiExAcquireMutex (
|
||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
||||
}
|
||||
|
||||
/* Support for multiple acquires by the owning thread */
|
||||
/*
|
||||
* Support for multiple acquires by the owning thread
|
||||
*/
|
||||
|
||||
if (ObjDesc->Mutex.OwnerThread)
|
||||
if ((ObjDesc->Mutex.OwnerThread) &&
|
||||
(ObjDesc->Mutex.OwnerThread->ThreadId == WalkState->Thread->ThreadId))
|
||||
{
|
||||
/* Special case for Global Lock, allow all threads */
|
||||
|
||||
if ((ObjDesc->Mutex.OwnerThread->ThreadId == WalkState->Thread->ThreadId) ||
|
||||
(ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore))
|
||||
{
|
||||
/*
|
||||
* The mutex is already owned by this thread,
|
||||
* just increment the acquisition depth
|
||||
*/
|
||||
ObjDesc->Mutex.AcquisitionDepth++;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
/*
|
||||
* The mutex is already owned by this thread,
|
||||
* just increment the acquisition depth
|
||||
*/
|
||||
ObjDesc->Mutex.AcquisitionDepth++;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Acquire the mutex, wait if necessary */
|
||||
@ -285,11 +280,10 @@ AcpiExAcquireMutex (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Have the mutex: update mutex and walk info and save the SyncLevel */
|
||||
/* Have the mutex, update mutex and walk info */
|
||||
|
||||
ObjDesc->Mutex.OwnerThread = WalkState->Thread;
|
||||
ObjDesc->Mutex.AcquisitionDepth = 1;
|
||||
ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
|
||||
ObjDesc->Mutex.OwnerThread = WalkState->Thread;
|
||||
ObjDesc->Mutex.AcquisitionDepth = 1;
|
||||
|
||||
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
|
||||
|
||||
@ -305,7 +299,7 @@ AcpiExAcquireMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExReleaseMutex
|
||||
*
|
||||
* PARAMETERS: ObjDesc - The object descriptor for this op
|
||||
* PARAMETERS: *ObjDesc - The object descriptor for this op
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -347,12 +341,9 @@ AcpiExReleaseMutex (
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* The Mutex is owned, but this thread must be the owner.
|
||||
* Special case for Global Lock, any thread can release
|
||||
*/
|
||||
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
|
||||
(ObjDesc->Mutex.Semaphore != AcpiGbl_GlobalLockSemaphore))
|
||||
/* The Mutex is owned, but this thread must be the owner */
|
||||
|
||||
if (ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId)
|
||||
{
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
|
||||
@ -373,8 +364,9 @@ AcpiExReleaseMutex (
|
||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
||||
}
|
||||
|
||||
/* Match multiple Acquires with multiple Releases */
|
||||
|
||||
/*
|
||||
* Match multiple Acquires with multiple Releases
|
||||
*/
|
||||
ObjDesc->Mutex.AcquisitionDepth--;
|
||||
if (ObjDesc->Mutex.AcquisitionDepth != 0)
|
||||
{
|
||||
@ -391,10 +383,10 @@ AcpiExReleaseMutex (
|
||||
|
||||
Status = AcpiExSystemReleaseMutex (ObjDesc);
|
||||
|
||||
/* Update the mutex and walk state, restore SyncLevel before acquire */
|
||||
/* Update the mutex and walk state */
|
||||
|
||||
ObjDesc->Mutex.OwnerThread = NULL;
|
||||
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
|
||||
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
@ -404,7 +396,7 @@ AcpiExReleaseMutex (
|
||||
*
|
||||
* FUNCTION: AcpiExReleaseAllMutexes
|
||||
*
|
||||
* PARAMETERS: MutexList - Head of the mutex list
|
||||
* PARAMETERS: *MutexList - Head of the mutex list
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -424,8 +416,9 @@ AcpiExReleaseAllMutexes (
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/* Traverse the list of owned mutexes, releasing each one */
|
||||
|
||||
/*
|
||||
* Traverse the list of owned mutexes, releasing each one.
|
||||
*/
|
||||
while (Next)
|
||||
{
|
||||
This = Next;
|
||||
@ -445,11 +438,7 @@ AcpiExReleaseAllMutexes (
|
||||
|
||||
/* Mark mutex unowned */
|
||||
|
||||
This->Mutex.OwnerThread = NULL;
|
||||
|
||||
/* Update Thread SyncLevel (Last mutex is the important one) */
|
||||
|
||||
Thread->CurrentSyncLevel = This->Mutex.OriginalSyncLevel;
|
||||
This->Mutex.OwnerThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amnames - interpreter/scanner name load/execute
|
||||
* Module Name: exnames - interpreter/scanner name load/execute
|
||||
* $Revision: 1.95 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,8 +10,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -114,15 +115,14 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __AMNAMES_C__
|
||||
#define __EXNAMES_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acinterp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
#define _COMPONENT INTERPRETER
|
||||
MODULE_NAME ("amnames");
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exnames")
|
||||
|
||||
|
||||
/* AML Package Length encodings */
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlAllocateNameString
|
||||
* FUNCTION: AcpiExAllocateNameString
|
||||
*
|
||||
* PARAMETERS: PrefixCount - Count of parent levels. Special cases:
|
||||
* (-1) = root, 0 = none
|
||||
@ -149,16 +149,16 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
INT8 *
|
||||
AcpiAmlAllocateNameString (
|
||||
char *
|
||||
AcpiExAllocateNameString (
|
||||
UINT32 PrefixCount,
|
||||
UINT32 NumNameSegs)
|
||||
{
|
||||
INT8 *TempPtr;
|
||||
INT8 *NameString;
|
||||
char *TempPtr;
|
||||
char *NameString;
|
||||
UINT32 SizeNeeded;
|
||||
|
||||
FUNCTION_TRACE ("AmlAllocateNameString");
|
||||
ACPI_FUNCTION_TRACE ("ExAllocateNameString");
|
||||
|
||||
|
||||
/*
|
||||
@ -166,8 +166,7 @@ AcpiAmlAllocateNameString (
|
||||
* Also, one byte for the null terminator.
|
||||
* This may actually be somewhat longer than needed.
|
||||
*/
|
||||
|
||||
if (PrefixCount == (UINT32) -1)
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
{
|
||||
/* Special case for root */
|
||||
|
||||
@ -182,11 +181,10 @@ AcpiAmlAllocateNameString (
|
||||
* Allocate a buffer for the name.
|
||||
* This buffer must be deleted by the caller!
|
||||
*/
|
||||
|
||||
NameString = AcpiCmAllocate (SizeNeeded);
|
||||
NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
|
||||
if (!NameString)
|
||||
{
|
||||
REPORT_ERROR ("AmlAllocateNameString: name allocation failure");
|
||||
ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
@ -194,11 +192,10 @@ AcpiAmlAllocateNameString (
|
||||
|
||||
/* Set up Root or Parent prefixes if needed */
|
||||
|
||||
if (PrefixCount == (UINT32) -1)
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
{
|
||||
*TempPtr++ = AML_ROOT_PREFIX;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
while (PrefixCount--)
|
||||
@ -217,7 +214,6 @@ AcpiAmlAllocateNameString (
|
||||
*TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
|
||||
*TempPtr++ = (char) NumNameSegs;
|
||||
}
|
||||
|
||||
else if (2 == NumNameSegs)
|
||||
{
|
||||
/* Set up dual prefixes */
|
||||
@ -226,71 +222,17 @@ AcpiAmlAllocateNameString (
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate string following prefixes. AcpiAmlExecNameSegment() will
|
||||
* Terminate string following prefixes. AcpiExNameSegment() will
|
||||
* append the segment(s)
|
||||
*/
|
||||
|
||||
*TempPtr = 0;
|
||||
|
||||
return_PTR (NameString);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlDecodePackageLength
|
||||
*
|
||||
* PARAMETERS: LastPkgLen - latest value decoded by DoPkgLength() for
|
||||
* most recently examined package or field
|
||||
*
|
||||
* RETURN: Number of bytes contained in package length encoding
|
||||
*
|
||||
* DESCRIPTION: Decodes the Package Length. Upper 2 bits are are used to
|
||||
* tell if type 1, 2, 3, or 4.
|
||||
* 0x3F = Max 1 byte encoding,
|
||||
* 0xFFF = Max 2 byte encoding,
|
||||
* 0xFFFFF = Max 3 Byte encoding,
|
||||
* 0xFFFFFFFFF = Max 4 Byte encoding.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiAmlDecodePackageLength (
|
||||
UINT32 LastPkgLen)
|
||||
{
|
||||
UINT32 NumBytes = 0;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlDecodePackageLength");
|
||||
|
||||
|
||||
if (LastPkgLen < ACPI_AML_PACKAGE_TYPE1)
|
||||
{
|
||||
NumBytes = 1;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE2)
|
||||
{
|
||||
NumBytes = 2;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE3)
|
||||
{
|
||||
NumBytes = 3;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE4)
|
||||
{
|
||||
NumBytes = 4;
|
||||
}
|
||||
|
||||
return_VALUE (NumBytes);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecNameSegment
|
||||
* FUNCTION: AcpiExNameSegment
|
||||
*
|
||||
* PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
|
||||
*
|
||||
@ -301,47 +243,45 @@ AcpiAmlDecodePackageLength (
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlExecNameSegment (
|
||||
AcpiExNameSegment (
|
||||
UINT8 **InAmlAddress,
|
||||
INT8 *NameString)
|
||||
char *NameString)
|
||||
{
|
||||
UINT8 *AmlAddress = *InAmlAddress;
|
||||
char *AmlAddress = (void *) *InAmlAddress;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
INT32 Index;
|
||||
INT8 CharBuf[5];
|
||||
UINT32 Index;
|
||||
char CharBuf[5];
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlExecNameSegment");
|
||||
ACPI_FUNCTION_TRACE ("ExNameSegment");
|
||||
|
||||
|
||||
/*
|
||||
* If first character is a digit, then we know that we aren't looking at a
|
||||
* valid name segment
|
||||
*/
|
||||
|
||||
CharBuf[0] = *AmlAddress;
|
||||
|
||||
if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecNameSegment: leading digit: %c\n", CharBuf[0]));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
|
||||
return_ACPI_STATUS (AE_CTRL_PENDING);
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_LOAD, ("AmlExecNameSegment: Bytes from stream:\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
||||
|
||||
for (Index = 4;
|
||||
(Index > 0) && (AcpiCmValidAcpiCharacter (*AmlAddress));
|
||||
--Index)
|
||||
for (Index = 0;
|
||||
(Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
|
||||
Index++)
|
||||
{
|
||||
CharBuf[4 - Index] = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("%c\n", CharBuf[4 - Index]));
|
||||
CharBuf[Index] = *AmlAddress++;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[Index]));
|
||||
}
|
||||
|
||||
|
||||
/* Valid name segment */
|
||||
|
||||
if (0 == Index)
|
||||
if (Index == 4)
|
||||
{
|
||||
/* Found 4 valid characters */
|
||||
|
||||
@ -349,52 +289,44 @@ AcpiAmlExecNameSegment (
|
||||
|
||||
if (NameString)
|
||||
{
|
||||
STRCAT (NameString, CharBuf);
|
||||
DEBUG_PRINT (TRACE_NAMES,
|
||||
("AmlExecNameSegment: Appended to - %s \n", NameString));
|
||||
ACPI_STRCAT (NameString, CharBuf);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
||||
"Appended to - %s \n", NameString));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DEBUG_PRINT (TRACE_NAMES,
|
||||
("AmlExecNameSegment: No Name string - %s \n", CharBuf));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
||||
"No Name string - %s \n", CharBuf));
|
||||
}
|
||||
}
|
||||
|
||||
else if (4 == Index)
|
||||
else if (Index == 0)
|
||||
{
|
||||
/*
|
||||
* First character was not a valid name character,
|
||||
* so we are looking at something other than a name.
|
||||
*/
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlExecNameSegment: Leading INT8 not alpha: %02Xh (not a name)\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Leading character is not alpha: %02Xh (not a name)\n",
|
||||
CharBuf[0]));
|
||||
Status = AE_CTRL_PENDING;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Segment started with one or more valid characters, but fewer than 4 */
|
||||
|
||||
Status = AE_AML_BAD_NAME;
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecNameSegment: Bad INT8 %02x in name, at %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
|
||||
*AmlAddress, AmlAddress));
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("Leave AcpiAmlExecNameSegment %s \n",
|
||||
AcpiCmFormatException (Status)));
|
||||
|
||||
*InAmlAddress = AmlAddress;
|
||||
|
||||
*InAmlAddress = (UINT8 *) AmlAddress;
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlGetNameString
|
||||
* FUNCTION: AcpiExGetNameString
|
||||
*
|
||||
* PARAMETERS: DataType - Data type to be associated with this name
|
||||
*
|
||||
@ -404,62 +336,59 @@ AcpiAmlExecNameSegment (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiAmlGetNameString (
|
||||
OBJECT_TYPE_INTERNAL DataType,
|
||||
AcpiExGetNameString (
|
||||
ACPI_OBJECT_TYPE DataType,
|
||||
UINT8 *InAmlAddress,
|
||||
INT8 **OutNameString,
|
||||
char **OutNameString,
|
||||
UINT32 *OutNameLength)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT8 *AmlAddress = InAmlAddress;
|
||||
INT8 *NameString = NULL;
|
||||
INT32 NumSegments;
|
||||
INT32 PrefixCount = 0;
|
||||
UINT8 Prefix = 0;
|
||||
char *NameString = NULL;
|
||||
UINT32 NumSegments;
|
||||
UINT32 PrefixCount = 0;
|
||||
BOOLEAN HasPrefix = FALSE;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("AmlGetNameString", AmlAddress);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
|
||||
|
||||
|
||||
if (INTERNAL_TYPE_DEF_FIELD == DataType ||
|
||||
INTERNAL_TYPE_BANK_FIELD == DataType ||
|
||||
INTERNAL_TYPE_INDEX_FIELD == DataType)
|
||||
if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType ||
|
||||
ACPI_TYPE_LOCAL_BANK_FIELD == DataType ||
|
||||
ACPI_TYPE_LOCAL_INDEX_FIELD == DataType)
|
||||
{
|
||||
/* Disallow prefixes for types associated with field names */
|
||||
/* Disallow prefixes for types associated with FieldUnit names */
|
||||
|
||||
NameString = AcpiAmlAllocateNameString (0, 1);
|
||||
NameString = AcpiExAllocateNameString (0, 1);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/*
|
||||
* DataType is not a field name.
|
||||
* Examine first character of name for root or parent prefix operators
|
||||
*/
|
||||
|
||||
switch (*AmlAddress)
|
||||
{
|
||||
|
||||
case AML_ROOT_PREFIX:
|
||||
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("RootPrefix: %x\n", Prefix));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
|
||||
|
||||
/*
|
||||
* Remember that we have a RootPrefix --
|
||||
* see comment in AcpiAmlAllocateNameString()
|
||||
* see comment in AcpiExAllocateNameString()
|
||||
*/
|
||||
PrefixCount = -1;
|
||||
AmlAddress++;
|
||||
PrefixCount = ACPI_UINT32_MAX;
|
||||
HasPrefix = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
@ -469,18 +398,21 @@ AcpiAmlGetNameString (
|
||||
|
||||
do
|
||||
{
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("ParentPrefix: %x\n", Prefix));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
|
||||
|
||||
++PrefixCount;
|
||||
AmlAddress++;
|
||||
PrefixCount++;
|
||||
|
||||
} while (*AmlAddress == AML_PARENT_PREFIX);
|
||||
|
||||
HasPrefix = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Not a prefix character */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -489,55 +421,55 @@ AcpiAmlGetNameString (
|
||||
|
||||
switch (*AmlAddress)
|
||||
{
|
||||
|
||||
case AML_DUAL_NAME_PREFIX:
|
||||
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("DualNamePrefix: %x\n", Prefix));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
|
||||
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 2);
|
||||
AmlAddress++;
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 2);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ensure PrefixCount != 0 to remember processing a prefix */
|
||||
/* Indicate that we processed a prefix */
|
||||
|
||||
PrefixCount += 2;
|
||||
HasPrefix = TRUE;
|
||||
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_MULTI_NAME_PREFIX_OP:
|
||||
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("MultiNamePrefix: %x\n", Prefix));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
|
||||
|
||||
/* Fetch count of segments remaining in name path */
|
||||
|
||||
NumSegments = *AmlAddress++;
|
||||
AmlAddress++;
|
||||
NumSegments = *AmlAddress;
|
||||
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, NumSegments);
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ensure PrefixCount != 0 to remember processing a prefix */
|
||||
/* Indicate that we processed a prefix */
|
||||
|
||||
PrefixCount += 2;
|
||||
AmlAddress++;
|
||||
HasPrefix = TRUE;
|
||||
|
||||
while (NumSegments &&
|
||||
(Status = AcpiAmlExecNameSegment (&AmlAddress, NameString)) == AE_OK)
|
||||
(Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
|
||||
{
|
||||
--NumSegments;
|
||||
NumSegments--;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -547,16 +479,15 @@ AcpiAmlGetNameString (
|
||||
|
||||
/* NullName valid as of 8-12-98 ASL/AML Grammar Update */
|
||||
|
||||
if (-1 == PrefixCount)
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
{
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("AmlDoName: NameSeg is \"\\\" followed by NULL\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
|
||||
}
|
||||
|
||||
/* Consume the NULL byte */
|
||||
|
||||
AmlAddress++;
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 0);
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 0);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
@ -570,32 +501,27 @@ AcpiAmlGetNameString (
|
||||
|
||||
/* Name segment string */
|
||||
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 1);
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 1);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
break;
|
||||
|
||||
} /* Switch (PeekOp ()) */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (AE_CTRL_PENDING == Status && PrefixCount != 0)
|
||||
if (AE_CTRL_PENDING == Status && HasPrefix)
|
||||
{
|
||||
/* Ran out of segments after processing a prefix */
|
||||
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlDoName: Malformed Name at %p\n", NameString));
|
||||
REPORT_ERROR ("Ran out of segments after processing a prefix");
|
||||
|
||||
ACPI_REPORT_ERROR (
|
||||
("ExDoName: Malformed Name at %p\n", NameString));
|
||||
Status = AE_AML_BAD_NAME;
|
||||
}
|
||||
|
||||
|
||||
*OutNameString = NameString;
|
||||
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
|
||||
* $Revision: 1.21 $
|
||||
* $Revision: 1.19 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -300,10 +300,6 @@ AcpiExOpcode_3A_1T_1R (
|
||||
ReturnDesc->String.Pointer = Buffer;
|
||||
ReturnDesc->String.Length = (UINT32) Length;
|
||||
}
|
||||
|
||||
/* Mark buffer initialized */
|
||||
|
||||
ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
|
||||
break;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
|
||||
* $Revision: 1.14 $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
|
||||
* $Revision: 1.130 $
|
||||
* $Revision: 1.126 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -422,8 +422,6 @@ AcpiExPrepCommonFieldObject (
|
||||
ObjDesc->CommonField.AccessByteWidth = (UINT8)
|
||||
ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
|
||||
|
||||
ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth;
|
||||
|
||||
/*
|
||||
* BaseByteOffset is the address of the start of the field within the
|
||||
* region. It is the byte address of the first *datum* (field-width data
|
||||
@ -446,6 +444,28 @@ AcpiExPrepCommonFieldObject (
|
||||
ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
|
||||
(FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
|
||||
|
||||
/*
|
||||
* Valid bits -- the number of bits that compose a partial datum,
|
||||
* 1) At the end of the field within the region (arbitrary starting bit
|
||||
* offset)
|
||||
* 2) At the end of a buffer used to contain the field (starting offset
|
||||
* always zero)
|
||||
*/
|
||||
ObjDesc->CommonField.EndFieldValidBits = (UINT8)
|
||||
((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) %
|
||||
AccessBitWidth);
|
||||
/* StartBufferBitOffset always = 0 */
|
||||
|
||||
ObjDesc->CommonField.EndBufferValidBits = (UINT8)
|
||||
(FieldBitLength % AccessBitWidth);
|
||||
|
||||
/*
|
||||
* DatumValidBits is the number of valid field bits in the first
|
||||
* field datum.
|
||||
*/
|
||||
ObjDesc->CommonField.DatumValidBits = (UINT8)
|
||||
(AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
|
||||
|
||||
/*
|
||||
* Does the entire field fit within a single field access element? (datum)
|
||||
* (i.e., without crossing a datum boundary)
|
||||
@ -578,8 +598,7 @@ AcpiExPrepFieldValue (
|
||||
|
||||
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
|
||||
AcpiUtDeleteObjectDesc (ObjDesc);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Index Object\n"));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exregion - ACPI default OpRegion (address space) handlers
|
||||
* $Revision: 1.88 $
|
||||
* $Revision: 1.86 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -197,7 +197,7 @@ AcpiExSystemMemorySpaceHandler (
|
||||
* Hardware does not support non-aligned data transfers, we must verify
|
||||
* the request.
|
||||
*/
|
||||
(void) AcpiUtShortDivide ((ACPI_INTEGER) Address, Length, NULL, &Remainder);
|
||||
(void) AcpiUtShortDivide ((ACPI_INTEGER *) &Address, Length, NULL, &Remainder);
|
||||
if (Remainder != 0)
|
||||
{
|
||||
return_ACPI_STATUS (AE_AML_ALIGNMENT);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresnte - AML Interpreter object resolution
|
||||
* $Revision: 1.66 $
|
||||
* $Revision: 1.64 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -182,12 +182,11 @@ AcpiExResolveNodeToValue (
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
|
||||
Node, SourceDesc, AcpiUtGetTypeName (EntryType)));
|
||||
|
||||
if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) ||
|
||||
(EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS))
|
||||
if (EntryType == ACPI_TYPE_LOCAL_ALIAS)
|
||||
{
|
||||
/* There is always exactly one level of indirection */
|
||||
|
||||
Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
|
||||
Node = (ACPI_NAMESPACE_NODE *) Node->Object;
|
||||
SourceDesc = AcpiNsGetAttachedObject (Node);
|
||||
EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
|
||||
*ObjectPtr = Node;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresolv - AML Interpreter object resolution
|
||||
* $Revision: 1.126 $
|
||||
* $Revision: 1.122 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -269,15 +269,15 @@ AcpiExResolveObjectToValue (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n",
|
||||
StackDesc->Reference.Offset, ObjDesc));
|
||||
|
||||
/*
|
||||
* Now we can delete the original Reference Object and
|
||||
* replace it with the resolved value
|
||||
* replace it with the resolve value
|
||||
*/
|
||||
AcpiUtRemoveReference (StackDesc);
|
||||
*StackPtr = ObjDesc;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %d] ValueObj is %p\n",
|
||||
StackDesc->Reference.Offset, ObjDesc));
|
||||
break;
|
||||
|
||||
|
||||
@ -323,8 +323,8 @@ AcpiExResolveObjectToValue (
|
||||
|
||||
/* Invalid reference object */
|
||||
|
||||
ACPI_REPORT_ERROR ((
|
||||
"During resolve, Unknown TargetType %X in Index/Reference obj %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Unknown TargetType %X in Index/Reference obj %p\n",
|
||||
StackDesc->Reference.TargetType, StackDesc));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
@ -343,7 +343,7 @@ AcpiExResolveObjectToValue (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X (%s) in %p\n",
|
||||
Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
@ -412,47 +412,11 @@ AcpiExResolveMultiple (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc = (void *) Operand;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_OBJECT_TYPE Type;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple");
|
||||
|
||||
|
||||
/*
|
||||
* Operand can be either a namespace node or an operand descriptor
|
||||
*/
|
||||
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_DESC_TYPE_OPERAND:
|
||||
Type = ObjDesc->Common.Type;
|
||||
break;
|
||||
|
||||
case ACPI_DESC_TYPE_NAMED:
|
||||
Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
|
||||
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
|
||||
|
||||
/* If we had an Alias node, use the attached object for type info */
|
||||
|
||||
if (Type == ACPI_TYPE_LOCAL_ALIAS)
|
||||
{
|
||||
Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
|
||||
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If type is anything other than a reference, we are done
|
||||
*/
|
||||
if (Type != ACPI_TYPE_LOCAL_REFERENCE)
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* For reference objects created via the RefOf or Index operators,
|
||||
* we need to get to the base object (as per the ACPI specification
|
||||
@ -554,38 +518,6 @@ AcpiExResolveMultiple (
|
||||
break;
|
||||
|
||||
|
||||
case AML_LOCAL_OP:
|
||||
case AML_ARG_OP:
|
||||
|
||||
if (ReturnDesc)
|
||||
{
|
||||
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode,
|
||||
ObjDesc->Reference.Offset, WalkState, &ObjDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode,
|
||||
ObjDesc->Reference.Offset, WalkState, &Node);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
ObjDesc = AcpiNsGetAttachedObject (Node);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
Type = ACPI_TYPE_ANY;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_DEBUG_OP:
|
||||
|
||||
/* The Debug Object is of type "DebugObject" */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exresop - AML Interpreter operand/object resolution
|
||||
* $Revision: 1.72 $
|
||||
* $Revision: 1.66 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -234,13 +234,13 @@ AcpiExResolveOperands (
|
||||
ArgTypes = OpInfo->RuntimeArgs;
|
||||
if (ArgTypes == ARGI_INVALID_OPCODE)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("ResolveOperands: %X is not a valid AML opcode\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - %X is not a valid AML opcode\n",
|
||||
Opcode));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] RequiredOperandTypes=%8.8X \n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] OperandTypes=%X \n",
|
||||
Opcode, OpInfo->Name, ArgTypes));
|
||||
|
||||
/*
|
||||
@ -254,7 +254,7 @@ AcpiExResolveOperands (
|
||||
{
|
||||
if (!StackPtr || !*StackPtr)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("ResolveOperands: Null stack entry at %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null stack entry at %p\n",
|
||||
StackPtr));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
@ -314,13 +314,12 @@ AcpiExResolveOperands (
|
||||
case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
|
||||
|
||||
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Operand is a Reference, RefOpcode [%s]\n",
|
||||
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)));
|
||||
"Reference Opcode: %s\n", OpInfo->Name)));
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
|
||||
"Unknown Reference Opcode %X [%s]\n",
|
||||
ObjDesc->Reference.Opcode,
|
||||
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
|
||||
|
||||
@ -494,7 +493,7 @@ AcpiExResolveOperands (
|
||||
* But we can implicitly convert from a STRING or BUFFER
|
||||
* Aka - "Implicit Source Operand Conversion"
|
||||
*/
|
||||
Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
|
||||
Status = AcpiExConvertToInteger (ObjDesc, StackPtr, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status == AE_TYPE)
|
||||
@ -518,7 +517,7 @@ AcpiExResolveOperands (
|
||||
* But we can implicitly convert from a STRING or INTEGER
|
||||
* Aka - "Implicit Source Operand Conversion"
|
||||
*/
|
||||
Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
|
||||
Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status == AE_TYPE)
|
||||
@ -542,8 +541,7 @@ AcpiExResolveOperands (
|
||||
* But we can implicitly convert from a BUFFER or INTEGER
|
||||
* Aka - "Implicit Source Operand Conversion"
|
||||
*/
|
||||
Status = AcpiExConvertToString (ObjDesc, StackPtr,
|
||||
ACPI_IMPLICIT_CONVERT_HEX);
|
||||
Status = AcpiExConvertToString (ObjDesc, StackPtr, 16, ACPI_UINT32_MAX, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status == AE_TYPE)
|
||||
@ -599,7 +597,7 @@ AcpiExResolveOperands (
|
||||
|
||||
/* Highest priority conversion is to type Buffer */
|
||||
|
||||
Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
|
||||
Status = AcpiExConvertToBuffer (ObjDesc, StackPtr, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -691,34 +689,6 @@ AcpiExResolveOperands (
|
||||
goto NextOperand;
|
||||
|
||||
|
||||
case ARGI_DATAREFOBJ:
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
case ACPI_TYPE_STRING:
|
||||
case ACPI_TYPE_BUFFER:
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
case ACPI_TYPE_DDB_HANDLE:
|
||||
|
||||
/* Valid operand */
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
|
||||
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
|
||||
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto NextOperand;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Unknown type */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exstore - AML Interpreter object store support
|
||||
* $Revision: 1.187 $
|
||||
* $Revision: 1.178 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -178,8 +178,7 @@ AcpiExStore (
|
||||
* Storing an object into a Named node.
|
||||
*/
|
||||
Status = AcpiExStoreObjectToNode (SourceDesc,
|
||||
(ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
|
||||
ACPI_IMPLICIT_CONVERSION);
|
||||
(ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
@ -204,11 +203,10 @@ AcpiExStore (
|
||||
|
||||
default:
|
||||
|
||||
/* Destination is not a Reference object */
|
||||
/* Destination is not an Reference */
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Target is not a Reference or Constant object - %s [%p]\n",
|
||||
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
|
||||
"Destination is not a Reference or Constant object [%p]\n", DestDesc));
|
||||
|
||||
ACPI_DUMP_STACK_ENTRY (SourceDesc);
|
||||
ACPI_DUMP_STACK_ENTRY (DestDesc);
|
||||
@ -234,7 +232,7 @@ AcpiExStore (
|
||||
/* Storing an object into a Name "container" */
|
||||
|
||||
Status = AcpiExStoreObjectToNode (SourceDesc, RefDesc->Reference.Object,
|
||||
WalkState, ACPI_IMPLICIT_CONVERSION);
|
||||
WalkState);
|
||||
break;
|
||||
|
||||
|
||||
@ -262,64 +260,44 @@ AcpiExStore (
|
||||
* Storing to the Debug object causes the value stored to be
|
||||
* displayed and otherwise has no effect -- see ACPI Specification
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"**** Write to Debug Object: Object %p %s ****:\n\n",
|
||||
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
|
||||
AcpiUtGetObjectTypeName (SourceDesc)));
|
||||
|
||||
if (!AcpiUtValidInternalObject (SourceDesc))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
||||
"%p, Invalid Internal Object!\n", SourceDesc));
|
||||
break;
|
||||
}
|
||||
AcpiUtGetObjectTypeName (SourceDesc)));
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
if (AcpiGbl_IntegerByteWidth == 4)
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
|
||||
(UINT32) SourceDesc->Integer.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
|
||||
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
|
||||
(UINT32) SourceDesc->Buffer.Length));
|
||||
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
|
||||
(SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32);
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Length %.2X\n",
|
||||
(UINT32) SourceDesc->Buffer.Length));
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
|
||||
SourceDesc->String.Length, SourceDesc->String.Pointer));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s\n", SourceDesc->String.Pointer));
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
|
||||
SourceDesc->Package.Count, SourceDesc->Package.Elements));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Elements Ptr - %p\n",
|
||||
SourceDesc->Package.Elements));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
|
||||
SourceDesc));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n",
|
||||
AcpiUtGetObjectTypeName (SourceDesc), SourceDesc));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -329,7 +307,7 @@ AcpiExStore (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_REPORT_ERROR (("ExStore: Unknown Reference opcode %X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X\n",
|
||||
RefDesc->Reference.Opcode));
|
||||
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
|
||||
|
||||
@ -365,7 +343,6 @@ AcpiExStoreObjectToIndex (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_OPERAND_OBJECT *NewDesc;
|
||||
UINT8 Value = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
|
||||
@ -379,49 +356,52 @@ AcpiExStoreObjectToIndex (
|
||||
{
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
/*
|
||||
* Storing to a package element. Copy the object and replace
|
||||
* any existing object with the new object. No implicit
|
||||
* conversion is performed.
|
||||
*
|
||||
* Storing to a package element is not simple. The source must be
|
||||
* evaluated and converted to the type of the destination and then the
|
||||
* source is copied into the destination - we can't just point to the
|
||||
* source object.
|
||||
*/
|
||||
/*
|
||||
* The object at *(IndexDesc->Reference.Where) is the
|
||||
* element within the package that is to be modified.
|
||||
* The parent package object is at IndexDesc->Reference.Object
|
||||
*/
|
||||
ObjDesc = *(IndexDesc->Reference.Where);
|
||||
|
||||
Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
|
||||
/* Do the conversion/store */
|
||||
|
||||
Status = AcpiExStoreObjectToObject (SourceDesc, ObjDesc, &NewDesc,
|
||||
WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not store object to indexed package element\n"));
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
if (ObjDesc)
|
||||
/*
|
||||
* If a new object was created, we must install it as the new
|
||||
* package element
|
||||
*/
|
||||
if (NewDesc != ObjDesc)
|
||||
{
|
||||
/* Decrement reference count by the ref count of the parent package */
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
*(IndexDesc->Reference.Where) = NewDesc;
|
||||
|
||||
for (i = 0; i < ((ACPI_OPERAND_OBJECT *) IndexDesc->Reference.Object)->Common.ReferenceCount; i++)
|
||||
/* If same as the original source, add a reference */
|
||||
|
||||
if (NewDesc == SourceDesc)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
AcpiUtAddReference (NewDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*(IndexDesc->Reference.Where) = NewDesc;
|
||||
|
||||
/* Increment reference count by the ref count of the parent package -1 */
|
||||
|
||||
for (i = 1; i < ((ACPI_OPERAND_OBJECT *) IndexDesc->Reference.Object)->Common.ReferenceCount; i++)
|
||||
{
|
||||
AcpiUtAddReference (NewDesc);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
||||
/*
|
||||
* Store into a Buffer or String (not actually a real BufferField)
|
||||
* at a location defined by an Index.
|
||||
* Store into a Buffer (not actually a real BufferField) at a
|
||||
* location defined by an Index.
|
||||
*
|
||||
* The first 8-bit element of the source object is written to the
|
||||
* 8-bit Buffer location defined by the Index destination object,
|
||||
@ -429,13 +409,10 @@ AcpiExStoreObjectToIndex (
|
||||
*/
|
||||
|
||||
/*
|
||||
* Make sure the target is a Buffer or String. An error should
|
||||
* not happen here, since the ReferenceObject was constructed
|
||||
* by the INDEX_OP code.
|
||||
* Make sure the target is a Buffer
|
||||
*/
|
||||
ObjDesc = IndexDesc->Reference.Object;
|
||||
if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) &&
|
||||
(ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING))
|
||||
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER)
|
||||
{
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
@ -454,13 +431,15 @@ AcpiExStoreObjectToIndex (
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/* Note: Takes advantage of common string/buffer fields */
|
||||
|
||||
Value = SourceDesc->Buffer.Pointer[0];
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
Value = (UINT8) SourceDesc->String.Pointer[0];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* All other types are invalid */
|
||||
@ -495,7 +474,6 @@ AcpiExStoreObjectToIndex (
|
||||
* PARAMETERS: SourceDesc - Value to be stored
|
||||
* Node - Named object to receive the value
|
||||
* WalkState - Current walk state
|
||||
* ImplicitConversion - Perform implicit conversion (yes/no)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -518,8 +496,7 @@ ACPI_STATUS
|
||||
AcpiExStoreObjectToNode (
|
||||
ACPI_OPERAND_OBJECT *SourceDesc,
|
||||
ACPI_NAMESPACE_NODE *Node,
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
UINT8 ImplicitConversion)
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_OPERAND_OBJECT *TargetDesc;
|
||||
@ -550,15 +527,6 @@ AcpiExStoreObjectToNode (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* If no implicit conversion, drop into the default case below */
|
||||
|
||||
if (!ImplicitConversion)
|
||||
{
|
||||
/* Force execution of default (no implicit conversion) */
|
||||
|
||||
TargetType = ACPI_TYPE_ANY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the actual store operation
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Module Name: exstoren - AML Interpreter object store support,
|
||||
* Store to Node (namespace object)
|
||||
* $Revision: 1.60 $
|
||||
* $Revision: 1.57 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -189,13 +189,6 @@ AcpiExResolveObject (
|
||||
}
|
||||
}
|
||||
|
||||
/* For CopyObject, no further validation necessary */
|
||||
|
||||
if (WalkState->Opcode == AML_COPY_OP)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Must have a Integer, Buffer, or String
|
||||
*/
|
||||
@ -217,12 +210,11 @@ AcpiExResolveObject (
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_ALIAS:
|
||||
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
|
||||
|
||||
/*
|
||||
* Aliases are resolved by AcpiExPrepOperands
|
||||
*/
|
||||
ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into Alias - should never happen\n"));
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exstorob - AML Interpreter object store support, store to object
|
||||
* $Revision: 1.53 $
|
||||
* $Revision: 1.51 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -169,37 +169,36 @@ AcpiExStoreBufferToBuffer (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
|
||||
TargetDesc->Buffer.Length = Length;
|
||||
}
|
||||
|
||||
/* Copy source buffer to target buffer */
|
||||
|
||||
/*
|
||||
* Buffer is a static allocation,
|
||||
* only place what will fit in the buffer.
|
||||
*/
|
||||
if (Length <= TargetDesc->Buffer.Length)
|
||||
{
|
||||
/* Clear existing buffer and copy in the new one */
|
||||
|
||||
ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
|
||||
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
|
||||
|
||||
/* Set the new length of the target */
|
||||
|
||||
TargetDesc->Buffer.Length = Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Truncate the source, copy only what will fit */
|
||||
|
||||
/*
|
||||
* Truncate the source, copy only what will fit
|
||||
*/
|
||||
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Truncating source buffer from %X to %X\n",
|
||||
"Truncating src buffer from %X to %X\n",
|
||||
Length, TargetDesc->Buffer.Length));
|
||||
}
|
||||
|
||||
/* Copy flags */
|
||||
|
||||
TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags;
|
||||
TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exsystem - Interface to OS services
|
||||
* $Revision: 1.82 $
|
||||
* $Revision: 1.80 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -246,7 +246,7 @@ AcpiExSystemDoStall (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExSystemDoSuspend (
|
||||
ACPI_INTEGER HowLong)
|
||||
UINT32 HowLong)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
|
||||
@ -258,7 +258,8 @@ AcpiExSystemDoSuspend (
|
||||
|
||||
AcpiExExitInterpreter ();
|
||||
|
||||
AcpiOsSleep (HowLong);
|
||||
AcpiOsSleep ((UINT16) (HowLong / (UINT32) 1000),
|
||||
(UINT16) (HowLong % (UINT32) 1000));
|
||||
|
||||
/* And now we must get the interpreter again */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exutils - interpreter/scanner utilities
|
||||
* $Revision: 1.113 $
|
||||
* $Revision: 1.111 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -363,27 +363,27 @@ AcpiExDigitsNeeded (
|
||||
{
|
||||
UINT32 NumDigits;
|
||||
ACPI_INTEGER CurrentValue;
|
||||
ACPI_INTEGER Quotient;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
|
||||
|
||||
|
||||
/* ACPI_INTEGER is unsigned, so we don't worry about a '-' prefix */
|
||||
|
||||
if (Value == 0)
|
||||
/*
|
||||
* ACPI_INTEGER is unsigned, so we don't worry about a '-'
|
||||
*/
|
||||
if ((CurrentValue = Value) == 0)
|
||||
{
|
||||
return_VALUE (1);
|
||||
}
|
||||
|
||||
CurrentValue = Value;
|
||||
NumDigits = 0;
|
||||
|
||||
/* Count the digits in the requested base */
|
||||
|
||||
while (CurrentValue)
|
||||
{
|
||||
(void) AcpiUtShortDivide (CurrentValue, Base, &CurrentValue, NULL);
|
||||
(void) AcpiUtShortDivide (&CurrentValue, Base, &Quotient, NULL);
|
||||
NumDigits++;
|
||||
CurrentValue = Quotient;
|
||||
}
|
||||
|
||||
return_VALUE (NumDigits);
|
||||
@ -446,6 +446,7 @@ AcpiExUnsignedIntegerToString (
|
||||
UINT32 Count;
|
||||
UINT32 DigitsNeeded;
|
||||
UINT32 Remainder;
|
||||
ACPI_INTEGER Quotient;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
@ -456,8 +457,9 @@ AcpiExUnsignedIntegerToString (
|
||||
|
||||
for (Count = DigitsNeeded; Count > 0; Count--)
|
||||
{
|
||||
(void) AcpiUtShortDivide (Value, 10, &Value, &Remainder);
|
||||
(void) AcpiUtShortDivide (&Value, 10, &Quotient, &Remainder);
|
||||
OutString[Count-1] = (char) ('0' + Remainder);\
|
||||
Value = Quotient;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psargs - Parse AML opcode arguments
|
||||
* $Revision: 1.77 $
|
||||
* $Revision: 1.75 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -399,8 +399,8 @@ AcpiPsGetNextNamepath (
|
||||
|
||||
if (!MethodDesc)
|
||||
{
|
||||
ACPI_REPORT_ERROR ((
|
||||
"PsGetNextNamepath: Control Method %p has no attached object\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
||||
"Control Method - %p has no attached object\n",
|
||||
Node));
|
||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psopcode - Parser/Interpreter opcode information table
|
||||
* $Revision: 1.87 $
|
||||
* $Revision: 1.78 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -267,7 +267,6 @@
|
||||
#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
|
||||
#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
|
||||
#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
|
||||
#define ARGP_TIMER_OP ARG_NONE
|
||||
#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
|
||||
#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
|
||||
#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
|
||||
@ -325,7 +324,7 @@
|
||||
#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
|
||||
#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
|
||||
#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
|
||||
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
|
||||
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
|
||||
#define ARGI_DEBUG_OP ARG_NONE
|
||||
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
|
||||
#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
|
||||
@ -344,10 +343,10 @@
|
||||
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
|
||||
#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
|
||||
#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
|
||||
#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
|
||||
#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
|
||||
#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
|
||||
#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
|
||||
#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
|
||||
#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
|
||||
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
|
||||
@ -395,11 +394,10 @@
|
||||
#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
|
||||
#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
|
||||
#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
|
||||
#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF)
|
||||
#define ARGI_STRING_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
|
||||
#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
|
||||
#define ARGI_TIMER_OP ARG_NONE
|
||||
#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
|
||||
#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
|
||||
#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
|
||||
@ -594,16 +592,16 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
|
||||
/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
|
||||
/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
|
||||
/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
|
||||
/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
|
||||
/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
|
||||
/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
|
||||
/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
|
||||
/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
|
||||
/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
|
||||
/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
|
||||
/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
|
||||
/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
|
||||
/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
|
||||
/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
|
||||
/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
|
||||
/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
|
||||
/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
|
||||
/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
|
||||
/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
|
||||
/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
|
||||
@ -663,6 +661,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
|
||||
/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
|
||||
/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
|
||||
|
||||
|
||||
/* ACPI 2.0 opcodes */
|
||||
|
||||
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
|
||||
@ -680,11 +679,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
|
||||
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
|
||||
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
|
||||
/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
|
||||
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
|
||||
|
||||
/* ACPI 3.0 opcodes */
|
||||
|
||||
/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R)
|
||||
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
|
||||
|
||||
/*! [End] no source code translation !*/
|
||||
};
|
||||
@ -693,6 +688,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
|
||||
* This table is directly indexed by the opcodes, and returns an
|
||||
* index into the table above
|
||||
*/
|
||||
|
||||
static const UINT8 AcpiGbl_ShortOpIndex[256] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
@ -731,10 +727,7 @@ static const UINT8 AcpiGbl_ShortOpIndex[256] =
|
||||
/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
|
||||
};
|
||||
|
||||
/*
|
||||
* This table is indexed by the second opcode of the extended opcode
|
||||
* pair. It returns an index into the opcode table (AcpiGbl_AmlOpInfo)
|
||||
*/
|
||||
|
||||
static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
@ -745,7 +738,7 @@ static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] =
|
||||
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
|
||||
/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
|
||||
/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||
/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
|
||||
/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||
/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||
/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||
@ -806,7 +799,7 @@ AcpiPsGetOpcodeInfo (
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", Opcode));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", Opcode));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psparse - Parser top level AML parse routines
|
||||
* $Revision: 1.147 $
|
||||
* $Revision: 1.143 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -240,143 +240,141 @@ AcpiPsCompleteThisOp (
|
||||
|
||||
/* Delete this op and the subtree below it if asked to */
|
||||
|
||||
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
|
||||
(WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))
|
||||
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
|
||||
(WalkState->OpInfo->Class != AML_CLASS_ARGUMENT))
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
/* Make sure that we only delete this subtree */
|
||||
|
||||
/* Make sure that we only delete this subtree */
|
||||
|
||||
if (Op->Common.Parent)
|
||||
{
|
||||
/*
|
||||
* Check if we need to replace the operator and its subtree
|
||||
* with a return value op (placeholder op)
|
||||
*/
|
||||
ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
|
||||
|
||||
switch (ParentInfo->Class)
|
||||
if (Op->Common.Parent)
|
||||
{
|
||||
case AML_CLASS_CONTROL:
|
||||
break;
|
||||
|
||||
case AML_CLASS_CREATE:
|
||||
|
||||
/*
|
||||
* These opcodes contain TermArg operands. The current
|
||||
* op must be replaced by a placeholder return op
|
||||
* Check if we need to replace the operator and its subtree
|
||||
* with a return value op (placeholder op)
|
||||
*/
|
||||
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
break;
|
||||
ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
|
||||
|
||||
case AML_CLASS_NAMED_OBJECT:
|
||||
|
||||
/*
|
||||
* These opcodes contain TermArg operands. The current
|
||||
* op must be replaced by a placeholder return op
|
||||
*/
|
||||
if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
|
||||
switch (ParentInfo->Class)
|
||||
{
|
||||
case AML_CLASS_CONTROL:
|
||||
break;
|
||||
|
||||
case AML_CLASS_CREATE:
|
||||
|
||||
/*
|
||||
* These opcodes contain TermArg operands. The current
|
||||
* op must be replaced by a placeholder return op
|
||||
*/
|
||||
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
goto Cleanup;
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
|
||||
(WalkState->DescendingCallback != AcpiDsExecBeginOp))
|
||||
case AML_CLASS_NAMED_OBJECT:
|
||||
|
||||
{
|
||||
if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
|
||||
/*
|
||||
* These opcodes contain TermArg operands. The current
|
||||
* op must be replaced by a placeholder return op
|
||||
*/
|
||||
if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
|
||||
{
|
||||
ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
|
||||
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
goto Cleanup;
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
|
||||
ReplacementOp->Named.Data = Op->Named.Data;
|
||||
ReplacementOp->Named.Length = Op->Named.Length;
|
||||
if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
|
||||
(WalkState->DescendingCallback != AcpiDsExecBeginOp))
|
||||
|
||||
{
|
||||
if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
|
||||
{
|
||||
ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
ReplacementOp->Named.Data = Op->Named.Data;
|
||||
ReplacementOp->Named.Length = Op->Named.Length;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
{
|
||||
return_VOID;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
|
||||
if (!ReplacementOp)
|
||||
/* We must unlink this op from the parent tree */
|
||||
|
||||
Prev = Op->Common.Parent->Common.Value.Arg;
|
||||
if (Prev == Op)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
/* This op is the first in the list */
|
||||
|
||||
/* We must unlink this op from the parent tree */
|
||||
|
||||
Prev = Op->Common.Parent->Common.Value.Arg;
|
||||
if (Prev == Op)
|
||||
{
|
||||
/* This op is the first in the list */
|
||||
|
||||
if (ReplacementOp)
|
||||
{
|
||||
ReplacementOp->Common.Parent = Op->Common.Parent;
|
||||
ReplacementOp->Common.Value.Arg = NULL;
|
||||
ReplacementOp->Common.Node = Op->Common.Node;
|
||||
Op->Common.Parent->Common.Value.Arg = ReplacementOp;
|
||||
ReplacementOp->Common.Next = Op->Common.Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the parent list */
|
||||
|
||||
else while (Prev)
|
||||
{
|
||||
/* Traverse all siblings in the parent's argument list */
|
||||
|
||||
Next = Prev->Common.Next;
|
||||
if (Next == Op)
|
||||
{
|
||||
if (ReplacementOp)
|
||||
{
|
||||
ReplacementOp->Common.Parent = Op->Common.Parent;
|
||||
ReplacementOp->Common.Value.Arg = NULL;
|
||||
ReplacementOp->Common.Node = Op->Common.Node;
|
||||
Prev->Common.Next = ReplacementOp;
|
||||
ReplacementOp->Common.Next = Op->Common.Next;
|
||||
Next = NULL;
|
||||
ReplacementOp->Common.Parent = Op->Common.Parent;
|
||||
ReplacementOp->Common.Value.Arg = NULL;
|
||||
ReplacementOp->Common.Node = Op->Common.Node;
|
||||
Op->Common.Parent->Common.Value.Arg = ReplacementOp;
|
||||
ReplacementOp->Common.Next = Op->Common.Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
Prev->Common.Next = Op->Common.Next;
|
||||
Next = NULL;
|
||||
Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
|
||||
}
|
||||
}
|
||||
|
||||
Prev = Next;
|
||||
/* Search the parent list */
|
||||
|
||||
else while (Prev)
|
||||
{
|
||||
/* Traverse all siblings in the parent's argument list */
|
||||
|
||||
Next = Prev->Common.Next;
|
||||
if (Next == Op)
|
||||
{
|
||||
if (ReplacementOp)
|
||||
{
|
||||
ReplacementOp->Common.Parent = Op->Common.Parent;
|
||||
ReplacementOp->Common.Value.Arg = NULL;
|
||||
ReplacementOp->Common.Node = Op->Common.Node;
|
||||
Prev->Common.Next = ReplacementOp;
|
||||
ReplacementOp->Common.Next = Op->Common.Next;
|
||||
Next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
Prev->Common.Next = Op->Common.Next;
|
||||
Next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Prev = Next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we can actually delete the subtree rooted at op */
|
||||
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Now we can actually delete the subtree rooted at op */
|
||||
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -524,7 +522,7 @@ AcpiPsParseLoop (
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_PARSE_OBJECT *Op = NULL; /* current op */
|
||||
ACPI_PARSE_OBJECT *Arg = NULL;
|
||||
ACPI_PARSE_OBJECT *PreOp = NULL;
|
||||
ACPI_PARSE_OBJECT PreOp;
|
||||
ACPI_PARSE_STATE *ParserState;
|
||||
UINT8 *AmlOpStart = NULL;
|
||||
|
||||
@ -656,20 +654,8 @@ AcpiPsParseLoop (
|
||||
|
||||
if (WalkState->OpInfo->Flags & AML_NAMED)
|
||||
{
|
||||
/* Allocate a new PreOp if necessary */
|
||||
|
||||
if (!PreOp)
|
||||
{
|
||||
PreOp = AcpiPsAllocOp (WalkState->Opcode);
|
||||
if (!PreOp)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto CloseThisOp;
|
||||
}
|
||||
}
|
||||
|
||||
PreOp->Common.Value.Arg = NULL;
|
||||
PreOp->Common.AmlOpcode = WalkState->Opcode;
|
||||
PreOp.Common.Value.Arg = NULL;
|
||||
PreOp.Common.AmlOpcode = WalkState->Opcode;
|
||||
|
||||
/*
|
||||
* Get and append arguments until we find the node that contains
|
||||
@ -685,7 +671,7 @@ AcpiPsParseLoop (
|
||||
goto CloseThisOp;
|
||||
}
|
||||
|
||||
AcpiPsAppendArg (PreOp, Arg);
|
||||
AcpiPsAppendArg (&PreOp, Arg);
|
||||
INCREMENT_ARG_LIST (WalkState->ArgTypes);
|
||||
}
|
||||
|
||||
@ -693,8 +679,7 @@ AcpiPsParseLoop (
|
||||
|
||||
if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
|
||||
{
|
||||
Status = AE_AML_NO_OPERAND;
|
||||
goto CloseThisOp;
|
||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
/* We know that this arg is a name, move to next arg */
|
||||
@ -732,7 +717,7 @@ AcpiPsParseLoop (
|
||||
goto CloseThisOp;
|
||||
}
|
||||
|
||||
AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
|
||||
AcpiPsAppendArg (Op, PreOp.Common.Value.Arg);
|
||||
AcpiGbl_Depth++;
|
||||
|
||||
if (Op->Common.AmlOpcode == AML_REGION_OP)
|
||||
@ -761,8 +746,7 @@ AcpiPsParseLoop (
|
||||
Op = AcpiPsAllocOp (WalkState->Opcode);
|
||||
if (!Op)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto CloseThisOp;
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
if (WalkState->OpInfo->Flags & AML_CREATE)
|
||||
@ -941,7 +925,7 @@ AcpiPsParseLoop (
|
||||
WalkState->ArgTypes, WalkState->ArgCount);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto CloseThisOp;
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
Op = NULL;
|
||||
continue;
|
||||
@ -1009,11 +993,6 @@ CloseThisOp:
|
||||
|
||||
AcpiPsCompleteThisOp (WalkState, Op);
|
||||
Op = NULL;
|
||||
if (PreOp)
|
||||
{
|
||||
AcpiPsFreeOp (PreOp);
|
||||
PreOp = NULL;
|
||||
}
|
||||
|
||||
switch (Status)
|
||||
{
|
||||
@ -1298,34 +1277,10 @@ AcpiPsParseAml (
|
||||
{
|
||||
Status = AE_OK;
|
||||
}
|
||||
else if ((Status != AE_OK) && (WalkState->MethodDesc))
|
||||
else if (Status != AE_OK)
|
||||
{
|
||||
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
|
||||
WalkState->MethodNode, NULL, Status);
|
||||
|
||||
/* Check for possible multi-thread reentrancy problem */
|
||||
|
||||
if ((Status == AE_ALREADY_EXISTS) &&
|
||||
(!WalkState->MethodDesc->Method.Semaphore))
|
||||
{
|
||||
/*
|
||||
* This method is marked NotSerialized, but it tried to create a named
|
||||
* object, causing the second thread entrance to fail. We will workaround
|
||||
* this by marking the method permanently as Serialized.
|
||||
*/
|
||||
WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
|
||||
WalkState->MethodDesc->Method.Concurrency = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (WalkState->MethodDesc)
|
||||
{
|
||||
/* Decrement the thread count on the method parse tree */
|
||||
|
||||
if (WalkState->MethodDesc->Method.ThreadCount)
|
||||
{
|
||||
WalkState->MethodDesc->Method.ThreadCount--;
|
||||
}
|
||||
}
|
||||
|
||||
/* We are done with this walk, move on to the parent if any */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psscope - Parser scope stack management routines
|
||||
* $Revision: 1.39 $
|
||||
* $Revision: 1.37 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -242,6 +242,7 @@ AcpiPsPushScope (
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
|
||||
Scope->Common.DataType = ACPI_DESC_TYPE_STATE_PSCOPE;
|
||||
Scope->ParseScope.Op = Op;
|
||||
Scope->ParseScope.ArgList = RemainingArgs;
|
||||
@ -252,12 +253,14 @@ AcpiPsPushScope (
|
||||
|
||||
AcpiUtPushGenericState (&ParserState->Scope, Scope);
|
||||
|
||||
|
||||
if (ArgCount == ACPI_VAR_ARGS)
|
||||
{
|
||||
/* multiple arguments */
|
||||
|
||||
Scope->ParseScope.ArgEnd = ParserState->PkgEnd;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* single argument */
|
||||
@ -316,6 +319,7 @@ AcpiPsPopScope (
|
||||
|
||||
AcpiUtDeleteGenericState (Scope);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* empty parse stack, prepare to fetch next opcode */
|
||||
@ -325,6 +329,7 @@ AcpiPsPopScope (
|
||||
*ArgCount = 0;
|
||||
}
|
||||
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *Op, *ArgCount));
|
||||
return_VOID;
|
||||
}
|
||||
@ -349,15 +354,15 @@ AcpiPsCleanupScope (
|
||||
{
|
||||
ACPI_GENERIC_STATE *Scope;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
|
||||
|
||||
|
||||
if (!ParserState)
|
||||
{
|
||||
return_VOID;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Delete anything on the scope stack */
|
||||
|
||||
while (ParserState->Scope)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: pstree - Parser op tree manipulation/traversal/search
|
||||
* $Revision: 1.43 $
|
||||
* $Revision: 1.42 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
|
||||
* $Revision: 1.59 $
|
||||
* $Revision: 1.56 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -203,9 +203,10 @@ ACPI_PARSE_OBJECT*
|
||||
AcpiPsAllocOp (
|
||||
UINT16 Opcode)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
ACPI_PARSE_OBJECT *Op = NULL;
|
||||
UINT32 Size;
|
||||
UINT8 Flags;
|
||||
const ACPI_OPCODE_INFO *OpInfo;
|
||||
UINT8 Flags = ACPI_PARSEOP_GENERIC;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
@ -213,33 +214,38 @@ AcpiPsAllocOp (
|
||||
|
||||
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
|
||||
|
||||
/* Determine type of ParseOp required */
|
||||
/* Allocate the minimum required size object */
|
||||
|
||||
if (OpInfo->Flags & AML_DEFER)
|
||||
{
|
||||
Size = sizeof (ACPI_PARSE_OBJ_NAMED);
|
||||
Flags = ACPI_PARSEOP_DEFERRED;
|
||||
}
|
||||
else if (OpInfo->Flags & AML_NAMED)
|
||||
{
|
||||
Size = sizeof (ACPI_PARSE_OBJ_NAMED);
|
||||
Flags = ACPI_PARSEOP_NAMED;
|
||||
}
|
||||
else if (Opcode == AML_INT_BYTELIST_OP)
|
||||
{
|
||||
Size = sizeof (ACPI_PARSE_OBJ_NAMED);
|
||||
Flags = ACPI_PARSEOP_BYTELIST;
|
||||
}
|
||||
|
||||
/* Allocate the minimum required size object */
|
||||
|
||||
if (Flags == ACPI_PARSEOP_GENERIC)
|
||||
else
|
||||
{
|
||||
/* The generic op (default) is by far the most common (16 to 1) */
|
||||
Size = sizeof (ACPI_PARSE_OBJ_COMMON);
|
||||
Flags = ACPI_PARSEOP_GENERIC;
|
||||
}
|
||||
|
||||
if (Size == sizeof (ACPI_PARSE_OBJ_COMMON))
|
||||
{
|
||||
/*
|
||||
* The generic op is by far the most common (16 to 1)
|
||||
*/
|
||||
Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Extended parseop */
|
||||
|
||||
Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE_EXT);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
|
||||
* $Revision: 1.71 $
|
||||
* $Revision: 1.70 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psxface - Parser external interfaces
|
||||
* $Revision: 1.76 $
|
||||
* $Revision: 1.71 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -131,7 +131,7 @@
|
||||
*
|
||||
* FUNCTION: AcpiPsxExecute
|
||||
*
|
||||
* PARAMETERS: Info->Node - A method object containing both the AML
|
||||
* PARAMETERS: MethodNode - A method object containing both the AML
|
||||
* address and length.
|
||||
* **Params - List of parameters to pass to method,
|
||||
* terminated by NULL. Params itself may be
|
||||
@ -147,7 +147,9 @@
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiPsxExecute (
|
||||
ACPI_PARAMETER_INFO *Info)
|
||||
ACPI_NAMESPACE_NODE *MethodNode,
|
||||
ACPI_OPERAND_OBJECT **Params,
|
||||
ACPI_OPERAND_OBJECT **ReturnObjDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
@ -161,12 +163,12 @@ AcpiPsxExecute (
|
||||
|
||||
/* Validate the Node and get the attached object */
|
||||
|
||||
if (!Info || !Info->Node)
|
||||
if (!MethodNode)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NULL_ENTRY);
|
||||
}
|
||||
|
||||
ObjDesc = AcpiNsGetAttachedObject (Info->Node);
|
||||
ObjDesc = AcpiNsGetAttachedObject (MethodNode);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
||||
@ -174,22 +176,21 @@ AcpiPsxExecute (
|
||||
|
||||
/* Init for new method, wait on concurrency semaphore */
|
||||
|
||||
Status = AcpiDsBeginMethodExecution (Info->Node, ObjDesc, NULL);
|
||||
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
|
||||
(Info->Parameters))
|
||||
if (Params)
|
||||
{
|
||||
/*
|
||||
* The caller "owns" the parameters, so give each one an extra
|
||||
* reference
|
||||
*/
|
||||
for (i = 0; Info->Parameters[i]; i++)
|
||||
for (i = 0; Params[i]; i++)
|
||||
{
|
||||
AcpiUtAddReference (Info->Parameters[i]);
|
||||
AcpiUtAddReference (Params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,7 +200,7 @@ AcpiPsxExecute (
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
||||
"**** Begin Method Parse **** Entry=%p obj=%p\n",
|
||||
Info->Node, ObjDesc));
|
||||
MethodNode, ObjDesc));
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
@ -227,9 +228,8 @@ AcpiPsxExecute (
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
|
||||
ObjDesc->Method.AmlStart,
|
||||
ObjDesc->Method.AmlLength, NULL, 1);
|
||||
Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,
|
||||
ObjDesc->Method.AmlLength, NULL, NULL, 1);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup3;
|
||||
@ -242,6 +242,7 @@ AcpiPsxExecute (
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup1; /* Walk state is already deleted */
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -249,7 +250,7 @@ AcpiPsxExecute (
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
||||
"**** Begin Method Execution **** Entry=%p obj=%p\n",
|
||||
Info->Node, ObjDesc));
|
||||
MethodNode, ObjDesc));
|
||||
|
||||
/* Create and init a Root Node */
|
||||
|
||||
@ -262,8 +263,8 @@ AcpiPsxExecute (
|
||||
|
||||
/* Init new op with the method name and pointer back to the NS node */
|
||||
|
||||
AcpiPsSetName (Op, Info->Node->Name.Integer);
|
||||
Op->Common.Node = Info->Node;
|
||||
AcpiPsSetName (Op, MethodNode->Name.Integer);
|
||||
Op->Common.Node = MethodNode;
|
||||
|
||||
/* Create and initialize a new walk state */
|
||||
|
||||
@ -274,9 +275,8 @@ AcpiPsxExecute (
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
|
||||
ObjDesc->Method.AmlStart,
|
||||
ObjDesc->Method.AmlLength, Info, 3);
|
||||
Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,
|
||||
ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup3;
|
||||
@ -296,16 +296,15 @@ Cleanup2:
|
||||
AcpiPsDeleteParseTree (Op);
|
||||
|
||||
Cleanup1:
|
||||
if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
|
||||
(Info->Parameters))
|
||||
if (Params)
|
||||
{
|
||||
/* Take away the extra reference that we gave the parameters above */
|
||||
|
||||
for (i = 0; Info->Parameters[i]; i++)
|
||||
for (i = 0; Params[i]; i++)
|
||||
{
|
||||
/* Ignore errors, just do them all */
|
||||
|
||||
(void) AcpiUtUpdateObjectReference (Info->Parameters[i], REF_DECREMENT);
|
||||
(void) AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,11 +317,11 @@ Cleanup1:
|
||||
* If the method has returned an object, signal this to the caller with
|
||||
* a control exception code
|
||||
*/
|
||||
if (Info->ReturnObject)
|
||||
if (*ReturnObjDesc)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
|
||||
Info->ReturnObject));
|
||||
ACPI_DUMP_STACK_ENTRY (Info->ReturnObject);
|
||||
*ReturnObjDesc));
|
||||
ACPI_DUMP_STACK_ENTRY (*ReturnObjDesc);
|
||||
|
||||
Status = AE_CTRL_RETURN_VALUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user