mirror of
https://github.com/acpica/acpica/
synced 2025-02-16 13:34:07 +03:00
Automated code cleanup
date 2002.12.06.16.32.00; author rmoore1; state Exp;
This commit is contained in:
parent
581f5830a5
commit
acfa291dce
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswload - Dispatcher namespace load callbacks
|
||||
* $Revision: 1.80 $
|
||||
* $Revision: 1.81 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -284,7 +284,7 @@ AcpiDsLoad1BeginOp (
|
||||
case ACPI_TYPE_STRING:
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/*
|
||||
/*
|
||||
* These types we will allow, but we will change the type. This
|
||||
* enables some existing code of the form:
|
||||
*
|
||||
@ -294,7 +294,7 @@ AcpiDsLoad1BeginOp (
|
||||
* Note: silently change the type here. On the second pass, we will report a warning
|
||||
*/
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
||||
Path, AcpiUtGetTypeName (Node->Type)));
|
||||
|
||||
Node->Type = ACPI_TYPE_ANY;
|
||||
@ -305,7 +305,7 @@ AcpiDsLoad1BeginOp (
|
||||
|
||||
/* All other types are an error */
|
||||
|
||||
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
|
||||
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
|
||||
AcpiUtGetTypeName (Node->Type), Path));
|
||||
|
||||
return (AE_AML_OPERAND_TYPE);
|
||||
@ -319,15 +319,15 @@ AcpiDsLoad1BeginOp (
|
||||
* For all other named opcodes, we will enter the name into the namespace.
|
||||
*
|
||||
* Setup the search flags.
|
||||
* Since we are entering a name into the namespace, we do not want to
|
||||
* Since we are entering a name into the namespace, we do not want to
|
||||
* enable the search-to-root upsearch.
|
||||
*
|
||||
* There are only two conditions where it is acceptable that the name
|
||||
* already exists:
|
||||
* 1) the Scope() operator can reopen a scoping object that was
|
||||
* 1) the Scope() operator can reopen a scoping object that was
|
||||
* previously defined (Scope, Method, Device, etc.)
|
||||
* 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
|
||||
* BufferField, or Package), the name of the object is already
|
||||
* 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
|
||||
* BufferField, or Package), the name of the object is already
|
||||
* in the namespace.
|
||||
*/
|
||||
Flags = ACPI_NS_NO_UPSEARCH;
|
||||
@ -648,7 +648,7 @@ AcpiDsLoad2BeginOp (
|
||||
case ACPI_TYPE_STRING:
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/*
|
||||
/*
|
||||
* These types we will allow, but we will change the type. This
|
||||
* enables some existing code of the form:
|
||||
*
|
||||
@ -656,7 +656,7 @@ AcpiDsLoad2BeginOp (
|
||||
* Scope (DEB) { ... }
|
||||
*/
|
||||
|
||||
ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
||||
ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
||||
BufferPtr, AcpiUtGetTypeName (Node->Type)));
|
||||
|
||||
Node->Type = ACPI_TYPE_ANY;
|
||||
@ -667,7 +667,7 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
/* All other types are an error */
|
||||
|
||||
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
|
||||
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
|
||||
AcpiUtGetTypeName (Node->Type), BufferPtr));
|
||||
|
||||
return (AE_AML_OPERAND_TYPE);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswstate - Dispatcher parse tree walk management routines
|
||||
* $Revision: 1.54 $
|
||||
* $Revision: 1.72 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -118,14 +118,12 @@
|
||||
#define __DSWSTATE_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acparser.h"
|
||||
#include "acdispat.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
MODULE_NAME ("dswstate")
|
||||
ACPI_MODULE_NAME ("dswstate")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -150,7 +148,7 @@ AcpiDsResultInsert (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultInsert");
|
||||
ACPI_FUNCTION_NAME ("DsResultInsert");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
@ -161,7 +159,7 @@ AcpiDsResultInsert (
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
if (Index >= ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Index out of range: %X Obj=%p State=%p Num=%X\n",
|
||||
@ -182,7 +180,7 @@ AcpiDsResultInsert (
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
|
||||
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
|
||||
WalkState, State->Results.NumResults, WalkState->CurrentResult));
|
||||
|
||||
return (AE_OK);
|
||||
@ -212,7 +210,7 @@ AcpiDsResultRemove (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultRemove");
|
||||
ACPI_FUNCTION_NAME ("DsResultRemove");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
@ -223,14 +221,13 @@ AcpiDsResultRemove (
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
if (Index >= ACPI_OBJ_MAX_OPERAND)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Index out of range: %X State=%p Num=%X\n",
|
||||
Index, WalkState, State->Results.NumResults));
|
||||
}
|
||||
|
||||
|
||||
/* Check for a valid result object */
|
||||
|
||||
if (!State->Results.ObjDesc [Index])
|
||||
@ -250,7 +247,7 @@ AcpiDsResultRemove (
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
Index, WalkState, State->Results.NumResults));
|
||||
|
||||
return (AE_OK);
|
||||
@ -276,11 +273,11 @@ AcpiDsResultPop (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 Index;
|
||||
NATIVE_UINT Index;
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPop");
|
||||
ACPI_FUNCTION_NAME ("DsResultPop");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
@ -300,7 +297,7 @@ AcpiDsResultPop (
|
||||
|
||||
State->Results.NumResults--;
|
||||
|
||||
for (Index = OBJ_NUM_OPERANDS; Index; Index--)
|
||||
for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
|
||||
{
|
||||
/* Check for a valid result object */
|
||||
|
||||
@ -310,8 +307,8 @@ AcpiDsResultPop (
|
||||
State->Results.ObjDesc [Index -1] = NULL;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
Index -1, WalkState, State->Results.NumResults));
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
(UINT32) Index -1, WalkState, State->Results.NumResults));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -340,11 +337,11 @@ AcpiDsResultPopFromBottom (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 Index;
|
||||
NATIVE_UINT Index;
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPopFromBottom");
|
||||
ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
@ -355,7 +352,6 @@ AcpiDsResultPopFromBottom (
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
||||
if (!State->Results.NumResults)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
|
||||
@ -380,12 +376,12 @@ AcpiDsResultPopFromBottom (
|
||||
if (!*Object)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, Index));
|
||||
WalkState, State->Results.NumResults, (UINT32) Index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
|
||||
State, WalkState));
|
||||
|
||||
|
||||
@ -414,7 +410,7 @@ AcpiDsResultPush (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPush");
|
||||
ACPI_FUNCTION_NAME ("DsResultPush");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
@ -424,7 +420,7 @@ AcpiDsResultPush (
|
||||
return (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
if (State->Results.NumResults == OBJ_NUM_OPERANDS)
|
||||
if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Result stack overflow: Obj=%p State=%p Num=%X\n",
|
||||
@ -439,12 +435,11 @@ AcpiDsResultPush (
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
||||
State->Results.ObjDesc [State->Results.NumResults] = Object;
|
||||
State->Results.NumResults++;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
|
||||
Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
|
||||
WalkState, State->Results.NumResults, WalkState->CurrentResult));
|
||||
|
||||
return (AE_OK);
|
||||
@ -460,7 +455,7 @@ AcpiDsResultPush (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION: Push an object onto the WalkState result stack.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -470,7 +465,7 @@ AcpiDsResultStackPush (
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
PROC_NAME ("DsResultStackPush");
|
||||
ACPI_FUNCTION_NAME ("DsResultStackPush");
|
||||
|
||||
|
||||
State = AcpiUtCreateGenericState ();
|
||||
@ -497,7 +492,7 @@ AcpiDsResultStackPush (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION: Pop an object off of the WalkState result stack.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -507,7 +502,7 @@ AcpiDsResultStackPop (
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
PROC_NAME ("DsResultStackPop");
|
||||
ACPI_FUNCTION_NAME ("DsResultStackPop");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
@ -552,12 +547,12 @@ AcpiDsObjStackDeleteAll (
|
||||
UINT32 i;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
|
||||
|
||||
|
||||
/* The stack size is configurable, but fixed */
|
||||
|
||||
for (i = 0; i < OBJ_NUM_OPERANDS; i++)
|
||||
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
|
||||
{
|
||||
if (WalkState->Operands[i])
|
||||
{
|
||||
@ -588,12 +583,12 @@ AcpiDsObjStackPush (
|
||||
void *Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
PROC_NAME ("DsObjStackPush");
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPush");
|
||||
|
||||
|
||||
/* Check for stack overflow */
|
||||
|
||||
if (WalkState->NumOperands >= OBJ_NUM_OPERANDS)
|
||||
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"overflow! Obj=%p State=%p #Ops=%X\n",
|
||||
@ -607,7 +602,7 @@ AcpiDsObjStackPush (
|
||||
WalkState->NumOperands++;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
Object, AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type),
|
||||
Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -634,7 +629,7 @@ AcpiDsObjStackPopObject (
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
PROC_NAME ("DsObjStackPopObject");
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPopObject");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
@ -669,7 +664,7 @@ AcpiDsObjStackPopObject (
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
*Object, AcpiUtGetTypeName ((*Object)->Common.Type),
|
||||
*Object, AcpiUtGetObjectTypeName (*Object),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -697,7 +692,7 @@ AcpiDsObjStackPop (
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
PROC_NAME ("DsObjStackPop");
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPop");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
@ -747,7 +742,7 @@ AcpiDsObjStackPopAndDelete (
|
||||
UINT32 i;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
PROC_NAME ("DsObjStackPopAndDelete");
|
||||
ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
@ -801,7 +796,7 @@ AcpiDsObjStackGetValue (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
|
||||
|
||||
|
||||
/* Can't do it if the stack is empty */
|
||||
@ -818,7 +813,6 @@ AcpiDsObjStackGetValue (
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
|
||||
return_PTR (WalkState->Operands[(NATIVE_UINT)(WalkState->NumOperands - 1) -
|
||||
Index]);
|
||||
}
|
||||
@ -828,32 +822,32 @@ AcpiDsObjStackGetValue (
|
||||
*
|
||||
* FUNCTION: AcpiDsGetCurrentWalkState
|
||||
*
|
||||
* PARAMETERS: WalkList - Get current active state for this walk list
|
||||
* PARAMETERS: Thread - Get current active state for this Thread
|
||||
*
|
||||
* RETURN: Pointer to the current walk state
|
||||
*
|
||||
* DESCRIPTION: Get the walk state that is at the head of the list (the "current"
|
||||
* walk state.
|
||||
* walk state.)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_WALK_STATE *
|
||||
AcpiDsGetCurrentWalkState (
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
|
||||
{
|
||||
PROC_NAME ("DsGetCurrentWalkState");
|
||||
ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
|
||||
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n",
|
||||
WalkList->WalkState));
|
||||
|
||||
if (!WalkList)
|
||||
if (!Thread)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (WalkList->WalkState);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n",
|
||||
Thread->WalkStateList));
|
||||
|
||||
return (Thread->WalkStateList);
|
||||
}
|
||||
|
||||
|
||||
@ -873,13 +867,13 @@ AcpiDsGetCurrentWalkState (
|
||||
void
|
||||
AcpiDsPushWalkState (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
FUNCTION_TRACE ("DsPushWalkState");
|
||||
ACPI_FUNCTION_TRACE ("DsPushWalkState");
|
||||
|
||||
|
||||
WalkState->Next = WalkList->WalkState;
|
||||
WalkList->WalkState = WalkState;
|
||||
WalkState->Next = Thread->WalkStateList;
|
||||
Thread->WalkStateList = WalkState;
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
@ -901,26 +895,26 @@ AcpiDsPushWalkState (
|
||||
|
||||
ACPI_WALK_STATE *
|
||||
AcpiDsPopWalkState (
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsPopWalkState");
|
||||
ACPI_FUNCTION_TRACE ("DsPopWalkState");
|
||||
|
||||
|
||||
WalkState = WalkList->WalkState;
|
||||
WalkState = Thread->WalkStateList;
|
||||
|
||||
if (WalkState)
|
||||
{
|
||||
/* Next walk state becomes the current walk state */
|
||||
|
||||
WalkList->WalkState = WalkState->Next;
|
||||
Thread->WalkStateList = WalkState->Next;
|
||||
|
||||
/*
|
||||
* Don't clear the NEXT field, this serves as an indicator
|
||||
* that there is a parent WALK STATE
|
||||
* WalkState->Next = NULL;
|
||||
* NO: WalkState->Next = NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
@ -933,12 +927,12 @@ AcpiDsPopWalkState (
|
||||
* FUNCTION: AcpiDsCreateWalkState
|
||||
*
|
||||
* PARAMETERS: Origin - Starting point for this walk
|
||||
* WalkList - Owning walk list
|
||||
* Thread - Current thread state
|
||||
*
|
||||
* RETURN: Pointer to the new walk state.
|
||||
*
|
||||
* DESCRIPTION: Allocate and initialize a new walk state. The current walk state
|
||||
* is set to this new state.
|
||||
* DESCRIPTION: Allocate and initialize a new walk state. The current walk
|
||||
* state is set to this new state.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -947,13 +941,13 @@ AcpiDsCreateWalkState (
|
||||
ACPI_OWNER_ID OwnerId,
|
||||
ACPI_PARSE_OBJECT *Origin,
|
||||
ACPI_OPERAND_OBJECT *MthDesc,
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
ACPI_THREAD_STATE *Thread)
|
||||
{
|
||||
ACPI_WALK_STATE *WalkState;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsCreateWalkState");
|
||||
ACPI_FUNCTION_TRACE ("DsCreateWalkState");
|
||||
|
||||
|
||||
WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
|
||||
@ -966,11 +960,13 @@ AcpiDsCreateWalkState (
|
||||
WalkState->OwnerId = OwnerId;
|
||||
WalkState->Origin = Origin;
|
||||
WalkState->MethodDesc = MthDesc;
|
||||
WalkState->WalkList = WalkList;
|
||||
WalkState->Thread = Thread;
|
||||
|
||||
WalkState->ParserState.StartOp = Origin;
|
||||
|
||||
/* Init the method args/local */
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
|
||||
AcpiDsMethodDataInit (WalkState);
|
||||
#endif
|
||||
|
||||
@ -984,16 +980,15 @@ AcpiDsCreateWalkState (
|
||||
|
||||
/* Put the new state at the head of the walk list */
|
||||
|
||||
if (WalkList)
|
||||
if (Thread)
|
||||
{
|
||||
AcpiDsPushWalkState (WalkState, WalkList);
|
||||
AcpiDsPushWalkState (WalkState, Thread);
|
||||
}
|
||||
|
||||
return_PTR (WalkState);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitAmlWalk
|
||||
@ -1019,9 +1014,10 @@ AcpiDsInitAmlWalk (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
|
||||
ACPI_PARSE_OBJECT *ExtraOp;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsInitAmlWalk");
|
||||
ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
|
||||
|
||||
|
||||
WalkState->ParserState.Aml =
|
||||
@ -1030,7 +1026,6 @@ AcpiDsInitAmlWalk (
|
||||
WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
|
||||
|
||||
/* The NextOp of the NextWalk will be the beginning of the method */
|
||||
/* TBD: [Restructure] -- obsolete? */
|
||||
|
||||
WalkState->NextOp = NULL;
|
||||
WalkState->Params = Params;
|
||||
@ -1045,11 +1040,10 @@ AcpiDsInitAmlWalk (
|
||||
if (MethodNode)
|
||||
{
|
||||
WalkState->ParserState.StartNode = MethodNode;
|
||||
WalkState->WalkType = WALK_METHOD;
|
||||
WalkState->WalkType = ACPI_WALK_METHOD;
|
||||
WalkState->MethodNode = MethodNode;
|
||||
WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
|
||||
|
||||
|
||||
/* Push start scope on scope stack and make it current */
|
||||
|
||||
Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState);
|
||||
@ -1060,14 +1054,34 @@ AcpiDsInitAmlWalk (
|
||||
|
||||
/* Init the method arguments */
|
||||
|
||||
AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState);
|
||||
Status = AcpiDsMethodDataInitArgs (Params, ACPI_METHOD_NUM_ARGS, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Setup the current scope */
|
||||
/*
|
||||
* Setup the current scope.
|
||||
* Find a Named Op that has a namespace node associated with it.
|
||||
* search upwards from this Op. Current scope is the first
|
||||
* Op with a namespace node.
|
||||
*/
|
||||
ExtraOp = ParserState->StartOp;
|
||||
while (ExtraOp && !ExtraOp->Common.Node)
|
||||
{
|
||||
ExtraOp = ExtraOp->Common.Parent;
|
||||
}
|
||||
if (!ExtraOp)
|
||||
{
|
||||
ParserState->StartNode = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParserState->StartNode = ExtraOp->Common.Node;
|
||||
}
|
||||
|
||||
ParserState->StartNode = ParserState->StartOp->Node;
|
||||
if (ParserState->StartNode)
|
||||
{
|
||||
/* Push start scope on scope stack and make it current */
|
||||
@ -1081,12 +1095,9 @@ AcpiDsInitAmlWalk (
|
||||
}
|
||||
}
|
||||
|
||||
AcpiDsInitCallbacks (WalkState, PassNumber);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
Status = AcpiDsInitCallbacks (WalkState, PassNumber);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -1108,7 +1119,7 @@ AcpiDsDeleteWalkState (
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
|
||||
|
||||
|
||||
if (!WalkState)
|
||||
@ -1122,7 +1133,6 @@ AcpiDsDeleteWalkState (
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (WalkState->ParserState.Scope)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState));
|
||||
@ -1180,7 +1190,7 @@ void
|
||||
AcpiDsDeleteWalkStateCache (
|
||||
void)
|
||||
{
|
||||
FUNCTION_TRACE ("DsDeleteWalkStateCache");
|
||||
ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
|
||||
|
||||
|
||||
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconvrt - Object conversion routines
|
||||
* $Revision: 1.27 $
|
||||
* $Revision: 1.46 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -118,16 +118,12 @@
|
||||
#define __EXCONVRT_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
#include "acevents.h"
|
||||
#include "amlcode.h"
|
||||
#include "acdispat.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
MODULE_NAME ("exconvrt")
|
||||
ACPI_MODULE_NAME ("exconvrt")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -153,27 +149,27 @@ AcpiExConvertToInteger (
|
||||
UINT32 i;
|
||||
ACPI_OPERAND_OBJECT *RetDesc;
|
||||
UINT32 Count;
|
||||
char *Pointer;
|
||||
UINT8 *Pointer;
|
||||
ACPI_INTEGER Result;
|
||||
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
|
||||
|
||||
|
||||
switch (ObjDesc->Common.Type)
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
*ResultDesc = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
Pointer = ObjDesc->String.Pointer;
|
||||
Pointer = (UINT8 *) ObjDesc->String.Pointer;
|
||||
Count = ObjDesc->String.Length;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
Pointer = (char *) ObjDesc->Buffer.Pointer;
|
||||
Pointer = ObjDesc->Buffer.Pointer;
|
||||
Count = ObjDesc->Buffer.Length;
|
||||
break;
|
||||
|
||||
@ -181,26 +177,6 @@ AcpiExConvertToInteger (
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new integer
|
||||
*/
|
||||
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
|
||||
|
||||
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
|
||||
{
|
||||
/*
|
||||
* We are running a method that exists in a 32-bit ACPI table.
|
||||
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
|
||||
*/
|
||||
IntegerSize = sizeof (UINT32);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert the buffer/string to an integer. Note that both buffers and
|
||||
* strings are treated as raw data - we don't convert ascii to hex for
|
||||
@ -214,25 +190,27 @@ AcpiExConvertToInteger (
|
||||
|
||||
/* Transfer no more than an integer's worth of data */
|
||||
|
||||
if (Count > IntegerSize)
|
||||
if (Count > AcpiGbl_IntegerByteWidth)
|
||||
{
|
||||
Count = IntegerSize;
|
||||
Count = AcpiGbl_IntegerByteWidth;
|
||||
}
|
||||
|
||||
/*
|
||||
* String conversion is different than Buffer conversion
|
||||
*/
|
||||
switch (ObjDesc->Common.Type)
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/* TBD: Need to use 64-bit STRTOUL */
|
||||
|
||||
/*
|
||||
* Convert string to an integer
|
||||
* String must be hexadecimal as per the ACPI specification
|
||||
*/
|
||||
Result = STRTOUL (Pointer, NULL, 16);
|
||||
Status = AcpiUtStrtoul64 ((char *) Pointer, 16, &Result);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -252,12 +230,31 @@ AcpiExConvertToInteger (
|
||||
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* No other types can get here */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Save the Result, delete original descriptor, store new descriptor */
|
||||
/*
|
||||
* Create a new integer
|
||||
*/
|
||||
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Save the Result */
|
||||
|
||||
RetDesc->Integer.Value = Result;
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
@ -281,7 +278,7 @@ AcpiExConvertToInteger (
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Convert an ACPI Object to an Buffer
|
||||
* DESCRIPTION: Convert an ACPI Object to a Buffer
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -293,71 +290,61 @@ AcpiExConvertToBuffer (
|
||||
{
|
||||
ACPI_OPERAND_OBJECT *RetDesc;
|
||||
UINT32 i;
|
||||
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
|
||||
UINT8 *NewBuf;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
|
||||
|
||||
|
||||
switch (ObjDesc->Common.Type)
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* No conversion necessary */
|
||||
|
||||
*ResultDesc = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/*
|
||||
* Create a new Buffer
|
||||
* Create a new Buffer object.
|
||||
* Need enough space for one integer
|
||||
*/
|
||||
RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
|
||||
RetDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
|
||||
|
||||
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
|
||||
{
|
||||
/*
|
||||
* We are running a method that exists in a 32-bit ACPI table.
|
||||
* Truncate the value to 32 bits by zeroing out the upper
|
||||
* 32-bit field
|
||||
*/
|
||||
IntegerSize = sizeof (UINT32);
|
||||
}
|
||||
|
||||
/* Need enough space for one integer */
|
||||
|
||||
RetDesc->Buffer.Length = IntegerSize;
|
||||
NewBuf = ACPI_MEM_CALLOCATE (IntegerSize);
|
||||
if (!NewBuf)
|
||||
{
|
||||
REPORT_ERROR
|
||||
(("ExConvertToBuffer: Buffer allocation failure\n"));
|
||||
AcpiUtRemoveReference (RetDesc);
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the integer to the buffer */
|
||||
|
||||
for (i = 0; i < IntegerSize; i++)
|
||||
NewBuf = RetDesc->Buffer.Pointer;
|
||||
for (i = 0; i < AcpiGbl_IntegerByteWidth; i++)
|
||||
{
|
||||
NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8));
|
||||
}
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
*ResultDesc = ObjDesc;
|
||||
break;
|
||||
|
||||
/*
|
||||
* Create a new Buffer object
|
||||
* Size will be the string length
|
||||
*/
|
||||
RetDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) ObjDesc->String.Length);
|
||||
if (!RetDesc)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
*ResultDesc = ObjDesc;
|
||||
/* Copy the string to the buffer */
|
||||
|
||||
NewBuf = RetDesc->Buffer.Pointer;
|
||||
ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,
|
||||
ObjDesc->String.Length);
|
||||
break;
|
||||
|
||||
|
||||
@ -365,6 +352,24 @@ AcpiExConvertToBuffer (
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
/* Mark buffer initialized */
|
||||
|
||||
RetDesc->Common.Flags |= AOPOBJ_DATA_VALID;
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -373,11 +378,13 @@ AcpiExConvertToBuffer (
|
||||
*
|
||||
* FUNCTION: AcpiExConvertAscii
|
||||
*
|
||||
* PARAMETERS: Integer
|
||||
* PARAMETERS: Integer - Value to be converted
|
||||
* Base - 10 or 16
|
||||
* String - Where the string is returned
|
||||
*
|
||||
* RETURN: Actual string length
|
||||
*
|
||||
* DESCRIPTION: Convert an ACPI Integer to a hex string
|
||||
* DESCRIPTION: Convert an ACPI Integer to a hex or decimal string
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -390,14 +397,14 @@ AcpiExConvertToAscii (
|
||||
UINT32 i;
|
||||
UINT32 j;
|
||||
UINT32 k = 0;
|
||||
UINT8 HexDigit;
|
||||
char HexDigit;
|
||||
ACPI_INTEGER Digit;
|
||||
UINT32 Remainder;
|
||||
UINT32 Length = sizeof (ACPI_INTEGER);
|
||||
BOOLEAN LeadingZero = TRUE;
|
||||
|
||||
|
||||
FUNCTION_ENTRY ();
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
switch (Base)
|
||||
@ -412,7 +419,7 @@ AcpiExConvertToAscii (
|
||||
Digit = Integer;
|
||||
for (j = 1; j < i; j++)
|
||||
{
|
||||
AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
|
||||
(void) AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder);
|
||||
}
|
||||
|
||||
/* Create the decimal digit */
|
||||
@ -424,7 +431,7 @@ AcpiExConvertToAscii (
|
||||
|
||||
if (!LeadingZero)
|
||||
{
|
||||
String[k] = (UINT8) (ASCII_ZERO + Remainder);
|
||||
String[k] = (UINT8) (ACPI_ASCII_ZERO + Remainder);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@ -438,14 +445,14 @@ AcpiExConvertToAscii (
|
||||
{
|
||||
|
||||
HexDigit = AcpiUtHexToAsciiChar (Integer, (j * 4));
|
||||
if (HexDigit != ASCII_ZERO)
|
||||
if (HexDigit != ACPI_ASCII_ZERO)
|
||||
{
|
||||
LeadingZero = FALSE;
|
||||
}
|
||||
|
||||
if (!LeadingZero)
|
||||
{
|
||||
String[k] = HexDigit;
|
||||
String[k] = (UINT8) HexDigit;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@ -463,7 +470,7 @@ AcpiExConvertToAscii (
|
||||
*/
|
||||
if (!k)
|
||||
{
|
||||
String [0] = ASCII_ZERO;
|
||||
String [0] = ACPI_ASCII_ZERO;
|
||||
k = 1;
|
||||
}
|
||||
String [k] = 0;
|
||||
@ -498,31 +505,33 @@ AcpiExConvertToString (
|
||||
UINT32 i;
|
||||
UINT32 Index;
|
||||
UINT32 StringLength;
|
||||
UINT32 IntegerSize = sizeof (ACPI_INTEGER);
|
||||
UINT8 *NewBuf;
|
||||
UINT8 *Pointer;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
|
||||
|
||||
|
||||
switch (ObjDesc->Common.Type)
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
|
||||
|
||||
if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
|
||||
if (MaxLength >= ObjDesc->String.Length)
|
||||
{
|
||||
/*
|
||||
* We are running a method that exists in a 32-bit ACPI table.
|
||||
* Truncate the value to 32 bits by zeroing out the upper
|
||||
* 32-bit field
|
||||
*/
|
||||
IntegerSize = sizeof (UINT32);
|
||||
*ResultDesc = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Must copy the string first and then truncate it */
|
||||
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
StringLength = IntegerSize * 2;
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
StringLength = AcpiGbl_IntegerByteWidth * 2;
|
||||
if (Base == 10)
|
||||
{
|
||||
StringLength = ACPI_MAX_DECIMAL_DIGITS;
|
||||
@ -539,16 +548,15 @@ AcpiExConvertToString (
|
||||
|
||||
/* Need enough space for one ASCII integer plus null terminator */
|
||||
|
||||
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
|
||||
NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1);
|
||||
if (!NewBuf)
|
||||
{
|
||||
REPORT_ERROR
|
||||
ACPI_REPORT_ERROR
|
||||
(("ExConvertToString: Buffer allocation failure\n"));
|
||||
AcpiUtRemoveReference (RetDesc);
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
|
||||
/* Convert */
|
||||
|
||||
i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf);
|
||||
@ -567,18 +575,6 @@ AcpiExConvertToString (
|
||||
}
|
||||
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
@ -614,10 +610,10 @@ AcpiExConvertToString (
|
||||
StringLength = MaxLength;
|
||||
}
|
||||
|
||||
NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1);
|
||||
NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1);
|
||||
if (!NewBuf)
|
||||
{
|
||||
REPORT_ERROR
|
||||
ACPI_REPORT_ERROR
|
||||
(("ExConvertToString: Buffer allocation failure\n"));
|
||||
AcpiUtRemoveReference (RetDesc);
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -630,7 +626,7 @@ AcpiExConvertToString (
|
||||
Index = 0;
|
||||
for (i = 0, Index = 0; i < ObjDesc->Buffer.Length; i++)
|
||||
{
|
||||
Index = AcpiExConvertToAscii (Pointer[i], Base, &NewBuf[Index]);
|
||||
Index = AcpiExConvertToAscii ((ACPI_INTEGER) Pointer[i], Base, &NewBuf[Index]);
|
||||
|
||||
NewBuf[Index] = ' ';
|
||||
Index++;
|
||||
@ -640,36 +636,7 @@ AcpiExConvertToString (
|
||||
|
||||
NewBuf [Index-1] = 0;
|
||||
RetDesc->Buffer.Pointer = NewBuf;
|
||||
RetDesc->String.Length = STRLEN ((char *) NewBuf);
|
||||
|
||||
|
||||
/* Return the new buffer descriptor */
|
||||
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
if (MaxLength >= ObjDesc->String.Length)
|
||||
{
|
||||
*ResultDesc = ObjDesc;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Must copy the string first and then truncate it */
|
||||
|
||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
RetDesc->String.Length = (UINT32) ACPI_STRLEN ((char *) NewBuf);
|
||||
break;
|
||||
|
||||
|
||||
@ -677,6 +644,21 @@ AcpiExConvertToString (
|
||||
return_ACPI_STATUS (AE_TYPE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are about to overwrite the original object on the operand stack,
|
||||
* we must remove a reference on the original object because we are
|
||||
* essentially removing it from the stack.
|
||||
*/
|
||||
if (*ResultDesc == ObjDesc)
|
||||
{
|
||||
if (WalkState->Opcode != AML_STORE_OP)
|
||||
{
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
}
|
||||
}
|
||||
|
||||
*ResultDesc = RetDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@ -705,9 +687,9 @@ AcpiExConvertToTargetType (
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExConvertToTargetType");
|
||||
ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
|
||||
|
||||
|
||||
|
||||
/* Default behavior */
|
||||
|
||||
*ResultDesc = SourceDesc;
|
||||
@ -724,7 +706,7 @@ AcpiExConvertToTargetType (
|
||||
|
||||
switch (DestinationType)
|
||||
{
|
||||
case INTERNAL_TYPE_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
/*
|
||||
* Named field can always handle conversions
|
||||
*/
|
||||
@ -733,11 +715,11 @@ AcpiExConvertToTargetType (
|
||||
default:
|
||||
/* No conversion allowed for these types */
|
||||
|
||||
if (DestinationType != SourceDesc->Common.Type)
|
||||
if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Target does not allow conversion of type %s to %s\n",
|
||||
AcpiUtGetTypeName ((SourceDesc)->Common.Type),
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Explicit operator, will store (%s) over existing type (%s)\n",
|
||||
AcpiUtGetObjectTypeName (SourceDesc),
|
||||
AcpiUtGetTypeName (DestinationType)));
|
||||
Status = AE_TYPE;
|
||||
}
|
||||
@ -751,8 +733,8 @@ AcpiExConvertToTargetType (
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case INTERNAL_TYPE_BANK_FIELD:
|
||||
case INTERNAL_TYPE_INDEX_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
/*
|
||||
* These types require an Integer operand. We can convert
|
||||
* a Buffer or a String to an Integer if necessary.
|
||||
@ -779,6 +761,11 @@ AcpiExConvertToTargetType (
|
||||
*/
|
||||
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Status = AE_AML_INTERNAL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -799,7 +786,6 @@ AcpiExConvertToTargetType (
|
||||
Status = AE_AML_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Source-to-Target conversion semantics:
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: excreate - Named object creation
|
||||
* $Revision: 1.86 $
|
||||
* $Revision: 1.98 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
@ -118,24 +118,23 @@
|
||||
#define __EXCREATE_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "acinterp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acevents.h"
|
||||
#include "acdispat.h"
|
||||
#include "actables.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
MODULE_NAME ("excreate")
|
||||
ACPI_MODULE_NAME ("excreate")
|
||||
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExCreateAlias
|
||||
*
|
||||
* PARAMETERS: WalkState - Current state, contains List of
|
||||
* operands for the opcode
|
||||
* PARAMETERS: WalkState - Current state, contains operands
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -147,30 +146,69 @@ ACPI_STATUS
|
||||
AcpiExCreateAlias (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_NAMESPACE_NODE *SourceNode;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_NAMESPACE_NODE *TargetNode;
|
||||
ACPI_NAMESPACE_NODE *AliasNode;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExCreateAlias");
|
||||
ACPI_FUNCTION_TRACE ("ExCreateAlias");
|
||||
|
||||
|
||||
/* Get the source/alias operands (both namespace nodes) */
|
||||
|
||||
SourceNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
|
||||
AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
|
||||
|
||||
|
||||
/* Attach the original source object to the new Alias Node */
|
||||
|
||||
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
|
||||
AcpiNsGetAttachedObject (SourceNode),
|
||||
SourceNode->Type);
|
||||
if (TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS)
|
||||
{
|
||||
/*
|
||||
* Dereference an existing alias so that we don't create a chain
|
||||
* of aliases. With this code, we guarantee that an alias is
|
||||
* always exactly one level of indirection away from the
|
||||
* actual aliased name.
|
||||
*/
|
||||
TargetNode = (ACPI_NAMESPACE_NODE *) TargetNode->Object;
|
||||
}
|
||||
|
||||
/*
|
||||
* The new alias assumes the type of the source, but it points
|
||||
* to the same object. The reference count of the object has an
|
||||
* additional reference to prevent deletion out from under either the
|
||||
* source or the alias Node
|
||||
* For objects that can never change (i.e., the NS node will
|
||||
* permanently point to the same object), we can simply attach
|
||||
* the object to the new NS node. For other objects (such as
|
||||
* Integers, buffers, etc.), we have to point the Alias node
|
||||
* to the original Node.
|
||||
*/
|
||||
switch (TargetNode->Type)
|
||||
{
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_STRING:
|
||||
case ACPI_TYPE_BUFFER:
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
||||
/*
|
||||
* The new alias has the type ALIAS and points to the original
|
||||
* NS node, not the object itself. This is because for these
|
||||
* types, the object can change dynamically via a Store.
|
||||
*/
|
||||
AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
|
||||
AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Attach the original source object to the new Alias Node */
|
||||
|
||||
/*
|
||||
* The new alias assumes the type of the target, and it points
|
||||
* to the same object. The reference count of the object has an
|
||||
* additional reference to prevent deletion out from under either the
|
||||
* target node or the alias Node
|
||||
*/
|
||||
Status = AcpiNsAttachObject (AliasNode,
|
||||
AcpiNsGetAttachedObject (TargetNode),
|
||||
TargetNode->Type);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Since both operands are Nodes, we don't need to delete them */
|
||||
|
||||
@ -198,7 +236,7 @@ AcpiExCreateEvent (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExCreateEvent");
|
||||
ACPI_FUNCTION_TRACE ("ExCreateEvent");
|
||||
|
||||
|
||||
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
|
||||
@ -208,7 +246,7 @@ AcpiExCreateEvent (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Create the actual OS semaphore, with zero initial units -- meaning
|
||||
* that the event is created in an unsignalled state
|
||||
*/
|
||||
@ -256,7 +294,7 @@ AcpiExCreateMutex (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExCreateMutex", WALK_OPERANDS);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
|
||||
|
||||
|
||||
/* Create the new mutex object */
|
||||
@ -268,7 +306,7 @@ AcpiExCreateMutex (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Create the actual OS semaphore.
|
||||
* One unit max to make it a mutex, with one initial unit to allow
|
||||
* the mutex to be acquired.
|
||||
@ -282,9 +320,10 @@ AcpiExCreateMutex (
|
||||
/* Init object and attach to NS node */
|
||||
|
||||
ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
|
||||
ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
|
||||
|
||||
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
|
||||
ObjDesc, ACPI_TYPE_MUTEX);
|
||||
Status = AcpiNsAttachObject (ObjDesc->Mutex.Node,
|
||||
ObjDesc, ACPI_TYPE_MUTEX);
|
||||
|
||||
|
||||
Cleanup:
|
||||
@ -325,12 +364,12 @@ AcpiExCreateRegion (
|
||||
ACPI_OPERAND_OBJECT *RegionObj2;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExCreateRegion");
|
||||
ACPI_FUNCTION_TRACE ("ExCreateRegion");
|
||||
|
||||
|
||||
/* Get the Node from the object stack */
|
||||
|
||||
Node = WalkState->Op->Node;
|
||||
Node = WalkState->Op->Common.Node;
|
||||
|
||||
/*
|
||||
* If the region object is already attached to this node,
|
||||
@ -348,7 +387,7 @@ AcpiExCreateRegion (
|
||||
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
|
||||
(RegionSpace < ACPI_USER_REGION_BEGIN))
|
||||
{
|
||||
REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
|
||||
ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
|
||||
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
|
||||
}
|
||||
|
||||
@ -418,11 +457,11 @@ AcpiExCreateTableRegion (
|
||||
ACPI_OPERAND_OBJECT *RegionObj2;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("ExCreateTableRegion");
|
||||
ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
|
||||
|
||||
/* Get the Node from the object stack */
|
||||
|
||||
Node = WalkState->Op->Node;
|
||||
Node = WalkState->Op->Common.Node;
|
||||
|
||||
/*
|
||||
* If the region object is already attached to this node,
|
||||
@ -433,36 +472,23 @@ AcpiExCreateTableRegion (
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Find the table */
|
||||
/* Find the ACPI table */
|
||||
|
||||
if (!STRCMP (Operand[1]->String.Pointer, DSDT_SIG))
|
||||
Status = AcpiTbFindTable (Operand[1]->String.Pointer,
|
||||
Operand[2]->String.Pointer,
|
||||
Operand[3]->String.Pointer, &Table);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
Table = (ACPI_TABLE_HEADER *) AcpiGbl_DSDT;
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
Status = AcpiGetFirmwareTable (Operand[1]->String.Pointer, 1,
|
||||
ACPI_LOGICAL_ADDRESSING, &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
#endif
|
||||
return_ACPI_STATUS (AE_SUPPORT);
|
||||
}
|
||||
|
||||
/* Check OemId and TableId */
|
||||
|
||||
|
||||
|
||||
/* Create the region descriptor */
|
||||
|
||||
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto Cleanup;
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
RegionObj2 = ObjDesc->Common.NextObject;
|
||||
@ -499,6 +525,7 @@ AcpiExCreateTableRegion (
|
||||
|
||||
ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
/* Remove local reference to the object */
|
||||
@ -512,9 +539,7 @@ Cleanup:
|
||||
*
|
||||
* FUNCTION: AcpiExCreateProcessor
|
||||
*
|
||||
* PARAMETERS: Op - Op containing the Processor definition and
|
||||
* args
|
||||
* ProcessorNode - Parent Node for the processor object
|
||||
* PARAMETERS: WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -533,7 +558,7 @@ AcpiExCreateProcessor (
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
|
||||
|
||||
|
||||
/* Create the processor object */
|
||||
@ -568,9 +593,7 @@ AcpiExCreateProcessor (
|
||||
*
|
||||
* FUNCTION: AcpiExCreatePowerResource
|
||||
*
|
||||
* PARAMETERS: Op - Op containing the PowerResource definition
|
||||
* and args
|
||||
* PowerNode - Parent Node for the power object
|
||||
* PARAMETERS: WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -589,7 +612,7 @@ AcpiExCreatePowerResource (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
|
||||
|
||||
|
||||
/* Create the power resource object */
|
||||
@ -617,6 +640,7 @@ AcpiExCreatePowerResource (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
@ -624,8 +648,7 @@ AcpiExCreatePowerResource (
|
||||
*
|
||||
* PARAMETERS: AmlStart - First byte of the method's AML
|
||||
* AmlLength - AML byte count for this method
|
||||
* MethodFlags - AML method flag byte
|
||||
* Method - Method Node
|
||||
* WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -645,7 +668,7 @@ AcpiExCreateMethod (
|
||||
UINT8 MethodFlags;
|
||||
|
||||
|
||||
FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
|
||||
|
||||
|
||||
/* Create a new method object */
|
||||
|
Loading…
x
Reference in New Issue
Block a user