Deployed new procedure to extract NS Node name and validate the node.

Prevents faults during debug output.


date	2003.10.21.23.30.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:56:40 +00:00
parent 03725ffc4f
commit dded904663
7 changed files with 1119 additions and 393 deletions

View File

@ -0,0 +1,316 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
* $Revision: 1.9 $
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __DSINIT_C__
#include "acpi.h"
#include "acdispat.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
/*******************************************************************************
*
* FUNCTION: AcpiDsInitOneObject
*
* PARAMETERS: ObjHandle - Node
* Level - Current nesting level
* Context - Points to a init info struct
* ReturnValue - Not used
*
* RETURN: Status
*
* DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
* within the namespace.
*
* Currently, the only objects that require initialization are:
* 1) Methods
* 2) Operation Regions
*
******************************************************************************/
ACPI_STATUS
AcpiDsInitOneObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_OBJECT_TYPE Type;
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
ACPI_FUNCTION_NAME ("DsInitOneObject");
/*
* We are only interested in objects owned by the table that
* was just loaded
*/
if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
Info->TableDesc->TableId)
{
return (AE_OK);
}
Info->ObjectCount++;
/* And even then, we are only interested in a few object types */
Type = AcpiNsGetType (ObjHandle);
switch (Type)
{
case ACPI_TYPE_REGION:
Status = AcpiDsInitializeRegion (ObjHandle);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
ObjHandle, AcpiUtGetNodeName (ObjHandle),
AcpiFormatException (Status)));
}
Info->OpRegionCount++;
break;
case ACPI_TYPE_METHOD:
Info->MethodCount++;
/* Print a dot for each method unless we are going to print the entire pathname */
if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
* TBD: This is really for possible future support of integer width
* on a per-table basis. Currently, we just use a global for the width.
*/
if (Info->TableDesc->Pointer->Revision == 1)
{
((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
}
/*
* Always parse methods to detect errors, we will delete
* the parse tree below
*/
Status = AcpiDsParseMethod (ObjHandle);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
ObjHandle, AcpiUtGetNodeName (ObjHandle),
AcpiFormatException (Status)));
/* This parse failed, but we will continue parsing more methods */
break;
}
/*
* Delete the parse tree. We simply re-parse the method
* for every execution since there isn't much overhead
*/
AcpiNsDeleteNamespaceSubtree (ObjHandle);
AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
break;
case ACPI_TYPE_DEVICE:
Info->DeviceCount++;
break;
default:
break;
}
/*
* We ignore errors from above, and always return OK, since
* we don't want to abort the walk on a single error.
*/
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsInitializeObjects
*
* PARAMETERS: TableDesc - Descriptor for parent ACPI table
* StartNode - Root of subtree to be initialized.
*
* RETURN: Status
*
* DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
* necessary initialization on the objects found therein
*
******************************************************************************/
ACPI_STATUS
AcpiDsInitializeObjects (
ACPI_TABLE_DESC *TableDesc,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO Info;
ACPI_FUNCTION_TRACE ("DsInitializeObjects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
Info.MethodCount = 0;
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.DeviceCount = 0;
Info.TableDesc = TableDesc;
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
AcpiDsInitOneObject, &Info, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n",
AcpiFormatException (Status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
TableDesc->Pointer->Signature, TableDesc->TableId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount));
return_ACPI_STATUS (AE_OK);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.78 $
* $Revision: 1.92 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@ -122,8 +122,6 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "actables.h"
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
@ -170,8 +168,8 @@ AcpiDsParseMethod (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** NamedObj=%p\n",
(char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle));
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n",
AcpiUtGetNodeName (ObjHandle), ObjHandle));
/* Extract the method object from the method Node */
@ -208,8 +206,8 @@ AcpiDsParseMethod (
/* Init new op with the method name and pointer back to the Node */
AcpiPsSetName (Op, Node->Name);
Op->Node = Node;
AcpiPsSetName (Op, Node->Name.Integer);
Op->Common.Node = Node;
/*
* Get a new OwnerId for objects created by this method. Namespace
@ -221,8 +219,7 @@ AcpiDsParseMethod (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (OwnerId,
NULL, NULL, NULL);
WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -252,8 +249,9 @@ AcpiDsParseMethod (
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
(char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle, Op));
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
AcpiUtGetNodeName (ObjHandle), ObjHandle, Op));
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
@ -322,7 +320,7 @@ AcpiDsBeginMethodExecution (
* interpreter if we block
*/
Status = AcpiExSystemWaitSemaphore (ObjDesc->Method.Semaphore,
WAIT_FOREVER);
ACPI_WAIT_FOREVER);
}
/*
@ -380,6 +378,8 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
@ -400,7 +400,7 @@ AcpiDsCallControlMethod (
/* Create and init a Root Node */
Op = AcpiPsAllocOp (AML_SCOPE_OP);
Op = AcpiPsCreateScopeOp ();
if (!Op)
{
Status = AE_NO_MEMORY;
@ -461,8 +461,8 @@ AcpiDsCallControlMethod (
ThisWalkState->NumOperands = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n",
NextWalkState));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Starting nested execution, newstate=%p\n", NextWalkState));
return_ACPI_STATUS (AE_OK);
@ -470,7 +470,7 @@ AcpiDsCallControlMethod (
/* On error, we must delete the new walk state */
Cleanup:
AcpiDsTerminateControlMethod (NextWalkState);
(void) AcpiDsTerminateControlMethod (NextWalkState);
AcpiDsDeleteWalkState (NextWalkState);
return_ACPI_STATUS (Status);
@ -531,7 +531,6 @@ AcpiDsRestartControlMethod (
WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed,
WalkState->Results, WalkState));
return_ACPI_STATUS (AE_OK);
}
@ -556,11 +555,17 @@ AcpiDsTerminateControlMethod (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *MethodNode;
ACPI_STATUS Status;
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;
@ -578,14 +583,25 @@ AcpiDsTerminateControlMethod (
* If this is the last thread executing the method,
* we have additional cleanup to perform
*/
AcpiUtAcquireMutex (ACPI_MTX_PARSER);
Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Signal completion of the execution of this method if necessary */
if (WalkState->MethodDesc->Method.Semaphore)
{
AcpiOsSignalSemaphore (
Status = AcpiOsSignalSemaphore (
WalkState->MethodDesc->Method.Semaphore, 1);
if (ACPI_FAILURE (Status))
{
ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
Status = AE_OK;
/* Ignore error and continue cleanup */
}
}
/* Decrement the thread count on the method parse tree */
@ -605,7 +621,12 @@ AcpiDsTerminateControlMethod (
* Delete any namespace entries created immediately underneath
* the method
*/
AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (MethodNode->Child)
{
AcpiNsDeleteNamespaceSubtree (MethodNode);
@ -616,11 +637,15 @@ AcpiDsTerminateControlMethod (
* the namespace
*/
AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
AcpiUtReleaseMutex (ACPI_MTX_PARSER);
return_ACPI_STATUS (AE_OK);
Status = AcpiUtReleaseMutex (ACPI_MTX_PARSER);
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.58 $
* $Revision: 1.72 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,11 +117,10 @@
#define __DSMTHDAT_C__
#include "acpi.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
@ -149,7 +148,7 @@
*
******************************************************************************/
ACPI_STATUS
void
AcpiDsMethodDataInit (
ACPI_WALK_STATE *WalkState)
{
@ -161,11 +160,11 @@ AcpiDsMethodDataInit (
/* Init the method arguments */
for (i = 0; i < MTH_NUM_ARGS; i++)
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name |= (i << 24);
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;
@ -173,18 +172,18 @@ AcpiDsMethodDataInit (
/* Init the method locals */
for (i = 0; i < MTH_NUM_LOCALS; i++)
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
{
ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
NAMEOF_LOCAL_NTE);
WalkState->LocalVariables[i].Name |= (i << 24);
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);
return_VOID;
}
@ -194,14 +193,14 @@ AcpiDsMethodDataInit (
*
* PARAMETERS: WalkState - Current walk state object
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Delete method locals and arguments. Arguments are only
* deleted if this method was called from another method.
*
******************************************************************************/
ACPI_STATUS
void
AcpiDsMethodDataDeleteAll (
ACPI_WALK_STATE *WalkState)
{
@ -213,7 +212,7 @@ AcpiDsMethodDataDeleteAll (
/* Detach the locals */
for (Index = 0; Index < MTH_NUM_LOCALS; Index++)
for (Index = 0; Index < ACPI_METHOD_NUM_LOCALS; Index++)
{
if (WalkState->LocalVariables[Index].Object)
{
@ -228,7 +227,7 @@ AcpiDsMethodDataDeleteAll (
/* Detach the arguments */
for (Index = 0; Index < MTH_NUM_ARGS; Index++)
for (Index = 0; Index < ACPI_METHOD_NUM_ARGS; Index++)
{
if (WalkState->Arguments[Index].Object)
{
@ -241,7 +240,7 @@ AcpiDsMethodDataDeleteAll (
}
}
return_ACPI_STATUS (AE_OK);
return_VOID;
}
@ -282,7 +281,7 @@ AcpiDsMethodDataInitArgs (
/* Copy passed parameters into the new method stack frame */
while ((Index < MTH_NUM_ARGS) && (Index < MaxParamCount) && Params[Index])
while ((Index < ACPI_METHOD_NUM_ARGS) && (Index < MaxParamCount) && Params[Index])
{
/*
* A valid parameter.
@ -333,10 +332,10 @@ AcpiDsMethodDataGetNode (
{
case AML_LOCAL_OP:
if (Index > MTH_MAX_LOCAL)
if (Index > ACPI_METHOD_MAX_LOCAL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
Index, MTH_MAX_LOCAL));
Index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@ -347,10 +346,10 @@ AcpiDsMethodDataGetNode (
case AML_ARG_OP:
if (Index > MTH_MAX_ARG)
if (Index > ACPI_METHOD_MAX_ARG)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
Index, MTH_MAX_ARG));
Index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@ -380,6 +379,7 @@ AcpiDsMethodDataGetNode (
* RETURN: Status
*
* DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
* Note: There is no "implicit conversion" for locals.
*
******************************************************************************/
@ -397,6 +397,11 @@ AcpiDsMethodDataSetValue (
ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"obj %p op %X, ref count = %d [%s]\n", Object,
Opcode, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
@ -405,14 +410,18 @@ AcpiDsMethodDataSetValue (
return_ACPI_STATUS (Status);
}
/* Increment ref count so object can't be deleted while installed */
/*
* Increment ref count so object can't be deleted while installed.
* NOTE: We do not copy the object in order to preserve the call by
* reference semantics of ACPI Control Method invocation.
* (See ACPI Specification 2.0C)
*/
AcpiUtAddReference (Object);
/* Install the object into the stack entry */
/* Install the object */
Node->Object = Object;
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS (Status);
}
@ -463,7 +472,7 @@ AcpiDsMethodDataGetType (
/* Get the object type */
return_VALUE (Object->Common.Type);
return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
}
@ -546,6 +555,9 @@ AcpiDsMethodDataGetValue (
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@ -568,14 +580,14 @@ AcpiDsMethodDataGetValue (
* Index - Which localVar or argument to delete
* WalkState - Current walk state object
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
* a null into the stack slot after the object is deleted.
*
******************************************************************************/
ACPI_STATUS
void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT32 Index,
@ -594,7 +606,7 @@ AcpiDsMethodDataDeleteValue (
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
return_VOID;
}
/* Get the associated object */
@ -609,7 +621,7 @@ AcpiDsMethodDataDeleteValue (
Node->Object = NULL;
if ((Object) &&
(ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_INTERNAL))
(ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_OPERAND))
{
/*
* There is a valid object.
@ -619,7 +631,7 @@ AcpiDsMethodDataDeleteValue (
AcpiUtRemoveReference (Object);
}
return_ACPI_STATUS (AE_OK);
return_VOID;
}
@ -675,7 +687,8 @@ AcpiDsStoreObjectToLocal (
CurrentObjDesc = AcpiNsGetAttachedObject (Node);
if (CurrentObjDesc == ObjDesc)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
ObjDesc));
return_ACPI_STATUS (Status);
}
@ -703,25 +716,40 @@ AcpiDsStoreObjectToLocal (
*
* Weird, but true.
*/
if ((Opcode == AML_ARG_OP) &&
(ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_NAMED))
if (Opcode == AML_ARG_OP)
{
/*
* Make sure that the object is the correct type. This may be overkill, but
* it is here because references were NS nodes in the past. Now they are
* operand objects of type Reference.
*/
if (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) != ACPI_DESC_TYPE_OPERAND)
{
ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: %X\n",
CurrentObjDesc->Common.Type));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* If we have a valid reference object that came from RefOf(), do the
* indirect store
*/
if ((CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n",
ObjDesc, CurrentObjDesc));
/* Detach an existing object from the Node */
AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc);
/*
* Store this object into the Node
* Store this object to the Node
* (perform the indirect store)
*/
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
ObjDesc, ObjDesc->Common.Type);
Status = AcpiExStoreObjectToNode (ObjDesc,
CurrentObjDesc->Reference.Object, WalkState);
return_ACPI_STATUS (Status);
}
}
/*
* Delete the existing object

View File

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.72 $
* $Revision: 1.89 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,7 +124,6 @@
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode")
@ -135,18 +134,21 @@
* FUNCTION: AcpiDsExecuteArguments
*
* PARAMETERS: Node - Parent NS node
* ExtraDesc - Has AML pointer and length
* AmlLength - Length of executable AML
* AmlStart - Pointer to the AML
*
* RETURN: Status.
*
* DESCRIPTION: Late execution of region or field arguments
* DESCRIPTION: Late (deferred) execution of region or field arguments
*
****************************************************************************/
ACPI_STATUS
AcpiDsExecuteArguments (
ACPI_NAMESPACE_NODE *Node,
ACPI_OPERAND_OBJECT *ExtraDesc)
ACPI_NAMESPACE_NODE *ScopeNode,
UINT32 AmlLength,
UINT8 *AmlStart)
{
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *Op;
@ -154,14 +156,13 @@ AcpiDsExecuteArguments (
ACPI_PARSE_OBJECT *Arg;
ACPI_FUNCTION_TRACE ("AcpiDsExecuteArguments");
ACPI_FUNCTION_TRACE ("DsExecuteArguments");
/*
* Allocate a new parser op to be the root of the parsed
* BufferField tree
* Allocate a new parser op to be the root of the parsed tree
*/
Op = AcpiPsAllocOp (AML_SCOPE_OP);
Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -169,27 +170,30 @@ AcpiDsExecuteArguments (
/* Save the Node for use in AcpiPsParseAml */
Op->Node = AcpiNsGetParentNode (Node);
Op->Common.Node = ScopeNode;
/* Create and initialize a new parser state */
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
ExtraDesc->Extra.AmlLength, NULL, NULL, 1);
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, NULL, 1);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (Status);
}
WalkState->ParseFlags = 0;
/* Mark this parse as a deferred opcode */
/* Pass1: Parse the entire BufferField declaration */
WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
WalkState->DeferredNode = Node;
/* Pass1: Parse the entire declaration */
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
@ -198,39 +202,44 @@ AcpiDsExecuteArguments (
return_ACPI_STATUS (Status);
}
/* Get and init the actual FieldUnit Op created above */
/* Get and init the Op created above */
Arg = Op->Value.Arg;
Op->Node = Node;
Arg->Node = Node;
Arg = Op->Common.Value.Arg;
Op->Common.Node = Node;
Arg->Common.Node = Node;
AcpiPsDeleteParseTree (Op);
/* Evaluate the address and length arguments for the Buffer Field */
/* Evaluate the deferred arguments */
Op = AcpiPsAllocOp (AML_SCOPE_OP);
Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Op->Node = AcpiNsGetParentNode (Node);
Op->Common.Node = ScopeNode;
/* Create and initialize a new parser state */
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart,
ExtraDesc->Extra.AmlLength, NULL, NULL, 3);
/* Execute the opcode and arguments */
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, NULL, 3);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (Status);
}
/* Mark this execution as a deferred opcode */
WalkState->DeferredNode = Node;
Status = AcpiPsParseAml (WalkState);
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
@ -272,13 +281,112 @@ AcpiDsGetBufferFieldArguments (
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
Node = ObjDesc->BufferField.Node;
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n",
(char *) &Node->Name));
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
AcpiUtGetNodeName (Node)));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, ExtraDesc);
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsGetBufferArguments
*
* PARAMETERS: ObjDesc - A valid Buffer object
*
* RETURN: Status.
*
* DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetBufferArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR ("DsGetBufferArguments", ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the Buffer node */
Node = ObjDesc->Buffer.Node;
if (!Node)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in buffer %p\n", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node,
ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsGetPackageArguments
*
* PARAMETERS: ObjDesc - A valid Package object
*
* RETURN: Status.
*
* DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes.
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetPackageArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR ("DsGetPackageArguments", ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the Package node */
Node = ObjDesc->Package.Node;
if (!Node)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No pointer back to NS node in package %p\n", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node,
ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
return_ACPI_STATUS (Status);
}
@ -302,7 +410,7 @@ AcpiDsGetRegionArguments (
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
@ -313,23 +421,25 @@ AcpiDsGetRegionArguments (
return_ACPI_STATUS (AE_OK);
}
RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc);
if (!RegionObj2)
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
if (!ExtraDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the AML pointer (method object) and region node */
/* Get the Region node */
Node = ObjDesc->Region.Node;
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]"));
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n",
(char *) &Node->Name, RegionObj2->Extra.AmlStart));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
/* Execute the argument AML */
Status = AcpiDsExecuteArguments (Node, RegionObj2);
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
@ -342,7 +452,7 @@ AcpiDsGetRegionArguments (
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Front end to EvInitializeRegion
*
****************************************************************************/
@ -365,117 +475,79 @@ AcpiDsInitializeRegion (
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalBufferFieldOperands
* FUNCTION: AcpiDsInitBufferField
*
* PARAMETERS: Op - A valid BufferField Op object
* PARAMETERS: AmlOpcode - CreateXxxField
* ObjDesc - BufferField object
* BufferDesc - Host Buffer
* OffsetDesc - Offset into buffer
* Length - Length of field (CREATE_FIELD_OP only)
* Result - Where to store the result
*
* RETURN: Status
*
* DESCRIPTION: Get BufferField Buffer and Index
* Called from AcpiDsExecEndOp during BufferField parse tree walk
* DESCRIPTION: Perform actual initialization of a buffer field
*
****************************************************************************/
ACPI_STATUS
AcpiDsEvalBufferFieldOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
AcpiDsInitBufferField (
UINT16 AmlOpcode,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT *BufferDesc,
ACPI_OPERAND_OBJECT *OffsetDesc,
ACPI_OPERAND_OBJECT *LengthDesc,
ACPI_OPERAND_OBJECT *ResultDesc)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
UINT32 Offset;
UINT32 BitOffset;
UINT32 BitCount;
UINT8 FieldFlags;
ACPI_OPERAND_OBJECT *ResDesc = NULL;
ACPI_OPERAND_OBJECT *CntDesc = NULL;
ACPI_OPERAND_OBJECT *OffDesc = NULL;
ACPI_OPERAND_OBJECT *SrcDesc = NULL;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
ACPI_FUNCTION_TRACE_PTR ("DsInitBufferField", ObjDesc);
/*
* This is where we evaluate the address and length fields of the
* CreateXxxField declaration
*/
Node = Op->Node;
/* Host object must be a Buffer */
/* NextOp points to the op that holds the Buffer */
NextOp = Op->Value.Arg;
/* AcpiEvaluate/create the address and length operands */
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
{
return_ACPI_STATUS (Status);
}
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Resolve the operands */
Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState);
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
WalkState->NumOperands, "after AcpiExResolveOperands");
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
AcpiPsGetOpcodeName (Op->Opcode), Status));
goto Cleanup;
}
/* Get the operands */
if (AML_CREATE_FIELD_OP == Op->Opcode)
{
ResDesc = WalkState->Operands[3];
CntDesc = WalkState->Operands[2];
}
else
{
ResDesc = WalkState->Operands[2];
}
OffDesc = WalkState->Operands[1];
SrcDesc = WalkState->Operands[0];
Offset = (UINT32) OffDesc->Integer.Value;
/*
* If ResDesc is a Name, it will be a direct name pointer after
* AcpiExResolveOperands()
*/
if (ACPI_GET_DESCRIPTOR_TYPE (ResDesc) != ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n",
AcpiPsGetOpcodeName (Op->Opcode)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Target of Create Field is not a Buffer object - %s\n",
AcpiUtGetObjectTypeName (BufferDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
* The last parameter to all of these opcodes (ResultDesc) started
* out as a NameString, and should therefore now be a NS node
* after resolution in AcpiExResolveOperands().
*/
if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n",
AcpiPsGetOpcodeName (AmlOpcode)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
Offset = (UINT32) OffsetDesc->Integer.Value;
/*
* Setup the Bit offsets and counts, according to the opcode
*/
switch (Op->Opcode)
switch (AmlOpcode)
{
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
BitOffset = Offset;
BitCount = (UINT32) CntDesc->Integer.Value;
BitCount = (UINT32) LengthDesc->Integer.Value;
FieldFlags = AML_FIELD_ACCESS_BYTE;
break;
@ -527,28 +599,23 @@ AcpiDsEvalBufferFieldOperands (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Internal error - unknown field creation opcode %02x\n",
Op->Opcode));
"Unknown field creation opcode %02x\n",
AmlOpcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
/*
* Setup field according to the object type
*/
switch (SrcDesc->Common.Type)
{
/* SourceBuff := TermArg=>Buffer */
case ACPI_TYPE_BUFFER:
/* Entire field must fit within the current length of the buffer */
if ((BitOffset + BitCount) >
(8 * (UINT32) SrcDesc->Buffer.Length))
(8 * (UINT32) BufferDesc->Buffer.Length))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field size %d exceeds Buffer size %d (bits)\n",
BitOffset + BitCount, 8 * (UINT32) SrcDesc->Buffer.Length));
"Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
AcpiUtGetNodeName (ResultDesc),
BitOffset + BitCount,
AcpiUtGetNodeName (BufferDesc->Buffer.Node),
8 * (UINT32) BufferDesc->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
goto Cleanup;
}
@ -561,66 +628,34 @@ AcpiDsEvalBufferFieldOperands (
BitOffset, BitCount);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ObjDesc->BufferField.BufferObj = SrcDesc;
/* Reference count for SrcDesc inherits ObjDesc count */
SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount +
ObjDesc->Common.ReferenceCount);
break;
/* Improper object type */
default:
if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* This line MUST be a single line until AcpiSrc can handle it (block deletion) */
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Tried to create field in invalid object type %X\n",
SrcDesc->Common.Type));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Tried to create field in improper object type - %s\n",
AcpiUtGetTypeName (SrcDesc->Common.Type)));
}
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
ObjDesc->BufferField.BufferObj = BufferDesc;
if (AML_CREATE_FIELD_OP == Op->Opcode)
{
/* Delete object descriptor unique to CreateField */
/* Reference count for BufferDesc inherits ObjDesc count */
AcpiUtRemoveReference (CntDesc);
CntDesc = NULL;
}
BufferDesc->Common.ReferenceCount = (UINT16) (BufferDesc->Common.ReferenceCount +
ObjDesc->Common.ReferenceCount);
Cleanup:
/* Always delete the operands */
AcpiUtRemoveReference (OffDesc);
AcpiUtRemoveReference (SrcDesc);
AcpiUtRemoveReference (OffsetDesc);
AcpiUtRemoveReference (BufferDesc);
if (AML_CREATE_FIELD_OP == Op->Opcode)
if (AmlOpcode == AML_CREATE_FIELD_OP)
{
AcpiUtRemoveReference (CntDesc);
AcpiUtRemoveReference (LengthDesc);
}
/* On failure, delete the result descriptor */
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ResDesc); /* Result descriptor */
AcpiUtRemoveReference (ResultDesc); /* Result descriptor */
}
else
{
@ -633,11 +668,104 @@ Cleanup:
}
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalBufferFieldOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid BufferField Op object
*
* RETURN: Status
*
* DESCRIPTION: Get BufferField Buffer and Index
* Called from AcpiDsExecEndOp during BufferField parse tree walk
*
****************************************************************************/
ACPI_STATUS
AcpiDsEvalBufferFieldOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
/*
* This is where we evaluate the address and length fields of the
* CreateXxxField declaration
*/
Node = Op->Common.Node;
/* NextOp points to the op that holds the Buffer */
NextOp = Op->Common.Value.Arg;
/* Evaluate/create the address and length operands */
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Resolve the operands */
Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
ACPI_WALK_OPERANDS, WalkState);
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
WalkState->NumOperands, "after AcpiExResolveOperands");
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
return_ACPI_STATUS (Status);
}
/* Initialize the Buffer Field */
if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
{
/* NOTE: Slightly different operands for this opcode */
Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
WalkState->Operands[0], WalkState->Operands[1],
WalkState->Operands[2], WalkState->Operands[3]);
}
else
{
/* All other, CreateXxxField opcodes */
Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
WalkState->Operands[0], WalkState->Operands[1],
NULL, WalkState->Operands[2]);
}
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalRegionOperands
*
* PARAMETERS: Op - A valid region Op object
* PARAMETERS: WalkState - Current walk
* Op - A valid region Op object
*
* RETURN: Status
*
@ -664,17 +792,17 @@ AcpiDsEvalRegionOperands (
/*
* This is where we evaluate the address and length fields of the OpRegion declaration
*/
Node = Op->Node;
Node = Op->Common.Node;
/* NextOp points to the op that holds the SpaceID */
NextOp = Op->Value.Arg;
NextOp = Op->Common.Value.Arg;
/* NextOp points to address op */
NextOp = NextOp->Next;
NextOp = NextOp->Common.Next;
/* AcpiEvaluate/create the address and length operands */
/* Evaluate/create the address and length operands */
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
@ -684,14 +812,14 @@ AcpiDsEvalRegionOperands (
/* Resolve the length and address operands to numbers */
Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState);
Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Opcode),
AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
1, "after AcpiExResolveOperands");
ObjDesc = AcpiNsGetAttachedObject (Node);
@ -731,6 +859,107 @@ AcpiDsEvalRegionOperands (
}
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalDataObjectOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid DataObject Op object
* ObjDesc - DataObject
*
* RETURN: Status
*
* DESCRIPTION: Get the operands and complete the following data objec types:
* Buffer
* Package
*
****************************************************************************/
ACPI_STATUS
AcpiDsEvalDataObjectOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ArgDesc;
UINT32 Length;
ACPI_FUNCTION_TRACE ("DsEvalDataObjectOperands");
/* The first operand (for all of these data objects) is the length */
Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiExResolveOperands (WalkState->Opcode,
&(WalkState->Operands [WalkState->NumOperands -1]),
WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Extract length operand */
ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
Length = (UINT32) ArgDesc->Integer.Value;
/* Cleanup for length operand */
Status = AcpiDsObjStackPop (1, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiUtRemoveReference (ArgDesc);
/*
* Create the actual data object
*/
switch (Op->Common.AmlOpcode)
{
case AML_BUFFER_OP:
Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
break;
default:
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
if (ACPI_SUCCESS (Status))
{
/*
* Return the object in the WalkState, unless the parent is a package --
* in this case, the return object will be stored in the parse tree
* for the package.
*/
if ((!Op->Common.Parent) ||
((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
(Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
(Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
{
WalkState->ResultObj = ObjDesc;
}
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsExecBeginControlOp
@ -758,9 +987,9 @@ AcpiDsExecBeginControlOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
Op->Opcode, WalkState));
Op->Common.AmlOpcode, WalkState));
switch (Op->Opcode)
switch (Op->Common.AmlOpcode)
{
case AML_IF_OP:
case AML_WHILE_OP:
@ -782,7 +1011,7 @@ AcpiDsExecBeginControlOp (
*/
ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
ControlState->Control.Opcode = Op->Opcode;
ControlState->Control.Opcode = Op->Common.AmlOpcode;
/* Push the control state on this walk's control stack */
@ -840,7 +1069,7 @@ AcpiDsExecEndControlOp (
ACPI_FUNCTION_NAME ("DsExecEndControlOp");
switch (Op->Opcode)
switch (Op->Common.AmlOpcode)
{
case AML_IF_OP:
@ -892,18 +1121,18 @@ AcpiDsExecEndControlOp (
case AML_RETURN_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg));
"[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
/*
* One optional operand -- the return value
* It can be either an immediate operand or a result that
* has been bubbled up the tree
*/
if (Op->Value.Arg)
if (Op->Common.Value.Arg)
{
/* Return statement has an immediate operand */
Status = AcpiDsCreateOperands (WalkState, Op->Value.Arg);
Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -939,8 +1168,8 @@ AcpiDsExecEndControlOp (
*
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_INTERNAL) &&
((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) &&
if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
{
Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
@ -987,7 +1216,7 @@ AcpiDsExecEndControlOp (
/* Call up to the OS service layer to handle this */
AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
/* If and when it returns, all done. */
@ -1020,7 +1249,7 @@ AcpiDsExecEndControlOp (
/* Return status depending on opcode */
if (Op->Opcode == AML_BREAK_OP)
if (Op->Common.AmlOpcode == AML_BREAK_OP)
{
Status = AE_CTRL_BREAK;
}
@ -1034,7 +1263,7 @@ AcpiDsExecEndControlOp (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
Op->Opcode, Op));
Op->Common.AmlOpcode, Op));
Status = AE_AML_BAD_OPCODE;
break;

View File

@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.89 $
* $Revision: 1.105 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,6 +124,7 @@
#include "acinterp.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acdisasm.h"
#define _COMPONENT ACPI_DISPATCHER
@ -132,7 +133,7 @@
/*
* Dispatch table for opcode classes
*/
ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
AcpiExOpcode_1A_0T_0R,
AcpiExOpcode_1A_0T_1R,
AcpiExOpcode_1A_1T_0R,
@ -212,11 +213,11 @@ AcpiDsGetPredicateValue (
* Result of predicate evaluation currently must
* be a number
*/
if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad predicate (not a number) ObjDesc=%p State=%p Type=%X\n",
ObjDesc, WalkState, ObjDesc->Common.Type));
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@ -224,7 +225,7 @@ AcpiDsGetPredicateValue (
/* Truncate the predicate to 32-bits if necessary */
AcpiExTruncateFor32bitTable (ObjDesc, WalkState);
AcpiExTruncateFor32bitTable (ObjDesc);
/*
* Save the result of the predicate evaluation on
@ -304,14 +305,19 @@ AcpiDsExecBeginOp (
Op = *OutOp;
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
WalkState->Opcode = Op->Common.AmlOpcode;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
AcpiDsScopeStackPop (WalkState);
Status = AcpiDsScopeStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
}
@ -349,7 +355,7 @@ AcpiDsExecBeginOp (
/* We want to send namepaths to the load code */
if (Op->Opcode == AML_INT_NAMEPATH_OP)
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
{
OpcodeClass = AML_CLASS_NAMED_OBJECT;
}
@ -385,7 +391,7 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (WalkState, NULL);
}
if (Op->Opcode == AML_REGION_OP)
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
Status = AcpiDsResultStackPush (WalkState);
}
@ -438,7 +444,6 @@ AcpiDsExecEndOp (
UINT32 OpClass;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *FirstArg;
UINT32 i;
ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
@ -450,11 +455,11 @@ AcpiDsExecEndOp (
if (OpClass == AML_CLASS_UNKNOWN)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Opcode));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Common.AmlOpcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
FirstArg = Op->Value.Arg;
FirstArg = Op->Common.Value.Arg;
/* Init the walk state */
@ -512,25 +517,32 @@ AcpiDsExecEndOp (
Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState);
}
else
{
/*
* Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
* Local is uninitialized.
*/
if ((Status == AE_AML_UNINITIALIZED_LOCAL) &&
(WalkState->Opcode == AML_STORE_OP) &&
(WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[0]->Reference.Opcode ==
WalkState->Operands[1]->Reference.Opcode))
{
Status = AE_OK;
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"[%s]: Could not resolve operands, %s\n",
AcpiPsGetOpcodeName (WalkState->Opcode),
AcpiFormatException (Status)));
}
}
/* Always delete the argument objects and clear the operand stack */
for (i = 0; i < WalkState->NumOperands; i++)
{
/*
* Remove a reference to all operands, including both
* "Arguments" and "Targets".
*/
AcpiUtRemoveReference (WalkState->Operands[i]);
WalkState->Operands[i] = NULL;
}
WalkState->NumOperands = 0;
AcpiDsClearOperands (WalkState);
/*
* If a result object was returned from above, push it on the
@ -554,8 +566,12 @@ AcpiDsExecEndOp (
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
Status = AcpiDsExecEndControlOp (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
AcpiDsResultStackPop (WalkState);
Status = AcpiDsResultStackPop (WalkState);
break;
@ -573,7 +589,7 @@ AcpiDsExecEndOp (
/* NextOp points to first argument op */
NextOp = NextOp->Next;
NextOp = NextOp->Common.Next;
/*
* Get the method's arguments and put them on the operand stack
@ -592,6 +608,9 @@ AcpiDsExecEndOp (
Status = AcpiDsResolveOperands (WalkState);
if (ACPI_FAILURE (Status))
{
/* On error, clear all resolved operands */
AcpiDsClearOperands (WalkState);
break;
}
@ -623,6 +642,55 @@ AcpiDsExecEndOp (
break;
case AML_TYPE_CREATE_OBJECT:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing CreateObject (Buffer/Package) Op=%p\n", Op));
switch (Op->Common.Parent->Common.AmlOpcode)
{
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
WalkState->NumOperands = 1;
Status = AcpiDsCreateNode (WalkState, Op->Common.Parent->Common.Node, Op->Common.Parent);
if (ACPI_FAILURE (Status))
{
break;
}
/* Fall through */
/*lint -fallthrough */
case AML_INT_EVAL_SUBTREE_OP:
Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
break;
default:
Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
break;
}
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (Status) &&
WalkState->ResultObj)
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
@ -634,7 +702,7 @@ AcpiDsExecEndOp (
break;
}
if (Op->Opcode == AML_REGION_OP)
if (Op->Common.AmlOpcode == AML_REGION_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing OpRegion Address/Length Op=%p\n", Op));
@ -669,7 +737,7 @@ AcpiDsExecEndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
OpClass, OpType, Op->Opcode, Op));
OpClass, OpType, Op->Common.AmlOpcode, Op));
Status = AE_NOT_IMPLEMENTED;
break;
@ -680,7 +748,7 @@ AcpiDsExecEndOp (
* ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table
*/
AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState);
AcpiExTruncateFor32bitTable (WalkState->ResultObj);
/*
* Check if we just completed the evaluation of a
@ -712,9 +780,28 @@ Cleanup:
AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
}
#ifdef _UNDER_DEVELOPMENT
if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
{
AcpiDbMethodEnd (WalkState);
}
#endif
/* Always clear the object stack */
WalkState->NumOperands = 0;
#ifdef ACPI_DISASSEMBLER
/* On error, display method locals/args */
if (ACPI_FAILURE (Status))
{
AcpiDmDumpMethodInfo (Status, WalkState, Op);
}
#endif
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 1.52 $
* $Revision: 1.59 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,7 +117,6 @@
#define __DSWSCOPE_C__
#include "acpi.h"
#include "acinterp.h"
#include "acdispat.h"
@ -156,7 +155,7 @@ AcpiDsScopeStackClear (
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type %X\n", ScopeInfo->Common.Value));
"Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value)));
AcpiUtDeleteGenericState (ScopeInfo);
}
}
@ -181,6 +180,7 @@ AcpiDsScopeStackPush (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *ScopeInfo;
ACPI_GENERIC_STATE *OldScopeInfo;
ACPI_FUNCTION_TRACE ("DsScopeStackPush");
@ -196,12 +196,11 @@ AcpiDsScopeStackPush (
/* Make sure object type is valid */
if (!AcpiExValidateObjectType (Type))
if (!AcpiUtValidObjectType (Type))
{
ACPI_REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
ACPI_REPORT_WARNING (("DsScopeStackPush: Invalid object type: 0x%X\n", Type));
}
/* Allocate a new scope object */
ScopeInfo = AcpiUtCreateGenericState ();
@ -216,10 +215,33 @@ AcpiDsScopeStackPush (
ScopeInfo->Scope.Node = Node;
ScopeInfo->Common.Value = (UINT16) Type;
WalkState->ScopeDepth++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[%.2d] Pushed scope ", (UINT32) WalkState->ScopeDepth));
OldScopeInfo = WalkState->ScopeInfo;
if (OldScopeInfo)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[%4.4s] (%s)",
AcpiUtGetNodeName (OldScopeInfo->Scope.Node),
AcpiUtGetTypeName (OldScopeInfo->Common.Value)));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (%s)", "ROOT"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
", New scope -> [%4.4s] (%s)\n",
AcpiUtGetNodeName (ScopeInfo->Scope.Node),
AcpiUtGetTypeName (ScopeInfo->Common.Value)));
/* Push new scope object onto stack */
AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
return_ACPI_STATUS (AE_OK);
}
@ -246,6 +268,7 @@ AcpiDsScopeStackPop (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *ScopeInfo;
ACPI_GENERIC_STATE *NewScopeInfo;
ACPI_FUNCTION_TRACE ("DsScopeStackPop");
@ -260,11 +283,29 @@ AcpiDsScopeStackPop (
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
}
WalkState->ScopeDepth--;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type %X\n", ScopeInfo->Common.Value));
"[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
(UINT32) WalkState->ScopeDepth,
AcpiUtGetNodeName (ScopeInfo->Scope.Node),
AcpiUtGetTypeName (ScopeInfo->Common.Value)));
NewScopeInfo = WalkState->ScopeInfo;
if (NewScopeInfo)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[%4.4s] (%s)\n",
AcpiUtGetNodeName (NewScopeInfo->Scope.Node),
AcpiUtGetTypeName (NewScopeInfo->Common.Value)));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (ROOT)\n"));
}
AcpiUtDeleteGenericState (ScopeInfo);
return_ACPI_STATUS (AE_OK);
}

View File

@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 1.150 $
* $Revision: 1.151 $
*
******************************************************************************/