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 (
WalkState->MethodDesc->Method.Semaphore, 1);
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,30 +160,30 @@ 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,
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;
ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
NAMEOF_ARG_NTE);
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++)
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
{
ACPI_MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
NAMEOF_LOCAL_NTE);
ACPI_MOVE_32_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);
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)
{
@ -223,12 +222,12 @@ AcpiDsMethodDataDeleteAll (
/* Detach object (if present) and remove a reference */
AcpiNsDetachObject (&WalkState->LocalVariables[Index]);
}
}
}
/* 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,24 +716,39 @@ AcpiDsStoreObjectToLocal (
*
* Weird, but true.
*/
if ((Opcode == AML_ARG_OP) &&
(ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_NAMED))
if (Opcode == AML_ARG_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);
/*
* 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);
}
/*
* Store this object into the Node
* (perform the indirect store)
* If we have a valid reference object that came from RefOf(), do the
* indirect store
*/
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc,
ObjDesc, ObjDesc->Common.Type);
return_ACPI_STATUS (Status);
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));
/*
* Store this object to the Node
* (perform the indirect store)
*/
Status = AcpiExStoreObjectToNode (ObjDesc,
CurrentObjDesc->Reference.Object, WalkState);
return_ACPI_STATUS (Status);
}
}
/*

File diff suppressed because it is too large Load Diff

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 */
@ -513,24 +518,31 @@ AcpiDsExecEndOp (
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"[%s]: Could not resolve operands, %s\n",
AcpiPsGetOpcodeName (WalkState->Opcode),
AcpiFormatException (Status)));
/*
* 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 $
*
******************************************************************************/
@ -389,7 +389,7 @@ AcpiGetRegister (
*ReturnValue = RegisterValue;
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
RegisterValue, BitRegInfo->ParentRegister));
}
@ -503,7 +503,7 @@ AcpiSetRegister (
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
break;
@ -881,9 +881,9 @@ AcpiHwLowLevelRead (
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*Value, Width,
ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
*Value, Width,
ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
AcpiUtGetRegionName (Reg->AddressSpaceId)));
return (Status);
@ -970,9 +970,9 @@ AcpiHwLowLevelWrite (
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
Value, Width,
ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
Value, Width,
ACPI_HIDWORD (ACPI_GET_ADDRESS (Reg->Address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (Reg->Address)),
AcpiUtGetRegionName (Reg->AddressSpaceId)));
return (Status);