Second pass to include lint changes/comments/cleanup.

date	2002.04.08.22.01.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:00:07 +00:00
parent 7706b5d37b
commit 1d7f005c8f
34 changed files with 1190 additions and 991 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 1.63 $
* $Revision: 1.64 $
*
*****************************************************************************/
@ -288,6 +288,7 @@ AcpiDsGetFieldNames (
ACPI_PARSE_OBJECT *Arg)
{
ACPI_STATUS Status;
ACPI_INTEGER Position;
ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
@ -311,14 +312,16 @@ AcpiDsGetFieldNames (
{
case AML_INT_RESERVEDFIELD_OP:
if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Common.Value.Size) >
ACPI_UINT32_MAX)
Position = (ACPI_INTEGER) Info->FieldBitPosition
+ (ACPI_INTEGER) Arg->Common.Value.Size;
if (Position > ACPI_UINT32_MAX)
{
ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS (AE_SUPPORT);
}
Info->FieldBitPosition += Arg->Common.Value.Size;
Info->FieldBitPosition = (UINT32) Position;
break;
@ -371,8 +374,10 @@ AcpiDsGetFieldNames (
/* Keep track of bit position for the next field */
if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Common.Value.Size) >
ACPI_UINT32_MAX)
Position = (ACPI_INTEGER) Info->FieldBitPosition
+ (ACPI_INTEGER) Arg->Common.Value.Size;
if (Position > ACPI_UINT32_MAX)
{
ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
&Info->FieldNode->Name));
@ -501,6 +506,9 @@ AcpiDsInitFieldObjects (
Arg = AcpiPsGetArg (Op, 3);
Type = INTERNAL_TYPE_INDEX_FIELD;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.82 $
* $Revision: 1.83 $
*
*****************************************************************************/
@ -122,8 +122,6 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
@ -171,7 +169,7 @@ AcpiDsParseMethod (
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n",
(char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle));
((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle));
/* Extract the method object from the method Node */
@ -253,7 +251,7 @@ AcpiDsParseMethod (
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
(char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle, Op));
((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle, Op));
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
@ -561,6 +559,11 @@ AcpiDsTerminateControlMethod (
ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
if (!WalkState)
{
return (AE_BAD_PARAMETER);
}
/* The current method object was saved in the walk state */
ObjDesc = WalkState->MethodDesc;

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.57 $
* $Revision: 1.60 $
*
******************************************************************************/
@ -117,15 +117,13 @@
#define __DSMTHDAT_C__
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsmthdat")
ACPI_MODULE_NAME ("dsmthdat")
/*******************************************************************************
@ -156,32 +154,32 @@ AcpiDsMethodDataInit (
UINT32 i;
FUNCTION_TRACE ("DsMethodDataInit");
ACPI_FUNCTION_TRACE ("DsMethodDataInit");
/* Init the method arguments */
for (i = 0; i < MTH_NUM_ARGS; i++)
{
MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name |= (i << 24);
WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
WalkState->Arguments[i].Name.Integer |= (i << 24);
WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
for (i = 0; i < MTH_NUM_LOCALS; i++)
{
MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
NAMEOF_LOCAL_NTE);
WalkState->LocalVariables[i].Name |= (i << 24);
WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
@ -208,7 +206,7 @@ AcpiDsMethodDataDeleteAll (
UINT32 Index;
FUNCTION_TRACE ("DsMethodDataDeleteAll");
ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
/* Detach the locals */
@ -223,7 +221,7 @@ AcpiDsMethodDataDeleteAll (
/* Detach object (if present) and remove a reference */
AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
}
}
}
/* Detach the arguments */
@ -271,7 +269,7 @@ AcpiDsMethodDataInitArgs (
UINT32 Index = 0;
FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
if (!Params)
@ -323,7 +321,7 @@ AcpiDsMethodDataGetNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
{
FUNCTION_TRACE ("DsMethodDataGetNode");
ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
/*
@ -394,7 +392,7 @@ AcpiDsMethodDataSetValue (
ACPI_NAMESPACE_NODE *Node;
FUNCTION_TRACE ("DsMethodDataSetValue");
ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
/* Get the namespace node for the arg/local */
@ -440,7 +438,7 @@ AcpiDsMethodDataGetType (
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataGetType");
ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
/* Get the namespace node for the arg/local */
@ -497,7 +495,7 @@ AcpiDsMethodDataGetValue (
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataGetValue");
ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
/* Validate the object descriptor */
@ -546,6 +544,9 @@ AcpiDsMethodDataGetValue (
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@ -586,7 +587,7 @@ AcpiDsMethodDataDeleteValue (
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataDeleteValue");
ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
/* Get the namespace node for the arg/local */
@ -652,7 +653,7 @@ AcpiDsStoreObjectToLocal (
ACPI_OPERAND_OBJECT *CurrentObjDesc;
FUNCTION_TRACE ("DsStoreObjectToLocal");
ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n",
Opcode, Index, ObjDesc));

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.92 $
* $Revision: 1.93 $
*
*****************************************************************************/
@ -120,7 +120,6 @@
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
@ -216,7 +215,7 @@ AcpiDsInitOneObject (
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name,
ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii,
AcpiFormatException (Status)));
/* This parse failed, but we will continue parsing more methods */

View File

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.75 $
* $Revision: 1.76 $
*
*****************************************************************************/
@ -124,7 +124,6 @@
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode")
@ -275,7 +274,7 @@ AcpiDsGetBufferFieldArguments (
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
(char *) &Node->Name));
Node->Name.Ascii));
/* Execute the AML code for the TermArg arguments */
@ -426,7 +425,7 @@ AcpiDsGetRegionArguments (
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
(char *) &Node->Name, ExtraDesc->Extra.AmlStart));
Node->Name.Ascii, ExtraDesc->Extra.AmlStart));
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
@ -540,16 +539,7 @@ AcpiDsEvalBufferFieldOperands (
/* Get the operands */
if (AML_CREATE_FIELD_OP == Op->Common.AmlOpcode)
{
ResDesc = WalkState->Operands[3];
CntDesc = WalkState->Operands[2];
}
else
{
ResDesc = WalkState->Operands[2];
}
ResDesc = WalkState->Operands[2];
OffDesc = WalkState->Operands[1];
SrcDesc = WalkState->Operands[0];
Offset = (UINT32) OffDesc->Integer.Value;
@ -574,6 +564,11 @@ AcpiDsEvalBufferFieldOperands (
{
case AML_CREATE_FIELD_OP:
/* Slightly different operands for this opcode */
CntDesc = WalkState->Operands[2];
ResDesc = WalkState->Operands[3];
/* Offset is in bits, count is in bits */
BitOffset = Offset;

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.90 $
* $Revision: 1.91 $
*
******************************************************************************/
@ -531,7 +531,6 @@ AcpiDsCreateOperand (
return_ACPI_STATUS (Status);
}
}
else
{
/* Create an ACPI_INTERNAL_OBJECT for the argument */
@ -551,7 +550,7 @@ AcpiDsCreateOperand (
AcpiUtDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (Status);
}
}
}
/* Put the operand object on the object stack */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.63 $
* $Revision: 1.64 $
*
*****************************************************************************/
@ -215,9 +215,9 @@ AcpiDsLoad1BeginOp (
/* We are only interested in opcodes that have an associated name */
if (WalkState->Op)
if (Op)
{
if (!(WalkState->OpInfo->Flags & AML_NAMED))
if (!(WalkState->OpInfo->Flags & AML_NAMED))
{
*OutOp = Op;
return (AE_OK);
@ -302,6 +302,7 @@ AcpiDsLoad1EndOp (
{
ACPI_PARSE_OBJECT *Op;
ACPI_OBJECT_TYPE ObjectType;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_NAME ("DsLoad1EndOp");
@ -327,15 +328,15 @@ AcpiDsLoad1EndOp (
WalkState->Opcode == AML_BANK_FIELD_OP ||
WalkState->Opcode == AML_INDEX_FIELD_OP)
{
AcpiDsInitFieldObjects (Op, WalkState);
Status = AcpiDsInitFieldObjects (Op, WalkState);
}
return (AE_OK);
return (Status);
}
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
/*Status = */AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
(ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState);
}
@ -388,7 +389,6 @@ AcpiDsLoad2BeginOp (
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
NATIVE_CHAR *BufferPtr;
void *Original = NULL;
ACPI_FUNCTION_NAME ("DsLoad2BeginOp");
@ -462,9 +462,12 @@ AcpiDsLoad2BeginOp (
}
else
{
/* All other opcodes */
if (Op && Op->Common.Node)
{
Original = Op->Common.Node;
/* This op/node was previously entered into the namespace */
Node = Op->Common.Node;
if (AcpiNsOpensScope (ObjectType))
@ -502,7 +505,10 @@ AcpiDsLoad2BeginOp (
/* Initialize the new op */
Op->Named.Name = Node->Name.Integer;
if (Node)
{
Op->Named.Name = Node->Name.Integer;
}
*OutOp = Op;
}
@ -511,17 +517,6 @@ AcpiDsLoad2BeginOp (
* can get it again quickly when this scope is closed
*/
Op->Common.Node = Node;
if (Original)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node));
if (Original != Node)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Lookup match error: old %p new %p\n", Original, Node));
}
}
}
return (Status);
@ -674,6 +669,10 @@ AcpiDsLoad2EndOp (
Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
break;
default:
/* All NAMED_FIELD opcodes must be handled above */
break;
}
break;
@ -791,6 +790,11 @@ AcpiDsLoad2EndOp (
Status = AcpiDsCreateNode (WalkState, Node, Op);
break;
default:
/* All NAMED_COMPLEX opcodes must be handled above */
break;
}
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.60 $
* $Revision: 1.61 $
*
*****************************************************************************/
@ -118,11 +118,9 @@
#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
ACPI_MODULE_NAME ("dswstate")
@ -223,7 +221,7 @@ AcpiDsResultRemove (
return (AE_NOT_EXIST);
}
if (Index >= OBJ_NUM_OPERANDS)
if (Index >= OBJ_MAX_OPERAND)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n",

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 1.57 $
* $Revision: 1.61 $
*
*****************************************************************************/
@ -118,17 +118,15 @@
#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")
/*******************************************************************************
@ -157,9 +155,9 @@ AcpiExAddTable (
ACPI_OPERAND_OBJECT *ObjDesc;
FUNCTION_TRACE ("ExAddTable");
ACPI_FUNCTION_TRACE ("ExAddTable");
/* Create an object to be the table handle */
ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
@ -188,7 +186,7 @@ AcpiExAddTable (
{
/* Uninstall table on error */
AcpiTbUninstallTable (TableInfo.InstalledDesc);
(void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
goto Cleanup;
}
@ -233,7 +231,7 @@ AcpiExLoadTableOp (
ACPI_OPERAND_OBJECT *DdbHandle;
FUNCTION_TRACE ("ExLoadTableOp");
ACPI_FUNCTION_TRACE ("ExLoadTableOp");
/*
@ -288,7 +286,7 @@ AcpiExLoadTableOp (
* location within the namespace where the table will be loaded.
*/
Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
NS_SEARCH_PARENT, &ParentNode);
ACPI_NS_SEARCH_PARENT, &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -313,7 +311,7 @@ AcpiExLoadTableOp (
* Find the node referenced by the ParameterPathString
*/
Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
NS_SEARCH_PARENT, &ParameterNode);
ACPI_NS_SEARCH_PARENT, &ParameterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -334,11 +332,11 @@ AcpiExLoadTableOp (
{
/* Store the parameter data into the optional parameter object */
Status = AcpiExStore (Operand[5], (ACPI_OPERAND_OBJECT *) ParameterNode,
Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
WalkState);
if (ACPI_FAILURE (Status))
{
AcpiExUnloadTable (DdbHandle);
(void) AcpiExUnloadTable (DdbHandle);
}
}
@ -376,7 +374,7 @@ AcpiExLoadOp (
UINT32 i;
FUNCTION_TRACE ("ExLoadOp");
ACPI_FUNCTION_TRACE ("ExLoadOp");
/* Object can be either an OpRegion or a Field */
@ -395,7 +393,7 @@ AcpiExLoadOp (
{
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
(ACPI_PHYSICAL_ADDRESS) i, 8,
(ACPI_INTEGER *) ((UINT8 *) &TableHeader + i));
(ACPI_INTEGER *) ((UINT8 *) &TableHeader) + i);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -412,7 +410,7 @@ AcpiExLoadOp (
/* Copy the header to the buffer */
MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
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 */
@ -443,7 +441,7 @@ AcpiExLoadOp (
* Read the entire field and thus the entire table. Buffer is
* allocated during the read.
*/
Status = AcpiExReadDataFromField (ObjDesc, &BufferDesc);
Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@ -459,16 +457,16 @@ AcpiExLoadOp (
/* The table must be either an SSDT or a PSDT */
if ((!STRNCMP (TablePtr->Signature,
if ((!ACPI_STRNCMP (TablePtr->Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
(!STRNCMP (TablePtr->Signature,
(!ACPI_STRNCMP (TablePtr->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",
(char *) &TablePtr->Signature));
TablePtr->Signature));
Status = AE_BAD_SIGNATURE;
goto Cleanup;
}
@ -527,7 +525,7 @@ AcpiExUnloadTable (
ACPI_TABLE_DESC *TableInfo;
FUNCTION_TRACE ("ExUnloadTable");
ACPI_FUNCTION_TRACE ("ExUnloadTable");
/*

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 1.28 $
* $Revision: 1.33 $
*
*****************************************************************************/
@ -118,16 +118,12 @@
#define __EXCONVRT_C__
#include "acpi.h"
#include "acparser.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exconvrt")
ACPI_MODULE_NAME ("exconvrt")
/*******************************************************************************
@ -153,12 +149,12 @@ AcpiExConvertToInteger (
UINT32 i;
ACPI_OPERAND_OBJECT *RetDesc;
UINT32 Count;
char *Pointer;
UINT8 *Pointer;
ACPI_INTEGER Result;
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
switch (ObjDesc->Common.Type)
@ -168,12 +164,12 @@ AcpiExConvertToInteger (
return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_STRING:
Pointer = ObjDesc->String.Pointer;
Pointer = (UINT8 *) ObjDesc->String.Pointer;
Count = ObjDesc->String.Length;
break;
case ACPI_TYPE_BUFFER:
Pointer = (char *) ObjDesc->Buffer.Pointer;
Pointer = ObjDesc->Buffer.Pointer;
Count = ObjDesc->Buffer.Length;
break;
@ -226,13 +222,13 @@ AcpiExConvertToInteger (
{
case ACPI_TYPE_STRING:
/* TBD: Need to use 64-bit STRTOUL */
/* TBD: Need to use 64-bit ACPI_STRTOUL */
/*
* Convert string to an integer
* String must be hexadecimal as per the ACPI specification
*/
Result = STRTOUL (Pointer, NULL, 16);
Result = ACPI_STRTOUL ((char *) Pointer, NULL, 16);
break;
@ -252,6 +248,11 @@ AcpiExConvertToInteger (
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
}
break;
default:
/* No other types can get here */
break;
}
/* Save the Result, delete original descriptor, store new descriptor */
@ -297,7 +298,7 @@ AcpiExConvertToBuffer (
UINT8 *NewBuf;
FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
switch (ObjDesc->Common.Type)
@ -319,8 +320,7 @@ AcpiExConvertToBuffer (
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
* Use only 32 bits of the Integer for conversion.
*/
IntegerSize = sizeof (UINT32);
}
@ -331,7 +331,7 @@ AcpiExConvertToBuffer (
NewBuf = ACPI_MEM_CALLOCATE (IntegerSize);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExConvertToBuffer: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
return_ACPI_STATUS (AE_NO_MEMORY);
@ -365,6 +365,9 @@ AcpiExConvertToBuffer (
return_ACPI_STATUS (AE_TYPE);
}
/* Mark buffer initialized */
(*ResultDesc)->Common.Flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (AE_OK);
}
@ -390,14 +393,14 @@ AcpiExConvertToAscii (
UINT32 i;
UINT32 j;
UINT32 k = 0;
UINT8 HexDigit;
char HexDigit;
ACPI_INTEGER Digit;
UINT32 Remainder;
UINT32 Length = sizeof (ACPI_INTEGER);
BOOLEAN LeadingZero = TRUE;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (Base)
@ -412,7 +415,7 @@ AcpiExConvertToAscii (
Digit = Integer;
for (j = 1; j < i; j++)
{
AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
(void) AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
}
/* Create the decimal digit */
@ -424,7 +427,7 @@ AcpiExConvertToAscii (
if (!LeadingZero)
{
String[k] = (UINT8) (ASCII_ZERO + Remainder);
String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
k++;
}
}
@ -438,14 +441,14 @@ AcpiExConvertToAscii (
{
HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
if (HexDigit != ASCII_ZERO)
if (HexDigit != ACPI_ASCII_ZERO)
{
LeadingZero = FALSE;
}
if (!LeadingZero)
{
String[k] = HexDigit;
String[k] = (UINT8) HexDigit;
k++;
}
}
@ -463,7 +466,7 @@ AcpiExConvertToAscii (
*/
if (!k)
{
String [0] = ASCII_ZERO;
String [0] = ACPI_ASCII_ZERO;
k = 1;
}
String [k] = 0;
@ -503,7 +506,7 @@ AcpiExConvertToString (
UINT8 *Pointer;
FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
switch (ObjDesc->Common.Type)
@ -516,8 +519,7 @@ AcpiExConvertToString (
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper
* 32-bit field
* Use only 32 bits of the Integer
*/
IntegerSize = sizeof (UINT32);
}
@ -542,7 +544,7 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
return_ACPI_STATUS (AE_NO_MEMORY);
@ -617,7 +619,7 @@ AcpiExConvertToString (
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExConvertToString: Buffer allocation failure\n"));
AcpiUtRemoveReference (RetDesc);
return_ACPI_STATUS (AE_NO_MEMORY);
@ -630,7 +632,7 @@ AcpiExConvertToString (
Index = 0;
for (i = 0, Index = 0; i < ObjDesc->Buffer.Length; i++)
{
Index = AcpiExConvertToAscii (Pointer[i], Base, &NewBuf[Index]);
Index = AcpiExConvertToAscii ((ACPI_INTEGER) Pointer[i], Base, &NewBuf[Index]);
NewBuf[Index] = ' ';
Index++;
@ -640,7 +642,7 @@ AcpiExConvertToString (
NewBuf [Index-1] = 0;
RetDesc->Buffer.Pointer = NewBuf;
RetDesc->String.Length = STRLEN ((char *) NewBuf);
RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf);
/* Return the new buffer descriptor */
@ -705,7 +707,7 @@ AcpiExConvertToTargetType (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExConvertToTargetType");
ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
/* Default behavior */
@ -779,6 +781,11 @@ AcpiExConvertToTargetType (
*/
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
break;
default:
Status = AE_AML_INTERNAL;
break;
}
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 1.90 $
* $Revision: 1.91 $
*
*****************************************************************************/
@ -118,12 +118,10 @@
#define __EXCREATE_C__
#include "acpi.h"
#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acdispat.h"
#include "actables.h"

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.143 $
* $Revision: 1.148 $
*
*****************************************************************************/
@ -120,11 +120,10 @@
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "actables.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exdump")
ACPI_MODULE_NAME ("exdump")
/*
@ -155,13 +154,13 @@ AcpiExShowHexValue (
UINT8 *AmlStart,
UINT32 LeadSpace)
{
UINT32 Value; /* Value retrieved from AML stream */
ACPI_INTEGER Value; /* Value retrieved from AML stream */
UINT32 ShowDecimalValue;
UINT32 Length; /* Length of printed field */
UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */
FUNCTION_TRACE ("ExShowHexValue");
ACPI_FUNCTION_TRACE ("ExShowHexValue");
if (!((ACPI_LV_LOAD & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@ -171,7 +170,7 @@ AcpiExShowHexValue (
if (!AmlStart)
{
REPORT_ERROR (("ExShowHexValue: null pointer\n"));
ACPI_REPORT_ERROR (("ExShowHexValue: null pointer\n"));
return;
}
@ -248,10 +247,10 @@ AcpiExDumpOperand (
UINT32 i;
PROC_NAME ("ExDumpOperand")
ACPI_FUNCTION_NAME ("ExDumpOperand")
if (!((ACPI_LV_INFO & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
{
return (AE_OK);
}
@ -263,27 +262,27 @@ AcpiExDumpOperand (
* since most (if not all)
* code that dumps the stack expects something to be there!
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null stack entry ptr\n"));
AcpiOsPrintf ("Null stack entry ptr\n");
return (AE_OK);
}
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", ObjDesc));
DUMP_ENTRY (ObjDesc, ACPI_LV_INFO);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", ObjDesc));
ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
return (AE_OK);
}
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is not a local object\n", ObjDesc));
DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", ObjDesc));
ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
return (AE_OK);
}
/* ObjDesc is a valid object */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p ", ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
switch (ObjDesc->Common.Type)
{
@ -323,9 +322,9 @@ AcpiExDumpOperand (
case AML_NAME_OP:
DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
ACPI_LV_INFO, _COMPONENT);
DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
break;
@ -346,8 +345,8 @@ AcpiExDumpOperand (
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
HIDWORD(ObjDesc->Integer.Value),
LODWORD(ObjDesc->Integer.Value));
ACPI_HIDWORD(ObjDesc->Integer.Value),
ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@ -365,8 +364,8 @@ AcpiExDumpOperand (
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
HIDWORD(ObjDesc->Integer.Value),
LODWORD(ObjDesc->Integer.Value));
ACPI_HIDWORD(ObjDesc->Integer.Value),
ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@ -375,7 +374,7 @@ AcpiExDumpOperand (
case AML_INT_NAMEPATH_OP:
AcpiOsPrintf ("Reference.Node->Name %X\n",
ObjDesc->Reference.Node->Name);
ObjDesc->Reference.Node->Name.Integer);
break;
default:
@ -423,24 +422,24 @@ AcpiExDumpOperand (
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("Integer %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_IF:
AcpiOsPrintf ("If [Integer] %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_WHILE:
AcpiOsPrintf ("While [Integer] %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@ -467,9 +466,7 @@ AcpiExDumpOperand (
AcpiExDumpOperand (*Element);
}
}
AcpiOsPrintf ("\n");
break;
@ -490,8 +487,8 @@ AcpiExDumpOperand (
else
{
AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
HIDWORD(ObjDesc->Region.Address),
LODWORD(ObjDesc->Region.Address),
ACPI_HIDWORD (ObjDesc->Region.Address),
ACPI_LODWORD (ObjDesc->Region.Address),
ObjDesc->Region.Length);
}
break;
@ -507,7 +504,6 @@ AcpiExDumpOperand (
AcpiOsPrintf ("%c",
ObjDesc->String.Pointer[i]);
}
AcpiOsPrintf ("\"\n");
break;
@ -526,7 +522,7 @@ AcpiExDumpOperand (
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset);
DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
ACPI_DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
break;
@ -545,18 +541,16 @@ AcpiExDumpOperand (
if (!ObjDesc->BufferField.BufferObj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
}
else if (ACPI_TYPE_BUFFER !=
ObjDesc->BufferField.BufferObj->Common.Type)
{
AcpiOsPrintf ("*not a Buffer* \n");
}
else
{
DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
ACPI_DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
}
break;
@ -608,7 +602,7 @@ AcpiExDumpOperand (
default:
/* unknown ObjDesc->Common.Type value */
/* Unknown ObjDesc->Common.Type value */
AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
break;
@ -634,7 +628,7 @@ AcpiExDumpOperand (
void
AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **Operands,
OPERATING_MODE InterpreterMode,
ACPI_INTERPRETER_MODE InterpreterMode,
NATIVE_CHAR *Ident,
UINT32 NumLevels,
NATIVE_CHAR *Note,
@ -645,7 +639,7 @@ AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **ObjDesc;
PROC_NAME ("ExDumpOperands");
ACPI_FUNCTION_NAME ("ExDumpOperands");
if (!Ident)
@ -659,7 +653,7 @@ AcpiExDumpOperands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
Ident, NumLevels));
@ -680,7 +674,7 @@ AcpiExDumpOperands (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Stack dump from %s(%d), %s\n",
ModuleName, LineNumber, Note));
return;
@ -729,11 +723,12 @@ AcpiExOutAddress (
char *Title,
ACPI_PHYSICAL_ADDRESS Value)
{
#ifdef _IA16
AcpiOsPrintf ("%20s : %p\n", Title, Value);
#else
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title,
HIDWORD (Value), LODWORD (Value));
ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
#endif
}
@ -755,7 +750,7 @@ AcpiExDumpNode (
UINT32 Flags)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if (!Flags)
@ -767,8 +762,8 @@ AcpiExDumpNode (
}
AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char*)&Node->Name);
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiOsPrintf ("%20s : %4.4s\n", "Name", Node->Name.Ascii);
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutInteger ("Flags", Node->Flags);
AcpiExOutInteger ("Owner Id", Node->OwnerId);
AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
@ -798,7 +793,7 @@ AcpiExDumpObjectDescriptor (
UINT32 i;
FUNCTION_TRACE ("ExDumpObjectDescriptor");
ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
if (!Flags)
@ -827,8 +822,9 @@ AcpiExDumpObjectDescriptor (
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
AcpiOsPrintf ("%20s : %X%8.8X\n", "Value",
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@ -851,7 +847,6 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("Flags", ObjDesc->Package.Flags);
AcpiExOutInteger ("Count", ObjDesc->Package.Count);
AcpiExOutPointer ("Elements", ObjDesc->Package.Elements);
AcpiExOutPointer ("NextElement", ObjDesc->Package.NextElement);
/* Dump the package contents */
@ -980,6 +975,10 @@ AcpiExDumpObjectDescriptor (
AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj);
AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj);
break;
default:
/* All object types covered above */
break;
}
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.103 $
* $Revision: 1.109 $
*
*****************************************************************************/
@ -120,21 +120,18 @@
#include "acpi.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exfield")
ACPI_MODULE_NAME ("exfield")
/*******************************************************************************
*
* FUNCTION: AcpiExReadDataFromField
*
* PARAMETERS: ObjDesc - The named field
* PARAMETERS: WalkState - Current execution state
* ObjDesc - The named field
* RetBufferDesc - Where the return data object is stored
*
* RETURN: Status
@ -146,17 +143,19 @@
ACPI_STATUS
AcpiExReadDataFromField (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **RetBufferDesc)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *BufferDesc;
UINT32 Length;
UINT32 IntegerSize;
void *Buffer;
BOOLEAN Locked;
FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
/* Parameter validation */
@ -192,9 +191,21 @@ AcpiExReadDataFromField (
*
* Note: Field.length is in bits.
*/
Length = ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
Length = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
if (Length > sizeof (ACPI_INTEGER))
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
IntegerSize = sizeof (ACPI_INTEGER);
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* Integer size is 4.
*/
IntegerSize = sizeof (UINT32);
}
if (Length > IntegerSize)
{
/* Field is too large for an Integer, create a Buffer instead */
@ -213,6 +224,7 @@ AcpiExReadDataFromField (
return_ACPI_STATUS (AE_NO_MEMORY);
}
BufferDesc->Common.Flags = AOPOBJ_DATA_VALID;
BufferDesc->Buffer.Length = Length;
Buffer = BufferDesc->Buffer.Pointer;
}
@ -226,14 +238,15 @@ AcpiExReadDataFromField (
return_ACPI_STATUS (AE_NO_MEMORY);
}
Length = sizeof (BufferDesc->Integer.Value);
Length = IntegerSize;
BufferDesc->Integer.Value = 0;
Buffer = &BufferDesc->Integer.Value;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
ObjDesc, ObjDesc->Common.Type, Buffer, Length));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n",
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.StartFieldBitOffset,
@ -289,7 +302,7 @@ AcpiExWriteDataToField (
BOOLEAN Locked;
FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
/* Parameter validation */
@ -346,7 +359,7 @@ AcpiExWriteDataToField (
* the ACPI specification.
*/
NewBuffer = NULL;
RequiredLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (Length < RequiredLength)
{
@ -363,15 +376,15 @@ AcpiExWriteDataToField (
* at Byte zero. All unused (upper) bytes of the
* buffer will be 0.
*/
MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
Buffer = NewBuffer;
Length = RequiredLength;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Obj=%p Type=%X Buf=%p Len=%X\n",
ObjDesc, ObjDesc->Common.Type, Buffer, Length));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n",
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.StartFieldBitOffset,

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 1.80 $
* $Revision: 1.85 $
*
*****************************************************************************/
@ -120,14 +120,12 @@
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exfldio")
ACPI_MODULE_NAME ("exfldio")
/*******************************************************************************
@ -154,7 +152,7 @@ AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *RgnDesc;
FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@ -197,8 +195,8 @@ AcpiExSetupRegion (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.AccessByteWidth,
(char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.AccessByteWidth,
RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length));
}
/*
@ -207,9 +205,9 @@ AcpiExSetupRegion (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.BaseByteOffset,
ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
(char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
}
@ -246,7 +244,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
FUNCTION_TRACE ("AcpiExAccessRegion");
ACPI_FUNCTION_TRACE ("ExAccessRegion");
/*
@ -277,12 +275,12 @@ AcpiExAccessRegion (
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
HIDWORD (Address), LODWORD (Address)));
ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ReadWrite,
Address, MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
{
@ -339,7 +337,7 @@ AcpiExRegisterOverflow (
return (FALSE);
}
if (Value >= (ACPI_INTEGER) (1 << ObjDesc->CommonField.BitLength))
if (Value >= ((ACPI_INTEGER) 1 << ObjDesc->CommonField.BitLength))
{
/*
* The Value is larger than the maximum value that can fit into
@ -383,7 +381,7 @@ AcpiExFieldDatumIo (
ACPI_INTEGER LocalValue;
FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@ -429,7 +427,7 @@ AcpiExFieldDatumIo (
* Copy the data from the source buffer.
* Length is the field width in bytes.
*/
MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
ObjDesc->CommonField.AccessByteWidth);
@ -440,7 +438,7 @@ AcpiExFieldDatumIo (
* Copy the data to the target buffer.
* Length is the field width in bytes.
*/
MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
Value, ObjDesc->CommonField.AccessByteWidth);
@ -455,7 +453,7 @@ AcpiExFieldDatumIo (
/* Ensure that the BankValue is not beyond the capacity of the register */
if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
ObjDesc->BankField.Value))
(ACPI_INTEGER) ObjDesc->BankField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@ -477,7 +475,7 @@ AcpiExFieldDatumIo (
* RegionField case and write the datum to the Operation Region
*/
/* No break; ! */
/*lint -fallthrough */
case INTERNAL_TYPE_REGION_FIELD:
@ -502,7 +500,7 @@ AcpiExFieldDatumIo (
/* Ensure that the IndexValue is not beyond the capacity of the register */
if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
ObjDesc->IndexField.Value))
(ACPI_INTEGER) ObjDesc->IndexField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@ -547,12 +545,12 @@ AcpiExFieldDatumIo (
if (ReadWrite == ACPI_READ)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
HIDWORD(*Value), LODWORD(*Value)));
ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
HIDWORD(*Value), LODWORD(*Value)));
ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
}
@ -585,7 +583,7 @@ AcpiExWriteWithUpdateRule (
ACPI_INTEGER CurrentValue;
FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
/* Start with the new bits */
@ -594,7 +592,7 @@ AcpiExWriteWithUpdateRule (
/* If the mask is all ones, we don't need to worry about the update rule */
if (Mask != ACPI_UINT32_MAX)
if (Mask != ACPI_INTEGER_MAX)
{
/* Decode the update rule */
@ -605,8 +603,8 @@ AcpiExWriteWithUpdateRule (
* Check if update rule needs to be applied (not if mask is all
* ones) The left shift drops the bits we want to ignore.
*/
if ((~Mask << (MUL_8 (sizeof (Mask)) -
MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) -
ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
{
/*
* Read the current contents of the byte/word/dword containing
@ -647,10 +645,10 @@ AcpiExWriteWithUpdateRule (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Mask %8.8X%8.8X DatumOffset %X Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
HIDWORD(Mask), LODWORD(Mask),
ACPI_HIDWORD (Mask), ACPI_LODWORD (Mask),
FieldDatumByteOffset,
HIDWORD(FieldValue), LODWORD(FieldValue),
HIDWORD(MergedValue),LODWORD(MergedValue)));
ACPI_HIDWORD (FieldValue), ACPI_LODWORD (FieldValue),
ACPI_HIDWORD (MergedValue),ACPI_LODWORD (MergedValue)));
return_ACPI_STATUS (Status);
}
@ -681,25 +679,33 @@ AcpiExGetBufferDatum(
UINT32 Offset)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
*Datum = ((UINT8 *) Buffer) [Offset];
break;
case ACPI_FIELD_WORD_GRANULARITY:
MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
break;
case ACPI_FIELD_DWORD_GRANULARITY:
MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
break;
case ACPI_FIELD_QWORD_GRANULARITY:
MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
break;
default:
/* Should not get here */
break;
}
}
@ -730,25 +736,33 @@ AcpiExSetBufferDatum (
UINT32 Offset)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
((UINT8 *) Buffer) [Offset] = (UINT8) MergedDatum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_QWORD_GRANULARITY:
MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
break;
default:
/* Should not get here */
break;
}
}
@ -783,16 +797,16 @@ AcpiExExtractFromField (
UINT32 DatumCount;
FUNCTION_TRACE ("ExExtractFromField");
ACPI_FUNCTION_TRACE ("ExExtractFromField");
/*
* The field must fit within the caller's buffer
*/
ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (ByteFieldLength > BufferLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field size %X (bytes) too large for buffer (%X)\n",
ByteFieldLength, BufferLength));
@ -801,10 +815,10 @@ AcpiExExtractFromField (
/* Convert field byte count to datum count, round up if necessary */
DatumCount = ROUND_UP_TO (ByteFieldLength,
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength,
ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth));
@ -813,7 +827,7 @@ AcpiExExtractFromField (
* This is very important, especially in the cases where a byte is read,
* but the buffer is really a UINT32 (4 bytes).
*/
MEMSET (Buffer, 0, BufferLength);
ACPI_MEMSET (Buffer, 0, BufferLength);
/* Read the first raw datum to prime the loop */
@ -841,7 +855,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
/* Store the datum to the caller buffer */
@ -917,7 +931,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &=
MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
}
}
@ -971,7 +985,7 @@ AcpiExInsertIntoField (
UINT32 DatumCount;
FUNCTION_TRACE ("ExInsertIntoField");
ACPI_FUNCTION_TRACE ("ExInsertIntoField");
/*
@ -980,10 +994,10 @@ AcpiExInsertIntoField (
* larger than the field, this typically happens when an integer is
* written to a field that is actually smaller than an integer.
*/
ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (BufferLength < ByteFieldLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Buffer length %X too small for field %X\n",
BufferLength, ByteFieldLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
@ -991,9 +1005,9 @@ AcpiExInsertIntoField (
/* Convert byte count to datum count, round up if necessary */
DatumCount = ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth));
@ -1021,7 +1035,7 @@ AcpiExInsertIntoField (
*
* Mask off bits that are "below" the field (if any)
*/
Mask = MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* If the field fits in one datum, may need to mask upper bits */
@ -1030,7 +1044,7 @@ AcpiExInsertIntoField (
{
/* There are bits above the field, mask them off also */
Mask &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
}
/* Shift and mask the value into the field position */
@ -1117,7 +1131,7 @@ AcpiExInsertIntoField (
*
* Mask off the unused bits above (after) the end-of-field
*/
Mask = MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
MergedDatum &= Mask;
/* Write the last datum with the update rule */

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 1.98 $
* $Revision: 1.101 $
*
*****************************************************************************/
@ -119,14 +119,13 @@
#define __EXMISC_C__
#include "acpi.h"
#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exmisc")
ACPI_MODULE_NAME ("exmisc")
/*******************************************************************************
@ -152,7 +151,7 @@ AcpiExGetObjectReference (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
@ -244,7 +243,7 @@ AcpiExConcatTemplate (
ACPI_SIZE Length2;
FUNCTION_TRACE ("ExConcatTemplate");
ACPI_FUNCTION_TRACE ("ExConcatTemplate");
/* Find the EndTags in each resource template */
@ -273,7 +272,7 @@ AcpiExConcatTemplate (
NewBuf = ACPI_MEM_ALLOCATE (Length1 + Length2);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExConcatTemplate: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
@ -281,8 +280,8 @@ AcpiExConcatTemplate (
/* Copy the templates to the new descriptor */
MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1);
ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2);
/*
* Point the return object to the new buffer
@ -292,7 +291,7 @@ AcpiExConcatTemplate (
/* Compute the new checksum */
NewBuf[ReturnDesc->Buffer.Length - 1] =
NewBuf[ReturnDesc->Buffer.Length - 1] = (NATIVE_CHAR)
AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
(ReturnDesc->Buffer.Length - 1));
@ -339,7 +338,7 @@ AcpiExDoConcatenate (
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/*
@ -378,7 +377,7 @@ AcpiExDoConcatenate (
NewBuf = ACPI_MEM_CALLOCATE (ReturnDesc->Buffer.Length);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExDoConcatenate: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
@ -391,7 +390,7 @@ AcpiExDoConcatenate (
ThisInteger = ObjDesc1->Integer.Value;
for (i = 0; i < IntegerSize; i++)
{
NewBuf[i] = (UINT8) ThisInteger;
NewBuf[i] = (NATIVE_CHAR) ThisInteger;
ThisInteger >>= 8;
}
@ -400,7 +399,7 @@ AcpiExDoConcatenate (
ThisInteger = ObjDesc2->Integer.Value;
for (; i < (IntegerSize * 2); i++)
{
NewBuf[i] = (UINT8) ThisInteger;
NewBuf[i] = (NATIVE_CHAR) ThisInteger;
ThisInteger >>= 8;
}
@ -421,15 +420,15 @@ AcpiExDoConcatenate (
ObjDesc2->String.Length + 1);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExDoConcatenate: String allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
STRCPY (NewBuf, ObjDesc1->String.Pointer);
STRCPY (NewBuf + ObjDesc1->String.Length,
ObjDesc2->String.Pointer);
ACPI_STRCPY (NewBuf, ObjDesc1->String.Pointer);
ACPI_STRCPY (NewBuf + ObjDesc1->String.Length,
ObjDesc2->String.Pointer);
/* Point the return object to the new string */
@ -453,15 +452,15 @@ AcpiExDoConcatenate (
ObjDesc2->Buffer.Length);
if (!NewBuf)
{
REPORT_ERROR
ACPI_REPORT_ERROR
(("ExDoConcatenate: Buffer allocation failure\n"));
Status = AE_NO_MEMORY;
goto Cleanup;
}
MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer,
ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer,
ObjDesc1->Buffer.Length);
MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer,
ACPI_MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer,
ObjDesc2->Buffer.Length);
/*
@ -647,6 +646,9 @@ AcpiExDoLogicalOp (
return (TRUE);
}
break;
default:
break;
}
return (FALSE);

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 1.9 $
* $Revision: 1.11 $
*
*****************************************************************************/
@ -119,12 +119,9 @@
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exmutex")
ACPI_MODULE_NAME ("exmutex")
/*******************************************************************************
@ -230,7 +227,7 @@ AcpiExAcquireMutex (
ACPI_STATUS Status;
FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
if (!ObjDesc)
{
@ -304,7 +301,7 @@ AcpiExReleaseMutex (
ACPI_STATUS Status;
FUNCTION_TRACE ("ExReleaseMutex");
ACPI_FUNCTION_TRACE ("ExReleaseMutex");
if (!ObjDesc)
@ -383,7 +380,7 @@ AcpiExReleaseAllMutexes (
ACPI_OPERAND_OBJECT *This;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/*

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.87 $
* $Revision: 1.91 $
*
*****************************************************************************/
@ -120,10 +120,9 @@
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exnames")
ACPI_MODULE_NAME ("exnames")
/* AML Package Length encodings */
@ -159,7 +158,7 @@ AcpiExAllocateNameString (
NATIVE_CHAR *NameString;
UINT32 SizeNeeded;
FUNCTION_TRACE ("ExAllocateNameString");
ACPI_FUNCTION_TRACE ("ExAllocateNameString");
/*
@ -185,7 +184,7 @@ AcpiExAllocateNameString (
NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
if (!NameString)
{
REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
return_PTR (NULL);
}
@ -248,13 +247,13 @@ AcpiExNameSegment (
UINT8 **InAmlAddress,
NATIVE_CHAR *NameString)
{
UINT8 *AmlAddress = *InAmlAddress;
char *AmlAddress = (void *) *InAmlAddress;
ACPI_STATUS Status = AE_OK;
UINT32 Index;
NATIVE_CHAR CharBuf[5];
char CharBuf[5];
FUNCTION_TRACE ("ExNameSegment");
ACPI_FUNCTION_TRACE ("ExNameSegment");
/*
@ -271,18 +270,18 @@ AcpiExNameSegment (
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
for (Index = 4;
(Index > 0) && (AcpiUtValidAcpiCharacter (*AmlAddress));
Index--)
for (Index = 0;
(Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
Index++)
{
CharBuf[4 - Index] = *AmlAddress++;
ACPI_DEBUG_PRINT ((ACPI_DB_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 */
@ -290,7 +289,7 @@ AcpiExNameSegment (
if (NameString)
{
STRCAT (NameString, CharBuf);
ACPI_STRCAT (NameString, CharBuf);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Appended to - %s \n", NameString));
}
@ -300,7 +299,7 @@ AcpiExNameSegment (
"No Name string - %s \n", CharBuf));
}
}
else if (4 == Index)
else if (Index == 0)
{
/*
* First character was not a valid name character,
@ -320,7 +319,7 @@ AcpiExNameSegment (
*AmlAddress, AmlAddress));
}
*InAmlAddress = AmlAddress;
*InAmlAddress = (UINT8 *) AmlAddress;
return_ACPI_STATUS (Status);
}
@ -352,7 +351,7 @@ AcpiExGetNameString (
BOOLEAN HasPrefix = FALSE;
FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
if (INTERNAL_TYPE_REGION_FIELD == DataType ||
@ -381,13 +380,13 @@ AcpiExGetNameString (
{
case AML_ROOT_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix: %x\n", *AmlAddress));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
/*
* Remember that we have a RootPrefix --
* see comment in AcpiExAllocateNameString()
*/
*AmlAddress++;
AmlAddress++;
PrefixCount = ACPI_UINT32_MAX;
HasPrefix = TRUE;
break;
@ -399,9 +398,9 @@ AcpiExGetNameString (
do
{
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix: %x\n", *AmlAddress));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
*AmlAddress++;
AmlAddress++;
PrefixCount++;
} while (*AmlAddress == AML_PARENT_PREFIX);
@ -424,9 +423,9 @@ AcpiExGetNameString (
{
case AML_DUAL_NAME_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix: %x\n", *AmlAddress));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
*AmlAddress++;
AmlAddress++;
NameString = AcpiExAllocateNameString (PrefixCount, 2);
if (!NameString)
{
@ -448,11 +447,11 @@ AcpiExGetNameString (
case AML_MULTI_NAME_PREFIX_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix: %x\n", *AmlAddress));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
/* Fetch count of segments remaining in name path */
*AmlAddress++;
AmlAddress++;
NumSegments = *AmlAddress;
NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
@ -464,7 +463,7 @@ AcpiExGetNameString (
/* Indicate that we processed a prefix */
*AmlAddress++;
AmlAddress++;
HasPrefix = TRUE;
while (NumSegments &&
@ -518,7 +517,7 @@ AcpiExGetNameString (
{
/* Ran out of segments after processing a prefix */
REPORT_ERROR (
ACPI_REPORT_ERROR (
("ExDoName: Malformed Name at %p\n", NameString));
Status = AE_AML_BAD_NAME;
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 1.132 $
* $Revision: 1.136 $
*
*****************************************************************************/
@ -126,7 +126,7 @@
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exoparg1")
ACPI_MODULE_NAME ("exoparg1")
/*!
@ -173,7 +173,7 @@ AcpiExOpcode_1A_0T_0R (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@ -218,7 +218,7 @@ AcpiExOpcode_1A_0T_0R (
default: /* Unknown opcode */
REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@ -249,7 +249,7 @@ AcpiExOpcode_1A_1T_0R (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@ -263,7 +263,7 @@ AcpiExOpcode_1A_1T_0R (
default: /* Unknown opcode */
REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@ -303,10 +303,11 @@ AcpiExOpcode_1A_1T_1R (
ACPI_INTEGER Digit;
FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Create a return object of type Integer for most opcodes */
/* Examine the AML opcode */
switch (WalkState->Opcode)
{
@ -317,6 +318,8 @@ AcpiExOpcode_1A_1T_1R (
case AML_TO_BCD_OP:
case AML_COND_REF_OF_OP:
/* Create a return object of type Integer for these opcodes */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
@ -324,162 +327,164 @@ AcpiExOpcode_1A_1T_1R (
goto Cleanup;
}
break;
}
/* Examine the AML opcode */
switch (WalkState->Opcode)
{
case AML_BIT_NOT_OP: /* Not (Operand, Result) */
ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value;
break;
case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
/*
* Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
switch (WalkState->Opcode)
{
ReturnDesc->Integer.Value >>= 1;
}
case AML_BIT_NOT_OP: /* Not (Operand, Result) */
ReturnDesc->Integer.Value = Temp32;
break;
ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value;
break;
case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
/*
* The Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
{
ReturnDesc->Integer.Value <<= 1;
}
/* Since the bit position is one-based, subtract from 33 (65) */
ReturnDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
break;
case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD integers
*/
ReturnDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Get one BCD digit */
Digit = (ACPI_INTEGER) ((Operand[0]->Integer.Value >> (i * 4)) & 0xF);
/* Check the range of the digit */
if (Digit > 9)
/*
* Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
(UINT32) Digit));
ReturnDesc->Integer.Value >>= 1;
}
ReturnDesc->Integer.Value = Temp32;
break;
case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
/*
* The Acpi specification describes Integer type as a little
* endian unsigned value, so this boundary condition is valid.
*/
for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32)
{
ReturnDesc->Integer.Value <<= 1;
}
/* Since the bit position is one-based, subtract from 33 (65) */
ReturnDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
break;
case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD integers
*/
ReturnDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Get one BCD digit */
Digit = (ACPI_INTEGER) ((Operand[0]->Integer.Value >> (i * 4)) & 0xF);
/* Check the range of the digit */
if (Digit > 9)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n",
(UINT32) Digit));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
if (Digit > 0)
{
/* Sum into the result with the appropriate power of 10 */
for (j = 0; j < i; j++)
{
Digit *= 10;
}
ReturnDesc->Integer.Value += Digit;
}
}
break;
case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
ACPI_HIDWORD(Operand[0]->Integer.Value),
ACPI_LODWORD(Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
if (Digit > 0)
ReturnDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Sum into the result with the appropriate power of 10 */
/* Divide by nth factor of 10 */
Temp32 = 0;
Digit = Operand[0]->Integer.Value;
for (j = 0; j < i; j++)
{
Digit *= 10;
(void) AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
}
ReturnDesc->Integer.Value += Digit;
/* Create the BCD digit from the remainder above */
if (Digit > 0)
{
ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4));
}
}
}
break;
break;
case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n",
HIDWORD(Operand[0]->Integer.Value), LODWORD(Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
}
ReturnDesc->Integer.Value = 0;
for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
{
/* Divide by nth factor of 10 */
Temp32 = 0;
Digit = Operand[0]->Integer.Value;
for (j = 0; j < i; j++)
{
AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32);
}
/* Create the BCD digit from the remainder above */
if (Digit > 0)
{
ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4));
}
}
break;
case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
/*
* This op is a little strange because the internal return value is
* different than the return value stored in the result descriptor
* (There are really two return values)
*/
if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode)
{
/*
* This means that the object does not exist in the namespace,
* return FALSE
*/
ReturnDesc->Integer.Value = 0;
case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
/*
* Must delete the result descriptor since there is no reference
* being returned
* This op is a little strange because the internal return value is
* different than the return value stored in the result descriptor
* (There are really two return values)
*/
AcpiUtRemoveReference (Operand[1]);
if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode)
{
/*
* This means that the object does not exist in the namespace,
* return FALSE
*/
ReturnDesc->Integer.Value = 0;
/*
* Must delete the result descriptor since there is no reference
* being returned
*/
AcpiUtRemoveReference (Operand[1]);
goto Cleanup;
}
/* Get the object reference and store it */
Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
/* The object exists in the namespace, return TRUE */
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
goto Cleanup;
default:
/* No other opcodes get here */
break;
}
/* Get the object reference and store it */
Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState);
/* The object exists in the namespace, return TRUE */
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
goto Cleanup;
break;
case AML_STORE_OP: /* Store (Source, Target) */
@ -553,7 +558,7 @@ AcpiExOpcode_1A_1T_1R (
default: /* Unknown opcode */
REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@ -604,7 +609,7 @@ AcpiExOpcode_1A_0T_1R (
ACPI_INTEGER Value;
FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@ -727,7 +732,7 @@ AcpiExOpcode_1A_0T_1R (
default:
REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n",
Operand[0]->Reference.Opcode));
Status = AE_AML_INTERNAL;
goto Cleanup;
@ -749,6 +754,11 @@ AcpiExOpcode_1A_0T_1R (
case INTERNAL_TYPE_INDEX_FIELD:
Type = ACPI_TYPE_FIELD_UNIT;
break;
default:
/* No change to Type required */
break;
}
}
@ -853,8 +863,12 @@ AcpiExOpcode_1A_0T_1R (
/* Set Operand[0] to the value of the local/arg */
AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
Operand[0]->Reference.Offset, WalkState, &TempDesc);
Status = AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
Operand[0]->Reference.Offset, WalkState, &TempDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* Delete our reference to the input object and
@ -882,7 +896,7 @@ AcpiExOpcode_1A_0T_1R (
* to resolve the node to a value.
*/
Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer, WalkState->ScopeInfo->Scope.Node,
NS_SEARCH_PARENT, (ACPI_NAMESPACE_NODE **) &ReturnDesc);
ACPI_NS_SEARCH_PARENT, (ACPI_NAMESPACE_NODE **) &ReturnDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@ -927,10 +941,22 @@ AcpiExOpcode_1A_0T_1R (
switch (Operand[0]->Reference.TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
/* Ensure that the Buffer arguments are evaluated */
TempDesc = Operand[0]->Reference.Object;
#if 0
Status = AcpiDsGetBufferArguments (TempDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
#endif
/*
* The target is a buffer, we must create a new object that
* contains one element of the buffer, the element pointed
* to by the index.
* Create a new object that contains one element of the
* buffer -- the element pointed to by the index.
*
* NOTE: index into a buffer is NOT a pointer to a
* sub-buffer of the main buffer, it is only a pointer to a
@ -948,7 +974,6 @@ AcpiExOpcode_1A_0T_1R (
* indexed location, we don't need to add an additional
* reference to the buffer itself.
*/
TempDesc = Operand[0]->Reference.Object;
ReturnDesc->Integer.Value =
TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
break;
@ -956,10 +981,18 @@ AcpiExOpcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE:
#if 0
/* Ensure that the Package arguments are evaluated */
Status = AcpiDsGetPackageArguments (Operand[0]->Reference.Object);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
#endif
/*
* The target is a package, we want to return the referenced
* element of the package. We must add another reference to
* this object, however.
* Return the referenced element of the package. We must add
* another reference to the referenced object, however.
*/
ReturnDesc = *(Operand[0]->Reference.Where);
if (!ReturnDesc)
@ -1012,7 +1045,7 @@ AcpiExOpcode_1A_0T_1R (
default:
REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 1.102 $
* $Revision: 1.106 $
*
*****************************************************************************/
@ -119,15 +119,13 @@
#include "acpi.h"
#include "acparser.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
#include "acdispat.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exoparg2")
ACPI_MODULE_NAME ("exoparg2")
/*!
@ -177,50 +175,47 @@ AcpiExOpcode_2A_0T_0R (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R",
AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the opcode */
switch (WalkState->Opcode)
{
case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */
/* The first operand is a namespace node */
Node = (ACPI_NAMESPACE_NODE *) Operand[0];
/* The node must refer to a device or thermal zone */
/* Notifies allowed on this object? */
switch (Node->Type)
if (!AcpiEvIsNotifyObject (Node))
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_THERMAL:
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
* completes. The notify handlers are NOT invoked synchronously
* from this thread -- because handlers may in turn run other
* control methods.
*/
Status = AcpiEvQueueNotifyRequest (Node,
(UINT32) Operand[1]->Integer.Value);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n",
Node->Type));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type [%s]\n",
AcpiUtGetTypeName (Node->Type)));
Status = AE_AML_OPERAND_TYPE;
break;
}
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
* completes. The notify handlers are NOT invoked synchronously
* from this thread -- because handlers may in turn run other
* control methods.
*/
Status = AcpiEvQueueNotifyRequest (Node,
(UINT32) Operand[1]->Integer.Value);
break;
default:
REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n", WalkState->Opcode));
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
@ -251,7 +246,7 @@ AcpiExOpcode_2A_2T_1R (
ACPI_STATUS Status;
FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/*
@ -288,7 +283,7 @@ AcpiExOpcode_2A_2T_1R (
default:
REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@ -356,7 +351,7 @@ AcpiExOpcode_2A_1T_1R (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/*
@ -540,7 +535,7 @@ AcpiExOpcode_2A_1T_1R (
default:
REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@ -600,7 +595,7 @@ AcpiExOpcode_2A_0T_1R (
BOOLEAN LogicalResult = FALSE;
FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
/* Create the internal return object */
@ -650,7 +645,7 @@ AcpiExOpcode_2A_0T_1R (
default:
REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n", WalkState->Opcode));
ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n", WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 1.112 $
* $Revision: 1.116 $
*
*****************************************************************************/
@ -121,11 +121,10 @@
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exprep")
ACPI_MODULE_NAME ("exprep")
/*******************************************************************************
@ -149,25 +148,37 @@ AcpiExDecodeFieldAccess (
UINT32 *ReturnByteAlignment)
{
UINT32 Access;
UINT32 Length;
UINT8 ByteAlignment;
UINT8 BitLength;
/* UINT32 Length; */
PROC_NAME ("ExDecodeFieldAccess");
ACPI_FUNCTION_NAME ("ExDecodeFieldAccess");
Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
Length = ObjDesc->CommonField.BitLength;
switch (Access)
{
case AML_FIELD_ACCESS_ANY:
ByteAlignment = 1;
BitLength = 8;
#if 0
/*
* TBD: optimize
*
* Any attempt to optimize the access size to the size of the field
* must take into consideration the length of the region and take
* care that an access to the field will not attempt to access
* beyond the end of the region.
*/
/* Use the length to set the access type */
Length = ObjDesc->CommonField.BitLength;
if (Length <= 8)
{
BitLength = 8;
@ -190,6 +201,7 @@ AcpiExDecodeFieldAccess (
BitLength = 8;
}
#endif
break;
case AML_FIELD_ACCESS_BYTE:
@ -274,7 +286,7 @@ AcpiExPrepCommonFieldObject (
UINT32 NearestByteAddress;
FUNCTION_TRACE ("ExPrepCommonFieldObject");
ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject");
/*
@ -291,16 +303,18 @@ AcpiExPrepCommonFieldObject (
* two pieces of information - the width of each field access and the
* necessary ByteAlignment (address granularity) of the access.
*
* For AnyAcc, the AccessBitWidth is the largest width that is both necessary
* and possible in an attempt to access the whole field in one
* I/O operation. However, for AnyAcc, the ByteAlignment is always one byte.
* For AnyAcc, the AccessBitWidth is the largest width that is both
* necessary and possible in an attempt to access the whole field in one
* I/O operation. However, for AnyAcc, the ByteAlignment is always one
* byte.
*
* For all Buffer Fields, the ByteAlignment is always one byte.
*
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the
* same (equivalent) as the ByteAlignment.
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
* the same (equivalent) as the ByteAlignment.
*/
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, &ByteAlignment);
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
&ByteAlignment);
if (!AccessBitWidth)
{
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
@ -308,45 +322,59 @@ AcpiExPrepCommonFieldObject (
/* Setup width (access granularity) fields */
ObjDesc->CommonField.AccessByteWidth = (UINT8) DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
ObjDesc->CommonField.AccessByteWidth = (UINT8)
ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
/*
* 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 unit) of the field.
* (i.e., the first datum that contains at least the first *bit* of the field.)
* Note: ByteAlignment is always either equal to the AccessBitWidth or 8 (Byte access),
* and it defines the addressing granularity of the parent region or buffer.
* 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
* unit) of the field. (i.e., the first datum that contains at least the
* first *bit* of the field.)
*
* Note: ByteAlignment is always either equal to the AccessBitWidth or 8
* (Byte access), and it defines the addressing granularity of the parent
* region or buffer.
*/
NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, ByteAlignment);
NearestByteAddress =
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ObjDesc->CommonField.BaseByteOffset =
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
/*
* StartFieldBitOffset is the offset of the first bit of the field within a field datum.
* StartFieldBitOffset is the offset of the first bit of the field within
* a field datum.
*/
ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (FieldBitPosition -
MUL_8 (ObjDesc->CommonField.BaseByteOffset));
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)
* 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) %
ObjDesc->CommonField.EndFieldValidBits = (UINT8)
((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) %
AccessBitWidth);
ObjDesc->CommonField.EndBufferValidBits = (UINT8) (FieldBitLength % AccessBitWidth); /* StartBufferBitOffset always = 0 */
/* StartBufferBitOffset always = 0 */
ObjDesc->CommonField.EndBufferValidBits = (UINT8)
(FieldBitLength % AccessBitWidth);
/*
* DatumValidBits is the number of valid field bits in the first field datum.
* DatumValidBits is the number of valid field bits in the first
* field datum.
*/
ObjDesc->CommonField.DatumValidBits = (UINT8) (AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
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)
*/
if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <=
(UINT16) AccessBitWidth)
(UINT16) AccessBitWidth)
{
ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM;
}
@ -381,7 +409,7 @@ AcpiExPrepFieldValue (
ACPI_STATUS Status;
FUNCTION_TRACE ("ExPrepFieldValue");
ACPI_FUNCTION_TRACE ("ExPrepFieldValue");
/* Parameter validation */
@ -436,7 +464,7 @@ AcpiExPrepFieldValue (
AcpiUtAddReference (ObjDesc->Field.RegionObj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n",
ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,
ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
@ -454,9 +482,12 @@ AcpiExPrepFieldValue (
AcpiUtAddReference (ObjDesc->BankField.RegionObj);
AcpiUtAddReference (ObjDesc->BankField.BankObj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n",
ObjDesc->BankField.StartFieldBitOffset, ObjDesc->BankField.BaseByteOffset,
ObjDesc->Field.AccessByteWidth, ObjDesc->BankField.RegionObj,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n",
ObjDesc->BankField.StartFieldBitOffset,
ObjDesc->BankField.BaseByteOffset,
ObjDesc->Field.AccessByteWidth,
ObjDesc->BankField.RegionObj,
ObjDesc->BankField.BankObj));
break;
@ -465,8 +496,8 @@ AcpiExPrepFieldValue (
ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (Info->RegisterNode);
ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (Info->DataRegisterNode);
ObjDesc->IndexField.Value = (UINT32) (Info->FieldBitPosition /
MUL_8 (ObjDesc->Field.AccessByteWidth));
ObjDesc->IndexField.Value = (UINT32)
(Info->FieldBitPosition / ACPI_MUL_8 (ObjDesc->Field.AccessByteWidth));
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
@ -479,11 +510,18 @@ AcpiExPrepFieldValue (
AcpiUtAddReference (ObjDesc->IndexField.DataObj);
AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "IndexField: bitoff=%X off=%X gran=%X Index %p Data %p\n",
ObjDesc->IndexField.StartFieldBitOffset, ObjDesc->IndexField.BaseByteOffset,
ObjDesc->Field.AccessByteWidth, ObjDesc->IndexField.IndexObj,
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"IndexField: bitoff=%X off=%X gran=%X Index %p Data %p\n",
ObjDesc->IndexField.StartFieldBitOffset,
ObjDesc->IndexField.BaseByteOffset,
ObjDesc->Field.AccessByteWidth,
ObjDesc->IndexField.IndexObj,
ObjDesc->IndexField.DataObj));
break;
default:
/* No other types should get here */
break;
}
/*
@ -493,8 +531,8 @@ AcpiExPrepFieldValue (
Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
AcpiNsGetType (Info->FieldNode));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set NamedObj %p (%4.4s) val = %p\n",
Info->FieldNode, (char *) &(Info->FieldNode->Name), ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set NamedObj %p (%4.4s) val = %p\n",
Info->FieldNode, Info->FieldNode->Name.Ascii, ObjDesc));
/* Remove local reference to the object */

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
* $Revision: 1.69 $
* $Revision: 1.75 $
*
*****************************************************************************/
@ -120,14 +120,10 @@
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exregion")
ACPI_MODULE_NAME ("exregion")
/*******************************************************************************
@ -161,9 +157,10 @@ AcpiExSystemMemorySpaceHandler (
void *LogicalAddrPtr = NULL;
ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
UINT32 Length;
UINT32 WindowSize;
FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
/* Validate and translate the bit width */
@ -192,7 +189,6 @@ AcpiExSystemMemorySpaceHandler (
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/*
* Does the request fit into the cached memory mapping?
* Is 1) Address below the current mapping? OR
@ -214,24 +210,32 @@ AcpiExSystemMemorySpaceHandler (
MemInfo->MappedLength);
}
MemInfo->MappedLength = 0; /* In case of failure below */
/*
* Don't attempt to map memory beyond the end of the region, and
* constrain the maximum mapping size to something reasonable.
*/
WindowSize = (UINT32) ((MemInfo->Address + MemInfo->Length) - Address);
if (WindowSize > SYSMEM_REGION_WINDOW_SIZE)
{
WindowSize = SYSMEM_REGION_WINDOW_SIZE;
}
/* Create a new mapping starting at the address given */
Status = AcpiOsMapMemory (Address, SYSMEM_REGION_WINDOW_SIZE,
Status = AcpiOsMapMemory (Address, WindowSize,
(void **) &MemInfo->MappedLogicalAddress);
if (ACPI_FAILURE (Status))
{
MemInfo->MappedLength = 0;
return_ACPI_STATUS (Status);
}
/* Save the physical address and mapping size */
MemInfo->MappedPhysicalAddress = Address;
MemInfo->MappedLength = SYSMEM_REGION_WINDOW_SIZE;
MemInfo->MappedLength = WindowSize;
}
/*
* Generate a logical pointer corresponding to the address we want to
* access
@ -241,7 +245,7 @@ AcpiExSystemMemorySpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
HIDWORD (Address), LODWORD (Address)));
ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Perform the memory read or write */
@ -249,6 +253,7 @@ AcpiExSystemMemorySpaceHandler (
{
case ACPI_READ:
*Value = 0;
switch (BitWidth)
{
case 8:
@ -256,15 +261,19 @@ AcpiExSystemMemorySpaceHandler (
break;
case 16:
MOVE_UNALIGNED16_TO_32 (Value, LogicalAddrPtr);
ACPI_MOVE_UNALIGNED16_TO_16 (Value, LogicalAddrPtr);
break;
case 32:
MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr);
ACPI_MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr);
break;
case 64:
MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr);
ACPI_MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr);
break;
default:
/* BitWidth was already validated */
break;
}
break;
@ -278,15 +287,19 @@ AcpiExSystemMemorySpaceHandler (
break;
case 16:
MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value);
ACPI_MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value);
break;
case 32:
MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value);
ACPI_MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value);
break;
case 64:
MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value);
ACPI_MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value);
break;
default:
/* BitWidth was already validated */
break;
}
break;
@ -330,12 +343,12 @@ AcpiExSystemIoSpaceHandler (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExSystemIoSpaceHandler");
ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
HIDWORD (Address), LODWORD (Address)));
ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Decode the function parameter */
@ -393,7 +406,7 @@ AcpiExPciConfigSpaceHandler (
UINT16 PciRegister;
FUNCTION_TRACE ("ExPciConfigSpaceHandler");
ACPI_FUNCTION_TRACE ("ExPciConfigSpaceHandler");
/*
@ -469,7 +482,7 @@ AcpiExCmosSpaceHandler (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExCmosSpaceHandler");
ACPI_FUNCTION_TRACE ("ExCmosSpaceHandler");
return_ACPI_STATUS (Status);
@ -506,7 +519,7 @@ AcpiExPciBarSpaceHandler (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExPciBarSpaceHandler");
ACPI_FUNCTION_TRACE ("ExPciBarSpaceHandler");
return_ACPI_STATUS (Status);
@ -541,12 +554,12 @@ AcpiExDataTableSpaceHandler (
void *RegionContext)
{
ACPI_STATUS Status = AE_OK;
UINT32 ByteWidth = DIV_8 (BitWidth);
UINT32 ByteWidth = ACPI_DIV_8 (BitWidth);
UINT32 i;
char *LogicalAddrPtr;
FUNCTION_TRACE ("ExDataTableSpaceHandler");
ACPI_FUNCTION_TRACE ("ExDataTableSpaceHandler");
LogicalAddrPtr = ACPI_PHYSADDR_TO_PTR (Address);
@ -565,6 +578,7 @@ AcpiExDataTableSpaceHandler (
break;
case ACPI_WRITE:
default:
return_ACPI_STATUS (AE_SUPPORT);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 1.48 $
* $Revision: 1.53 $
*
*****************************************************************************/
@ -119,16 +119,13 @@
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exresnte")
ACPI_MODULE_NAME ("exresnte")
/*******************************************************************************
@ -136,7 +133,7 @@
* FUNCTION: AcpiExResolveNodeToValue
*
* PARAMETERS: ObjectPtr - Pointer to a location that contains
* a pointer to a NS node, and will recieve a
* a pointer to a NS node, and will receive a
* pointer to the resolved object.
* WalkState - Current state. Valid only if executing AML
* code. NULL if simply resolving an object
@ -171,7 +168,7 @@ AcpiExResolveNodeToValue (
ACPI_INTEGER TempVal;
FUNCTION_TRACE ("ExResolveNodeToValue");
ACPI_FUNCTION_TRACE ("ExResolveNodeToValue");
/*
@ -218,10 +215,14 @@ AcpiExResolveNodeToValue (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
Status = AcpiDsGetPackageArguments (SourceDesc);
if (ACPI_SUCCESS (Status))
{
/* Return an additional reference to the object */
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
}
break;
@ -234,10 +235,14 @@ AcpiExResolveNodeToValue (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Return an additional reference to the object */
Status = AcpiDsGetBufferArguments (SourceDesc);
if (ACPI_SUCCESS (Status))
{
/* Return an additional reference to the object */
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
}
break;
@ -281,7 +286,7 @@ AcpiExResolveNodeToValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead Node=%p SourceDesc=%p Type=%X\n",
Node, SourceDesc, EntryType));
Status = AcpiExReadDataFromField (SourceDesc, &ObjDesc);
Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
break;
/*

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 1.105 $
* $Revision: 1.110 $
*
*****************************************************************************/
@ -119,16 +119,12 @@
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exresolv")
ACPI_MODULE_NAME ("exresolv")
/*******************************************************************************
@ -154,7 +150,7 @@ AcpiExResolveToValue (
ACPI_STATUS Status;
FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
if (!StackPtr || !*StackPtr)
@ -191,7 +187,7 @@ AcpiExResolveToValue (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved object %p\n", *StackPtr));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *StackPtr));
return_ACPI_STATUS (AE_OK);
}
@ -223,7 +219,7 @@ AcpiExResolveObjectToValue (
UINT16 Opcode;
FUNCTION_TRACE ("ExResolveObjectToValue");
ACPI_FUNCTION_TRACE ("ExResolveObjectToValue");
StackDesc = *StackPtr;
@ -277,7 +273,7 @@ AcpiExResolveObjectToValue (
AcpiUtRemoveReference (StackDesc);
*StackPtr = ObjDesc;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "[Arg/Local %d] ValueObj is %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %d] ValueObj is %p\n",
StackDesc->Reference.Offset, ObjDesc));
break;
@ -319,6 +315,10 @@ AcpiExResolveObjectToValue (
case AML_REVISION_OP:
ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
break;
default:
/* No other opcodes can get here */
break;
}
/*
@ -395,6 +395,19 @@ AcpiExResolveObjectToValue (
break; /* case INTERNAL_TYPE_REFERENCE */
case ACPI_TYPE_BUFFER:
Status = AcpiDsGetBufferArguments (StackDesc);
break;
case ACPI_TYPE_PACKAGE:
Status = AcpiDsGetPackageArguments (StackDesc);
break;
/*
* These cases may never happen here, but just in case..
*/
@ -406,7 +419,7 @@ AcpiExResolveObjectToValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
StackDesc, StackDesc->Common.Type));
Status = AcpiExReadDataFromField (StackDesc, &ObjDesc);
Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
*StackPtr = (void *) ObjDesc;
break;

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 1.46 $
* $Revision: 1.49 $
*
*****************************************************************************/
@ -120,15 +120,12 @@
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exresop")
ACPI_MODULE_NAME ("exresop")
/*******************************************************************************
@ -151,7 +148,7 @@ AcpiExCheckObjectType (
ACPI_OBJECT_TYPE ThisType,
void *Object)
{
PROC_NAME ("ExCheckObjectType");
ACPI_FUNCTION_NAME ("ExCheckObjectType");
if (TypeNeeded == ACPI_TYPE_ANY)
@ -163,7 +160,7 @@ AcpiExCheckObjectType (
if (TypeNeeded != ThisType)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed [%s], found [%s] %p\n",
AcpiUtGetTypeName (TypeNeeded),
AcpiUtGetTypeName (ThisType), Object));
@ -213,7 +210,7 @@ AcpiExResolveOperands (
ACPI_OBJECT_TYPE TypeNeeded;
FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@ -231,8 +228,8 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X OperandTypes=%X \n",
Opcode, ArgTypes));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] OperandTypes=%X \n",
Opcode, OpInfo->Name, ArgTypes));
/*
* Normal exit is with (ArgTypes == 0) at end of argument list.
@ -306,7 +303,7 @@ AcpiExResolveOperands (
case AML_LOCAL_OP:
case AML_REVISION_OP:
DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Reference Opcode: %s\n", OpInfo->Name)));
break;
@ -358,6 +355,7 @@ AcpiExResolveOperands (
}
/* Else not a string - fall through to the normal Reference case below */
/*lint -fallthrough */
case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
@ -409,6 +407,10 @@ AcpiExResolveOperands (
goto NextOperand;
}
break;
default:
/* All cases covered above */
break;
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 1.160 $
* $Revision: 1.164 $
*
*****************************************************************************/
@ -118,16 +118,14 @@
#define __EXSTORE_C__
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exstore")
ACPI_MODULE_NAME ("exstore")
/*******************************************************************************
@ -160,7 +158,7 @@ AcpiExStore (
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
FUNCTION_TRACE_PTR ("ExStore", DestDesc);
ACPI_FUNCTION_TRACE_PTR ("ExStore", DestDesc);
/* Validate parameters */
@ -194,9 +192,9 @@ AcpiExStore (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Destination is not a ReferenceObj [%p]\n", DestDesc));
DUMP_STACK_ENTRY (SourceDesc);
DUMP_STACK_ENTRY (DestDesc);
DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "ExStore",
ACPI_DUMP_STACK_ENTRY (SourceDesc);
ACPI_DUMP_STACK_ENTRY (DestDesc);
ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore",
2, "Target is not a ReferenceObj");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@ -246,7 +244,7 @@ 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_INFO, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
AcpiUtGetTypeName (SourceDesc->Common.Type)));
@ -256,7 +254,8 @@ AcpiExStore (
case ACPI_TYPE_INTEGER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%8.8X%8.8X\n",
HIWORD (SourceDesc->Integer.Value), LOWORD (SourceDesc->Integer.Value)));
ACPI_HIWORD (SourceDesc->Integer.Value),
ACPI_LOWORD (SourceDesc->Integer.Value)));
break;
@ -287,7 +286,7 @@ AcpiExStore (
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
break;
@ -307,7 +306,7 @@ AcpiExStore (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n",
RefDesc->Reference.Opcode));
DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
Status = AE_AML_INTERNAL;
break;
@ -344,7 +343,7 @@ AcpiExStoreObjectToIndex (
UINT8 Value = 0;
FUNCTION_TRACE ("ExStoreObjectToIndex");
ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
/*
@ -429,7 +428,7 @@ AcpiExStoreObjectToIndex (
case ACPI_TYPE_STRING:
Value = SourceDesc->String.Pointer[0];
Value = (UINT8) SourceDesc->String.Pointer[0];
break;
default:
@ -496,7 +495,7 @@ AcpiExStoreObjectToNode (
ACPI_OBJECT_TYPE TargetType;
FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
/*
@ -505,7 +504,7 @@ AcpiExStoreObjectToNode (
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
Node, AcpiUtGetTypeName (TargetType)));
@ -561,7 +560,7 @@ AcpiExStoreObjectToNode (
*/
Status = AcpiNsAttachObject (Node, NewDesc, TargetType);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
AcpiUtGetTypeName (SourceDesc->Common.Type),
AcpiUtGetTypeName (NewDesc->Common.Type)));
@ -571,7 +570,7 @@ AcpiExStoreObjectToNode (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Storing %s (%p) directly into node (%p), no implicit conversion\n",
AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc, Node));

View File

@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 1.45 $
* $Revision: 1.48 $
*
*****************************************************************************/
@ -119,16 +119,11 @@
#define __EXSTOREN_C__
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exstoren")
ACPI_MODULE_NAME ("exstoren")
/*******************************************************************************
@ -156,7 +151,7 @@ AcpiExResolveObject (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExResolveObject");
ACPI_FUNCTION_TRACE ("ExResolveObject");
/*
@ -241,7 +236,7 @@ AcpiExResolveObject (
* FUNCTION: AcpiExStoreObjectToObject
*
* PARAMETERS: SourceDesc - Object to store
* DestDesc - Object to recieve a copy of the source
* DestDesc - Object to receive a copy of the source
* NewDesc - New object if DestDesc is obsoleted
* WalkState - Current walk state
*
@ -282,7 +277,7 @@ AcpiExStoreObjectToObject (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("AcpiExStoreObjectToObject", SourceDesc);
ACPI_FUNCTION_TRACE_PTR ("AcpiExStoreObjectToObject", SourceDesc);
ActualSrcDesc = SourceDesc;

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 1.39 $
* $Revision: 1.43 $
*
*****************************************************************************/
@ -118,16 +118,11 @@
#define __EXSTOROB_C__
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exstorob")
ACPI_MODULE_NAME ("exstorob")
/*******************************************************************************
@ -152,7 +147,7 @@ AcpiExStoreBufferToBuffer (
UINT8 *Buffer;
PROC_NAME ("ExStoreBufferToBuffer");
ACPI_FUNCTION_NAME ("ExStoreBufferToBuffer");
/*
@ -184,8 +179,8 @@ AcpiExStoreBufferToBuffer (
{
/* Clear existing buffer and copy in the new one */
MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
}
else
@ -193,13 +188,17 @@ AcpiExStoreBufferToBuffer (
/*
* Truncate the source, copy only what will fit
*/
MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Truncating src buffer from %X to %X\n",
Length, TargetDesc->Buffer.Length));
}
/* Copy flags */
TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags;
return (AE_OK);
}
@ -226,7 +225,7 @@ AcpiExStoreStringToString (
UINT8 *Buffer;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/*
@ -242,8 +241,8 @@ AcpiExStoreStringToString (
{
/* Clear old string and copy in the new one */
MEMSET (TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
ACPI_MEMSET (TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
else
@ -268,7 +267,7 @@ AcpiExStoreStringToString (
}
TargetDesc->String.Length = Length;
MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
return (AE_OK);

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
* $Revision: 1.70 $
* $Revision: 1.72 $
*
*****************************************************************************/
@ -119,12 +119,10 @@
#include "acpi.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "achware.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exsystem")
ACPI_MODULE_NAME ("exsystem")
/*******************************************************************************
@ -151,7 +149,7 @@ AcpiExSystemWaitSemaphore (
ACPI_STATUS Status2;
FUNCTION_TRACE ("ExSystemWaitSemaphore");
ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
@ -205,7 +203,7 @@ AcpiExSystemDoStall (
ACPI_STATUS Status = AE_OK;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if (HowLong > 1000) /* 1 millisecond */
@ -249,7 +247,7 @@ AcpiExSystemDoSuspend (
ACPI_STATUS Status;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
@ -289,7 +287,7 @@ AcpiExSystemAcquireMutex (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
if (!ObjDesc)
@ -334,7 +332,7 @@ AcpiExSystemReleaseMutex (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExSystemReleaseMutex");
ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
if (!ObjDesc)
@ -376,7 +374,7 @@ AcpiExSystemSignalEvent (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExSystemSignalEvent");
ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
if (ObjDesc)
@ -411,7 +409,7 @@ AcpiExSystemWaitEvent (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE ("ExSystemWaitEvent");
ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
if (ObjDesc)
@ -444,7 +442,7 @@ AcpiExSystemResetEvent (
void *TempSemaphore;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/*

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 1.91 $
* $Revision: 1.94 $
*
*****************************************************************************/
@ -134,15 +134,12 @@
#define DEFINE_AML_GLOBALS
#include "acpi.h"
#include "acparser.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exutils")
ACPI_MODULE_NAME ("exutils")
/*******************************************************************************
@ -161,13 +158,13 @@ AcpiExEnterInterpreter (void)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("ExEnterInterpreter");
ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
if (ACPI_FAILURE (Status))
{
REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n"));
}
return_ACPI_STATUS (Status);
@ -197,10 +194,13 @@ AcpiExEnterInterpreter (void)
void
AcpiExExitInterpreter (void)
{
FUNCTION_TRACE ("ExExitInterpreter");
ACPI_STATUS Status;
AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
ACPI_FUNCTION_TRACE ("ExExitInterpreter");
Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
return_VOID;
}
@ -221,7 +221,7 @@ AcpiExValidateObjectType (
ACPI_OBJECT_TYPE Type)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
@ -255,7 +255,7 @@ AcpiExTruncateFor32bitTable (
ACPI_WALK_STATE *WalkState)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/*
@ -303,7 +303,7 @@ AcpiExAcquireGlobalLock (
ACPI_STATUS Status;
FUNCTION_TRACE ("ExAcquireGlobalLock");
ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
/* Only attempt lock if the AlwaysLock bit is set */
@ -341,12 +341,14 @@ AcpiExAcquireGlobalLock (
*
******************************************************************************/
ACPI_STATUS
void
AcpiExReleaseGlobalLock (
BOOLEAN LockedByMe)
{
ACPI_STATUS Status;
FUNCTION_TRACE ("ExReleaseGlobalLock");
ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
/* Only attempt unlock if the caller locked it */
@ -355,10 +357,14 @@ AcpiExReleaseGlobalLock (
{
/* OK, now release the lock */
AcpiEvReleaseGlobalLock ();
}
Status = AcpiEvReleaseGlobalLock ();
if (ACPI_FAILURE (Status))
{
/* Report the error, but there isn't much else we can do */
return_ACPI_STATUS (AE_OK);
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
}
}
}
@ -381,12 +387,12 @@ AcpiExDigitsNeeded (
UINT32 NumDigits = 0;
FUNCTION_TRACE ("ExDigitsNeeded");
ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
if (Base < 1)
{
REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n"));
ACPI_REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n"));
}
else
{
@ -430,7 +436,7 @@ _ntohl (
} In;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
In.Value = Value;
@ -455,7 +461,7 @@ _ntohl (
*
******************************************************************************/
ACPI_STATUS
void
AcpiExEisaIdToString (
UINT32 NumericId,
NATIVE_CHAR *OutString)
@ -463,7 +469,7 @@ AcpiExEisaIdToString (
UINT32 id;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/* swap to big-endian to get contiguous bits */
@ -473,13 +479,11 @@ AcpiExEisaIdToString (
OutString[0] = (char) ('@' + ((id >> 26) & 0x1f));
OutString[1] = (char) ('@' + ((id >> 21) & 0x1f));
OutString[2] = (char) ('@' + ((id >> 16) & 0x1f));
OutString[3] = AcpiUtHexToAsciiChar (id, 12);
OutString[4] = AcpiUtHexToAsciiChar (id, 8);
OutString[5] = AcpiUtHexToAsciiChar (id, 4);
OutString[6] = AcpiUtHexToAsciiChar (id, 0);
OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) id, 12);
OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) id, 8);
OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) id, 4);
OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) id, 0);
OutString[7] = 0;
return (AE_OK);
}
@ -504,7 +508,7 @@ AcpiExUnsignedIntegerToString (
UINT32 Remainder;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
DigitsNeeded = AcpiExDigitsNeeded (Value, 10);
@ -512,7 +516,7 @@ AcpiExUnsignedIntegerToString (
for (Count = DigitsNeeded; Count > 0; Count--)
{
AcpiUtShortDivide (&Value, 10, &Value, &Remainder);
(void) AcpiUtShortDivide (&Value, 10, &Value, &Remainder);
OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
* $Revision: 1.56 $
* $Revision: 1.60 $
*
*****************************************************************************/
@ -122,7 +122,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("psargs")
ACPI_MODULE_NAME ("psargs")
/*******************************************************************************
@ -146,10 +146,10 @@ AcpiPsGetNextPackageLength (
UINT32 Length = 0;
FUNCTION_TRACE ("PsGetNextPackageLength");
ACPI_FUNCTION_TRACE ("PsGetNextPackageLength");
EncodedLength = (UINT32) GET8 (ParserState->Aml);
EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
@ -163,7 +163,7 @@ AcpiPsGetNextPackageLength (
case 1: /* 2-byte encoding (next byte + bits 0-3) */
Length = ((GET8 (ParserState->Aml) << 04) |
Length = ((ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml++;
break;
@ -171,8 +171,8 @@ AcpiPsGetNextPackageLength (
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
Length = ((GET8 (ParserState->Aml + 1) << 12) |
(GET8 (ParserState->Aml) << 04) |
Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) |
(ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml += 2;
break;
@ -180,12 +180,16 @@ AcpiPsGetNextPackageLength (
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
Length = ((GET8 (ParserState->Aml + 2) << 20) |
(GET8 (ParserState->Aml + 1) << 12) |
(GET8 (ParserState->Aml) << 04) |
Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) |
(ACPI_GET8 (ParserState->Aml + 1) << 12) |
(ACPI_GET8 (ParserState->Aml) << 04) |
(EncodedLength & 0x0F));
ParserState->Aml += 3;
break;
default:
/* Can't get here, only 2 bits / 4 cases */
break;
}
return_VALUE (Length);
@ -213,7 +217,7 @@ AcpiPsGetNextPackageEnd (
NATIVE_UINT Length;
FUNCTION_TRACE ("PsGetNextPackageEnd");
ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd");
Length = (NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState);
@ -246,12 +250,12 @@ AcpiPsGetNextNamestring (
UINT32 Length;
FUNCTION_TRACE ("PsGetNextNamestring");
ACPI_FUNCTION_TRACE ("PsGetNextNamestring");
/* Handle multiple prefix characters */
while (AcpiPsIsPrefixChar (GET8 (End)))
while (AcpiPsIsPrefixChar (ACPI_GET8 (End)))
{
/* include prefix '\\' or '^' */
@ -260,7 +264,7 @@ AcpiPsGetNextNamestring (
/* Decode the path */
switch (GET8 (End))
switch (ACPI_GET8 (End))
{
case 0:
@ -286,7 +290,7 @@ AcpiPsGetNextNamestring (
/* multiple name segments */
Length = (UINT32) GET8 (End + 1) * 4;
Length = (UINT32) ACPI_GET8 (End + 1) * 4;
End += 2 + Length;
break;
@ -343,7 +347,7 @@ AcpiPsGetNextNamepath (
ACPI_PARSE_OBJECT *Count;
FUNCTION_TRACE ("PsGetNextNamepath");
ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
Path = AcpiPsGetNextNamestring (ParserState);
@ -352,7 +356,7 @@ AcpiPsGetNextNamepath (
/* Null name case, create a null namepath object */
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Value.Name = Path;
Arg->Common.Value.Name = Path;
return_VOID;
}
@ -371,7 +375,7 @@ AcpiPsGetNextNamepath (
if (Op)
{
if (Op->Opcode == AML_METHOD_OP)
if (Op->Common.AmlOpcode == AML_METHOD_OP)
{
/*
* The name refers to a control method, so this namepath is a
@ -380,7 +384,7 @@ AcpiPsGetNextNamepath (
* object into a METHODCALL object.
*/
Count = AcpiPsGetArg (Op, 0);
if (Count && Count->Opcode == AML_BYTE_OP)
if (Count && Count->Common.AmlOpcode == AML_BYTE_OP)
{
NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
if (NameOp)
@ -389,14 +393,14 @@ AcpiPsGetNextNamepath (
AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
NameOp->Value.Name = Path;
NameOp->Common.Value.Name = Path;
/* Point METHODCALL/NAME to the METHOD Node */
NameOp->Node = (ACPI_NAMESPACE_NODE *) Op;
NameOp->Common.Node = (ACPI_NAMESPACE_NODE *) Op;
AcpiPsAppendArg (Arg, NameOp);
*ArgCount = (UINT32) Count->Value.Integer &
*ArgCount = (UINT32) Count->Common.Value.Integer &
METHOD_FLAGS_ARG_COUNT;
}
}
@ -418,7 +422,7 @@ AcpiPsGetNextNamepath (
* pathname
*/
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Value.Name = Path;
Arg->Common.Value.Name = Path;
return_VOID;
@ -443,7 +447,7 @@ AcpiPsGetNextNamepath (
ACPI_GENERIC_STATE ScopeInfo;
FUNCTION_TRACE ("PsGetNextNamepath");
ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
Path = AcpiPsGetNextNamestring (ParserState);
@ -452,71 +456,67 @@ AcpiPsGetNextNamepath (
/* Null name case, create a null namepath object */
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Value.Name = Path;
Arg->Common.Value.Name = Path;
return_VOID;
}
if (MethodCall)
/*
* Lookup the name in the internal namespace
*/
ScopeInfo.Scope.Node = NULL;
Node = ParserState->StartNode;
if (Node)
{
/*
* Lookup the name in the internal namespace
*/
ScopeInfo.Scope.Node = NULL;
Node = ParserState->StartNode;
if (Node)
{
ScopeInfo.Scope.Node = Node;
}
ScopeInfo.Scope.Node = Node;
}
/*
* Lookup object. We don't want to add anything new to the namespace
* here, however. So we use MODE_EXECUTE. Allow searching of the
* parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch)
*/
Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, IMODE_EXECUTE,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL,
&Node);
if (ACPI_SUCCESS (Status))
/*
* Lookup object. We don't want to add anything new to the namespace
* here, however. So we use MODE_EXECUTE. Allow searching of the
* parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch)
*/
Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
&Node);
if (ACPI_SUCCESS (Status))
{
if (Node->Type == ACPI_TYPE_METHOD)
{
if (Node->Type == ACPI_TYPE_METHOD)
MethodNode = Node;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
MethodNode, Path));
NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
if (NameOp)
{
MethodNode = Node;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
MethodNode, Path));
/* Change arg into a METHOD CALL and attach name to it */
NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
if (NameOp)
AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
NameOp->Common.Value.Name = Path;
/* Point METHODCALL/NAME to the METHOD Node */
NameOp->Common.Node = MethodNode;
AcpiPsAppendArg (Arg, NameOp);
if (!AcpiNsGetAttachedObject (MethodNode))
{
/* Change arg into a METHOD CALL and attach name to it */
AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
NameOp->Value.Name = Path;
/* Point METHODCALL/NAME to the METHOD Node */
NameOp->Node = MethodNode;
AcpiPsAppendArg (Arg, NameOp);
if (!AcpiNsGetAttachedObject (MethodNode))
{
return_VOID;
}
*ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount;
return_VOID;
}
return_VOID;
*ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount;
}
/*
* Else this is normal named object reference.
* Just init the NAMEPATH object with the pathname.
* (See code below)
*/
return_VOID;
}
/*
* Else this is normal named object reference.
* Just init the NAMEPATH object with the pathname.
* (See code below)
*/
}
/*
@ -525,7 +525,7 @@ AcpiPsGetNextNamepath (
* pathname.
*/
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Value.Name = Path;
Arg->Common.Value.Name = Path;
return_VOID;
@ -554,16 +554,15 @@ AcpiPsGetNextSimpleArg (
ACPI_PARSE_OBJECT *Arg)
{
FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
switch (ArgType)
{
case ARGP_BYTEDATA:
AcpiPsInitOp (Arg, AML_BYTE_OP);
Arg->Value.Integer = (UINT32) GET8 (ParserState->Aml);
Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
@ -574,7 +573,7 @@ AcpiPsGetNextSimpleArg (
/* Get 2 bytes from the AML stream */
MOVE_UNALIGNED16_TO_32 (&Arg->Value.Integer, ParserState->Aml);
ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 2;
break;
@ -585,7 +584,7 @@ AcpiPsGetNextSimpleArg (
/* Get 4 bytes from the AML stream */
MOVE_UNALIGNED32_TO_32 (&Arg->Value.Integer, ParserState->Aml);
ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 4;
break;
@ -596,7 +595,7 @@ AcpiPsGetNextSimpleArg (
/* Get 8 bytes from the AML stream */
MOVE_UNALIGNED64_TO_64 (&Arg->Value.Integer, ParserState->Aml);
ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
ParserState->Aml += 8;
break;
@ -604,9 +603,9 @@ AcpiPsGetNextSimpleArg (
case ARGP_CHARLIST:
AcpiPsInitOp (Arg, AML_STRING_OP);
Arg->Value.String = (char*) ParserState->Aml;
Arg->Common.Value.String = (char *) ParserState->Aml;
while (GET8 (ParserState->Aml) != '\0')
while (ACPI_GET8 (ParserState->Aml) != '\0')
{
ParserState->Aml++;
}
@ -618,7 +617,12 @@ AcpiPsGetNextSimpleArg (
case ARGP_NAMESTRING:
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Value.Name = AcpiPsGetNextNamestring (ParserState);
Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
break;
default:
ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType));
break;
}
@ -642,34 +646,31 @@ ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
UINT32 AmlOffset = ParserState->Aml -
ParserState->AmlStart;
UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
ParserState->AmlStart);
ACPI_PARSE_OBJECT *Field;
UINT16 Opcode;
UINT32 Name;
FUNCTION_TRACE ("PsGetNextField");
ACPI_FUNCTION_TRACE ("PsGetNextField");
/* determine field type */
switch (GET8 (ParserState->Aml))
switch (ACPI_GET8 (ParserState->Aml))
{
default:
Opcode = AML_INT_NAMEDFIELD_OP;
break;
case 0x00:
Opcode = AML_INT_RESERVEDFIELD_OP;
ParserState->Aml++;
break;
case 0x01:
Opcode = AML_INT_ACCESSFIELD_OP;
@ -681,48 +682,54 @@ AcpiPsGetNextField (
/* Allocate a new field op */
Field = AcpiPsAllocOp (Opcode);
if (Field)
if (!Field)
{
Field->AmlOffset = AmlOffset;
return_PTR (NULL);
}
/* Decode the field type */
Field->Common.AmlOffset = AmlOffset;
switch (Opcode)
{
case AML_INT_NAMEDFIELD_OP:
/* Decode the field type */
/* Get the 4-character name */
switch (Opcode)
{
case AML_INT_NAMEDFIELD_OP:
MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml);
AcpiPsSetName (Field, Name);
ParserState->Aml += 4;
/* Get the 4-character name */
/* Get the length which is encoded as a package length */
ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml);
AcpiPsSetName (Field, Name);
ParserState->Aml += 4;
Field->Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
/* Get the length which is encoded as a package length */
Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
case AML_INT_RESERVEDFIELD_OP:
case AML_INT_RESERVEDFIELD_OP:
/* Get the length which is encoded as a package length */
/* Get the length which is encoded as a package length */
Field->Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
break;
case AML_INT_ACCESSFIELD_OP:
case AML_INT_ACCESSFIELD_OP:
/*
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
Field->Value.Integer32 = (GET8 (ParserState->Aml) << 8);
ParserState->Aml++;
Field->Value.Integer32 |= GET8 (ParserState->Aml);
ParserState->Aml++;
break;
}
/*
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
Field->Common.Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8);
ParserState->Aml++;
Field->Common.Value.Integer32 |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
break;
default:
/* Opcode was set in previous switch */
break;
}
return_PTR (Field);
@ -757,7 +764,7 @@ AcpiPsGetNextArg (
UINT32 Subop;
FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
switch (ArgType)
@ -803,7 +810,7 @@ AcpiPsGetNextArg (
if (Prev)
{
Prev->Next = Field;
Prev->Common.Next = Field;
}
else
@ -832,8 +839,8 @@ AcpiPsGetNextArg (
{
/* fill in bytelist data */
Arg->Value.Size = (ParserState->PkgEnd - ParserState->Aml);
((ACPI_PARSE2_OBJECT *) Arg)->Data = ParserState->Aml;
Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml);
Arg->Named.Data = ParserState->Aml;
}
/* skip to End of byte data */
@ -891,6 +898,10 @@ AcpiPsGetNextArg (
*ArgCount = ACPI_VAR_ARGS;
}
break;
default:
ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType));
break;
}
return_PTR (Arg);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 1.63 $
* $Revision: 1.67 $
*
*****************************************************************************/
@ -121,7 +121,7 @@
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("psopcode")
ACPI_MODULE_NAME ("psopcode")
#define _UNK 0x6B
@ -136,9 +136,9 @@
#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
#define MAX_EXTENDED_OPCODE 0x88
#define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1
#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
#define MAX_INTERNAL_OPCODE
#define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1
#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
/*******************************************************************************
@ -310,7 +310,7 @@
#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BREAK_OP ARG_NONE
#define ARGI_BREAK_POINT_OP ARG_NONE
#define ARGI_BUFFER_OP ARGI_INVALID_OPCODE
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
@ -375,7 +375,7 @@
#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
#define ARGI_ONE_OP ARG_NONE
#define ARGI_ONES_OP ARG_NONE
#define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE
#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
@ -406,7 +406,7 @@
#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE
#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
#define ARGI_WORD_OP ARGI_INVALID_OPCODE
@ -513,6 +513,7 @@
AML_CREATE_DWORD_FIELD_OP
AML_CREATE_QWORD_FIELD_OP
AML_REGION_OP
AML_BUFFER_OP
Field opcodes
@ -552,8 +553,8 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
@ -664,7 +665,7 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER),
/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@ -678,6 +679,7 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] =
/* 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, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
/*! [End] no source code translation !*/
};
@ -697,7 +699,7 @@ static const UINT8 AcpiGbl_ShortOpIndex[256] =
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
@ -769,7 +771,7 @@ const ACPI_OPCODE_INFO *
AcpiPsGetOpcodeInfo (
UINT16 Opcode)
{
PROC_NAME ("PsGetOpcodeInfo");
ACPI_FUNCTION_NAME ("PsGetOpcodeInfo");
/*
@ -793,6 +795,7 @@ AcpiPsGetOpcodeInfo (
}
/* Else fall through to error case below */
/*lint -fallthrough */
default:

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 1.117 $
* $Revision: 1.123 $
*
*****************************************************************************/
@ -129,15 +129,13 @@
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("psparse")
ACPI_MODULE_NAME ("psparse")
UINT32 AcpiGbl_Depth = 0;
extern UINT32 AcpiGbl_ScopeDepth;
/*******************************************************************************
@ -191,7 +189,7 @@ AcpiPsPeekOpcode (
Aml = ParserState->Aml;
Opcode = (UINT16) GET8 (Aml);
Opcode = (UINT16) ACPI_GET8 (Aml);
if (Opcode == AML_EXTOP)
@ -199,7 +197,7 @@ AcpiPsPeekOpcode (
/* Extended opcode */
Aml++;
Opcode = (UINT16) ((Opcode << 8) | GET8 (Aml));
Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
}
return (Opcode);
@ -285,9 +283,16 @@ AcpiPsCompleteThisOp (
ACPI_PARSE_OBJECT *ReplacementOp = NULL;
FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
/* Check for null Op, can happen if AML code is corrupt */
if (!Op)
{
return_VALUE (TRUE);
}
/* Delete this op and the subtree below it if asked to */
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) &&
@ -295,13 +300,13 @@ AcpiPsCompleteThisOp (
{
/* Make sure that we only delete this subtree */
if (Op->Parent)
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->Parent->Opcode);
ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
switch (ParentInfo->Class)
{
@ -312,7 +317,7 @@ AcpiPsCompleteThisOp (
/*
* These opcodes contain TermArg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
@ -325,10 +330,13 @@ AcpiPsCompleteThisOp (
/*
* These opcodes contain TermArg operands. The current
* op must be replace by a placeholder return op
* op must be replaced by a placeholder return op
*/
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_DATA_REGION_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 (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
@ -336,6 +344,25 @@ AcpiPsCompleteThisOp (
return_VALUE (FALSE);
}
}
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_VALUE (FALSE);
}
ReplacementOp->Named.Data = Op->Named.Data;
ReplacementOp->Named.Length = Op->Named.Length;
}
}
break;
default:
@ -348,21 +375,22 @@ AcpiPsCompleteThisOp (
/* We must unlink this op from the parent tree */
Prev = Op->Parent->Value.Arg;
Prev = Op->Common.Parent->Common.Value.Arg;
if (Prev == Op)
{
/* This op is the first in the list */
if (ReplacementOp)
{
ReplacementOp->Parent = Op->Parent;
ReplacementOp->Value.Arg = NULL;
Op->Parent->Value.Arg = ReplacementOp;
ReplacementOp->Next = Op->Next;
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->Parent->Value.Arg = Op->Next;
Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
}
}
@ -372,20 +400,21 @@ AcpiPsCompleteThisOp (
{
/* Traverse all siblings in the parent's argument list */
Next = Prev->Next;
Next = Prev->Common.Next;
if (Next == Op)
{
if (ReplacementOp)
{
ReplacementOp->Parent = Op->Parent;
ReplacementOp->Value.Arg = NULL;
Prev->Next = ReplacementOp;
ReplacementOp->Next = Op->Next;
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->Next = Op->Next;
Prev->Common.Next = Op->Common.Next;
Next = NULL;
}
}
@ -415,9 +444,10 @@ AcpiPsCompleteThisOp (
*
* PARAMETERS: ParserState - Current parser state object
*
* RETURN:
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Update the parser state based upon the return exception from
* the parser callback.
*
******************************************************************************/
@ -431,7 +461,7 @@ AcpiPsNextParseState (
ACPI_STATUS Status = AE_CTRL_PENDING;
FUNCTION_TRACE_PTR ("PsNextParseState", Op);
ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
switch (CallbackStatus)
@ -503,7 +533,7 @@ AcpiPsNextParseState (
Status = AE_CTRL_TRANSFER;
WalkState->PrevOp = Op;
WalkState->MethodCallOp = Op;
WalkState->MethodCallNode = (Op->Value.Arg)->Node;
WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node;
/* Will return value (if any) be used by the caller? */
@ -546,17 +576,22 @@ AcpiPsParseLoop (
ACPI_PARSE_OBJECT *Arg = NULL;
ACPI_PARSE_OBJECT PreOp;
ACPI_PARSE_STATE *ParserState;
UINT8 *AmlOpStart;
UINT8 *AmlOpStart = NULL;
FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
if (WalkState->DescendingCallback == NULL)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
ParserState = &WalkState->ParserState;
WalkState->ArgTypes = 0;
#ifndef PARSER_ONLY
if (WalkState->WalkType & WALK_METHOD_RESTART)
if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
{
/* We are restarting a preempted control method */
@ -567,13 +602,12 @@ AcpiPsParseLoop (
* was just completed
*/
if ((ParserState->Scope->ParseScope.Op) &&
((ParserState->Scope->ParseScope.Op->Opcode == AML_IF_OP) ||
(ParserState->Scope->ParseScope.Op->Opcode == AML_WHILE_OP)) &&
((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
(ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
(WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
CONTROL_PREDICATE_EXECUTING))
ACPI_CONTROL_PREDICATE_EXECUTING))
{
/*
* A predicate was just completed, get the value of the
* predicate and branch based on that value
@ -601,7 +635,6 @@ AcpiPsParseLoop (
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
}
else if (WalkState->PrevOp)
{
/* We were in the middle of an op */
@ -617,13 +650,13 @@ AcpiPsParseLoop (
*/
while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
{
AmlOpStart = ParserState->Aml;
if (!Op)
{
/* Get the next opcode from the AML stream */
AmlOpStart = ParserState->Aml;
WalkState->AmlOffset = ParserState->Aml - ParserState->AmlStart;
WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart);
WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
/*
* First cut to determine what we have found:
@ -649,10 +682,10 @@ AcpiPsParseLoop (
/* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Found unknown opcode %X at AML offset %X, ignoring\n",
WalkState->Opcode, WalkState->AmlOffset));
"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
DUMP_BUFFER (ParserState->Aml, 128);
ACPI_DUMP_BUFFER (ParserState->Aml, 128);
/* Assume one-byte bad opcode */
@ -666,16 +699,14 @@ AcpiPsParseLoop (
ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
break;
}
/* Create Op structure and append to parent's argument list */
if (WalkState->OpInfo->Flags & AML_NAMED)
{
PreOp.Value.Arg = NULL;
PreOp.Opcode = WalkState->Opcode;
PreOp.Common.Value.Arg = NULL;
PreOp.Common.AmlOpcode = WalkState->Opcode;
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)
{
@ -686,49 +717,45 @@ AcpiPsParseLoop (
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/* We know that this arg is a name, move to next arg */
INCREMENT_ARG_LIST (WalkState->ArgTypes);
if (WalkState->DescendingCallback != NULL)
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = NULL;
Status = WalkState->DescendingCallback (WalkState, &Op);
if (ACPI_FAILURE (Status))
{
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = NULL;
Status = WalkState->DescendingCallback (WalkState, &Op);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
AcpiFormatException (Status)));
goto CloseThisOp;
}
if (Op == NULL)
{
continue;
}
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AE_OK;
goto CloseThisOp;
}
if (ACPI_FAILURE (Status))
{
goto CloseThisOp;
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
AcpiFormatException (Status)));
goto CloseThisOp;
}
AcpiPsAppendArg (Op, PreOp.Value.Arg);
if (Op == NULL)
{
continue;
}
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AE_OK;
goto CloseThisOp;
}
if (ACPI_FAILURE (Status))
{
goto CloseThisOp;
}
AcpiPsAppendArg (Op, PreOp.Common.Value.Arg);
AcpiGbl_Depth++;
if (Op->Opcode == AML_REGION_OP)
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
/*
* Defer final parsing of an OperationRegion body,
@ -742,11 +769,10 @@ AcpiPsParseLoop (
*
* (Length is unknown until parse of the body complete)
*/
((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart;
((ACPI_PARSE2_OBJECT * ) Op)->Length = 0;
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
}
else
{
/* Not a named opcode, just allocate Op and append to parent */
@ -764,8 +790,8 @@ AcpiPsParseLoop (
* Backup to beginning of CreateXXXfield declaration
* BodyLength is unknown until we parse the body
*/
((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart;
((ACPI_PARSE2_OBJECT * ) Op)->Length = 0;
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
@ -793,13 +819,14 @@ AcpiPsParseLoop (
}
}
Op->AmlOffset = WalkState->AmlOffset;
Op->Common.AmlOffset = WalkState->AmlOffset;
if (WalkState->OpInfo)
{
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
Op->Opcode, WalkState->OpInfo->Name, Op, ParserState->Aml, Op->AmlOffset));
Op->Common.AmlOpcode, WalkState->OpInfo->Name,
Op, ParserState->Aml, Op->Common.AmlOffset));
}
}
@ -810,9 +837,9 @@ AcpiPsParseLoop (
if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */
{
/* get arguments */
/* Get arguments */
switch (Op->Opcode)
switch (Op->Common.AmlOpcode)
{
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
case AML_WORD_OP: /* AML_WORDDATA_ARG */
@ -820,7 +847,7 @@ AcpiPsParseLoop (
case AML_QWORD_OP: /* AML_QWORDATA_ARG */
case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
/* fill in constant or string argument directly */
/* Fill in constant or string argument directly */
AcpiPsGetNextSimpleArg (ParserState,
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
@ -839,32 +866,33 @@ AcpiPsParseLoop (
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount)
{
WalkState->AmlOffset = ParserState->Aml - ParserState->AmlStart;
WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml,
ParserState->AmlStart);
Arg = AcpiPsGetNextArg (ParserState,
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
&WalkState->ArgCount);
if (Arg)
{
Arg->AmlOffset = WalkState->AmlOffset;
Arg->Common.AmlOffset = WalkState->AmlOffset;
AcpiPsAppendArg (Op, Arg);
}
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/* For a method, save the length and address of the body */
if (Op->Opcode == AML_METHOD_OP)
switch (Op->Common.AmlOpcode)
{
case AML_METHOD_OP:
/* For a method, save the length and address of the body */
/*
* Skip parsing of control method or opregion body,
* because we don't have enough info in the first pass
* to parse them correctly.
*/
((ACPI_PARSE2_OBJECT * ) Op)->Data = ParserState->Aml;
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd -
ParserState->Aml);
Op->Named.Data = ParserState->Aml;
Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml);
/*
* Skip body of method. For OpRegions, we must continue
* parsing because the opregion is not a standalone
@ -872,19 +900,47 @@ AcpiPsParseLoop (
*/
ParserState->Aml = ParserState->PkgEnd;
WalkState->ArgCount = 0;
}
else if (Op->Opcode == AML_WHILE_OP)
{
break;
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
if ((Op->Common.Parent) &&
(Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
(WalkState->DescendingCallback != AcpiDsExecBeginOp))
{
/*
* Skip parsing of
* because we don't have enough info in the first pass
* to parse them correctly.
*/
Op->Named.Data = AmlOpStart;
Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart);
/*
* Skip body
*/
ParserState->Aml = ParserState->PkgEnd;
WalkState->ArgCount = 0;
}
break;
case AML_WHILE_OP:
if (WalkState->ControlState)
{
WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd;
}
break;
default:
/* No action for all other opcodes */
break;
}
break;
}
}
/* Check for arguments that need to be processed */
if (WalkState->ArgCount)
@ -896,10 +952,9 @@ AcpiPsParseLoop (
continue;
}
/* All arguments have been processed -- Op is complete, prepare for next */
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (WalkState->OpInfo->Flags & AML_NAMED)
{
if (AcpiGbl_Depth)
@ -907,7 +962,7 @@ AcpiPsParseLoop (
AcpiGbl_Depth--;
}
if (Op->Opcode == AML_REGION_OP)
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
/*
* Skip parsing of control method or opregion body,
@ -917,8 +972,7 @@ AcpiPsParseLoop (
* Completed parsing an OpRegion declaration, we now
* know the length.
*/
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml -
((ACPI_PARSE2_OBJECT * ) Op)->Data);
Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
}
}
@ -930,8 +984,7 @@ AcpiPsParseLoop (
*
* BodyLength is unknown until we parse the body
*/
((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml -
((ACPI_PARSE2_OBJECT * ) Op)->Data);
Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
}
/* This op complete, notify the dispatcher */
@ -939,7 +992,7 @@ AcpiPsParseLoop (
if (WalkState->AscendingCallback != NULL)
{
WalkState->Op = Op;
WalkState->Opcode = Op->Opcode;
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
@ -985,8 +1038,8 @@ CloseThisOp:
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
@ -1002,7 +1055,7 @@ CloseThisOp:
/* Pop off scopes until we find the While */
while (!Op || (Op->Opcode != AML_WHILE_OP))
while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
{
AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount);
}
@ -1010,8 +1063,8 @@ CloseThisOp:
/* Close this iteration of the While loop */
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
@ -1097,8 +1150,8 @@ CloseThisOp:
if (WalkState->AscendingCallback != NULL)
{
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
@ -1171,7 +1224,7 @@ AcpiPsParseAml (
ACPI_WALK_STATE *PreviousWalkState;
FUNCTION_TRACE ("PsParseAml");
ACPI_FUNCTION_TRACE ("PsParseAml");
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with WalkState=%p Aml=%p size=%X\n",
WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize));
@ -1275,7 +1328,7 @@ AcpiPsParseAml (
* The object is deleted
*/
AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ReturnDesc);
WalkState->WalkType |= WALK_METHOD_RESTART;
WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
}
else
{
@ -1283,8 +1336,8 @@ AcpiPsParseAml (
AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status)));
DUMP_PATHNAME (WalkState->MethodNode, "Method pathname: ",
ACPI_REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status)));
ACPI_DUMP_PATHNAME (WalkState->MethodNode, "Method pathname: ",
ACPI_LV_ERROR, _COMPONENT);
}
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
* $Revision: 1.36 $
* $Revision: 1.39 $
*
*****************************************************************************/
@ -122,7 +122,7 @@
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("pstree")
ACPI_MODULE_NAME ("pstree")
/*******************************************************************************
@ -147,12 +147,12 @@ AcpiPsGetArg (
const ACPI_OPCODE_INFO *OpInfo;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
/* Get the info structure for this opcode */
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
/* Invalid opcode or ASCII character */
@ -171,11 +171,11 @@ AcpiPsGetArg (
/* Get the requested argument object */
Arg = Op->Value.Arg;
Arg = Op->Common.Value.Arg;
while (Arg && Argn)
{
Argn--;
Arg = Arg->Next;
Arg = Arg->Common.Next;
}
return (Arg);
@ -204,7 +204,7 @@ AcpiPsAppendArg (
const ACPI_OPCODE_INFO *OpInfo;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if (!Op)
@ -214,12 +214,13 @@ AcpiPsAppendArg (
/* Get the info structure for this opcode */
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
/* Invalid opcode */
REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", Op->Opcode));
ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n",
Op->Common.AmlOpcode));
return;
}
@ -235,23 +236,23 @@ AcpiPsAppendArg (
/* Append the argument to the linked argument list */
if (Op->Value.Arg)
if (Op->Common.Value.Arg)
{
/* Append to existing argument list */
PrevArg = Op->Value.Arg;
while (PrevArg->Next)
PrevArg = Op->Common.Value.Arg;
while (PrevArg->Common.Next)
{
PrevArg = PrevArg->Next;
PrevArg = PrevArg->Common.Next;
}
PrevArg->Next = Arg;
PrevArg->Common.Next = Arg;
}
else
{
/* No argument list, this will be the first argument */
Op->Value.Arg = Arg;
Op->Common.Value.Arg = Arg;
}
@ -259,8 +260,8 @@ AcpiPsAppendArg (
while (Arg)
{
Arg->Parent = Op;
Arg = Arg->Next;
Arg->Common.Parent = Op;
Arg = Arg->Common.Next;
}
}
@ -284,10 +285,10 @@ AcpiPsGetChild (
ACPI_PARSE_OBJECT *Child = NULL;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (Op->Opcode)
switch (Op->Common.AmlOpcode)
{
case AML_SCOPE_OP:
case AML_ELSE_OP:
@ -323,6 +324,10 @@ AcpiPsGetChild (
Child = AcpiPsGetArg (Op, 3);
break;
default:
/* All others have no children */
break;
}
return (Child);
@ -353,7 +358,7 @@ AcpiPsGetDepthNext (
ACPI_PARSE_OBJECT *Arg;
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if (!Op)
@ -371,7 +376,7 @@ AcpiPsGetDepthNext (
/* look for a sibling */
Next = Op->Next;
Next = Op->Common.Next;
if (Next)
{
return (Next);
@ -379,14 +384,14 @@ AcpiPsGetDepthNext (
/* look for a sibling of parent */
Parent = Op->Parent;
Parent = Op->Common.Parent;
while (Parent)
{
Arg = AcpiPsGetArg (Parent, 0);
while (Arg && (Arg != Origin) && (Arg != Op))
{
Arg = Arg->Next;
Arg = Arg->Common.Next;
}
if (Arg == Origin)
@ -396,14 +401,15 @@ AcpiPsGetDepthNext (
return (NULL);
}
if (Parent->Next)
if (Parent->Common.Next)
{
/* found sibling of parent */
return (Parent->Next);
return (Parent->Common.Next);
}
Op = Parent;
Parent = Parent->Parent;
Parent = Parent->Common.Parent;
}
return (Next);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
* $Revision: 1.62 $
* $Revision: 1.65 $
*
*****************************************************************************/
@ -116,14 +116,11 @@
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_PARSER
MODULE_NAME ("pswalk")
ACPI_MODULE_NAME ("pswalk")
/*******************************************************************************
@ -152,12 +149,12 @@ AcpiPsGetNextWalkOp (
ACPI_STATUS Status;
FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
ACPI_FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
/* Check for a argument only if we are descending in the tree */
if (WalkState->NextOpInfo != NEXT_OP_UPWARD)
if (WalkState->NextOpInfo != ACPI_NEXT_OP_UPWARD)
{
/* Look for an argument or child of the current op */
@ -168,7 +165,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (AE_OK);
}
@ -177,12 +174,12 @@ AcpiPsGetNextWalkOp (
* No more children, this Op is complete. Save Next and Parent
* in case the Op object gets deleted by the callback routine
*/
Next = Op->Next;
Parent = Op->Parent;
Next = Op->Common.Next;
Parent = Op->Common.Parent;
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = AscendingCallback (WalkState);
@ -209,7 +206,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Op;
WalkState->NextOp = Next;
WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Continue downward */
@ -239,12 +236,12 @@ AcpiPsGetNextWalkOp (
{
/* We are moving up the tree, therefore this parent Op is complete */
GrandParent = Parent->Parent;
Next = Parent->Next;
GrandParent = Parent->Common.Parent;
Next = Parent->Common.Next;
WalkState->Op = Parent;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Opcode);
WalkState->Opcode = Parent->Opcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Common.AmlOpcode);
WalkState->Opcode = Parent->Common.AmlOpcode;
Status = AscendingCallback (WalkState);
@ -271,7 +268,7 @@ AcpiPsGetNextWalkOp (
WalkState->PrevOp = Parent;
WalkState->NextOp = Next;
WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
return_ACPI_STATUS (Status);
}
@ -339,7 +336,7 @@ AcpiPsDeleteParseTree (
ACPI_THREAD_STATE *Thread;
FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
if (!SubtreeRoot)
@ -371,7 +368,7 @@ AcpiPsDeleteParseTree (
/* Head downward in the tree */
WalkState->NextOpInfo = NEXT_OP_DOWNWARD;
WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
/* Visit all nodes in the subtree */