mirror of
https://github.com/acpica/acpica/
synced 2025-01-17 06:49:27 +03:00
Fifth lint pass - CLEAN for 32-bit and 64-bit
date 2002.04.12.20.46.00; author rmoore1; state Exp;
This commit is contained in:
parent
001960e595
commit
daeb09876d
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: nsdump - table dumping routines for debug
|
||||
* $Revision: 1.129 $
|
||||
* $Revision: 1.132 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -118,9 +118,7 @@
|
||||
#define __NSDUMP_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acinterp.h"
|
||||
#include "acnamesp.h"
|
||||
#include "actables.h"
|
||||
#include "acparser.h"
|
||||
|
||||
|
||||
@ -309,12 +307,12 @@ AcpiNsDumpOneObject (
|
||||
{
|
||||
if (AcpiNsExistDownstreamSibling (ThisNode + 1))
|
||||
{
|
||||
DownstreamSiblingMask |= (1 << (Level - 1));
|
||||
DownstreamSiblingMask |= ((UINT32) 1 << (Level - 1));
|
||||
AcpiOsPrintf ("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1));
|
||||
DownstreamSiblingMask &= ACPI_UINT32_MAX ^ ((UINT32) 1 << (Level - 1));
|
||||
AcpiOsPrintf ("+");
|
||||
}
|
||||
|
||||
@ -342,14 +340,14 @@ AcpiNsDumpOneObject (
|
||||
|
||||
if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
|
||||
{
|
||||
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
|
||||
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name.Integer));
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we can print out the pertinent information
|
||||
*/
|
||||
AcpiOsPrintf (" %4.4s %-12s %p",
|
||||
(char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode);
|
||||
ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode);
|
||||
|
||||
DbgLevel = AcpiDbgLevel;
|
||||
AcpiDbgLevel = 0;
|
||||
@ -488,7 +486,7 @@ AcpiNsDumpOneObject (
|
||||
ObjDesc->BufferField.BufferObj->Buffer.Node)
|
||||
{
|
||||
AcpiOsPrintf (" Buf [%4.4s]",
|
||||
(char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name);
|
||||
ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -496,23 +494,23 @@ AcpiNsDumpOneObject (
|
||||
case INTERNAL_TYPE_REGION_FIELD:
|
||||
|
||||
AcpiOsPrintf (" Rgn [%4.4s]",
|
||||
(char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name);
|
||||
ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii);
|
||||
break;
|
||||
|
||||
|
||||
case INTERNAL_TYPE_BANK_FIELD:
|
||||
|
||||
AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]",
|
||||
(char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name,
|
||||
(char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name);
|
||||
ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii,
|
||||
ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii);
|
||||
break;
|
||||
|
||||
|
||||
case INTERNAL_TYPE_INDEX_FIELD:
|
||||
|
||||
AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]",
|
||||
(char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name,
|
||||
(char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name);
|
||||
ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii,
|
||||
ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii);
|
||||
break;
|
||||
|
||||
|
||||
@ -536,8 +534,10 @@ AcpiNsDumpOneObject (
|
||||
ObjDesc->CommonField.BitLength,
|
||||
ObjDesc->CommonField.AccessByteWidth);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ AcpiNsDumpOneObject (
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_DESC_TYPE_INTERNAL:
|
||||
case ACPI_DESC_TYPE_OPERAND:
|
||||
|
||||
ObjType = ObjDesc->Common.Type;
|
||||
|
||||
@ -660,7 +660,7 @@ AcpiNsDumpOneObject (
|
||||
|
||||
/* If value is NOT an internal object, we are done */
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -671,11 +671,11 @@ AcpiNsDumpOneObject (
|
||||
switch (ObjType)
|
||||
{
|
||||
case ACPI_TYPE_STRING:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer;
|
||||
ObjDesc = (void *) ObjDesc->String.Pointer;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer;
|
||||
ObjDesc = (void *) ObjDesc->Buffer.Pointer;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
@ -683,26 +683,26 @@ AcpiNsDumpOneObject (
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements;
|
||||
ObjDesc = (void *) ObjDesc->Package.Elements;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart;
|
||||
ObjDesc = (void *) ObjDesc->Method.AmlStart;
|
||||
break;
|
||||
|
||||
case INTERNAL_TYPE_REGION_FIELD:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj;
|
||||
ObjDesc = (void *) ObjDesc->Field.RegionObj;
|
||||
break;
|
||||
|
||||
case INTERNAL_TYPE_BANK_FIELD:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj;
|
||||
ObjDesc = (void *) ObjDesc->BankField.RegionObj;
|
||||
break;
|
||||
|
||||
case INTERNAL_TYPE_INDEX_FIELD:
|
||||
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj;
|
||||
ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
@ -750,8 +750,9 @@ AcpiNsDumpObjects (
|
||||
Info.DisplayType = DisplayType;
|
||||
|
||||
|
||||
AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
|
||||
(void *) &Info, NULL);
|
||||
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
|
||||
ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
|
||||
(void *) &Info, NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -794,7 +795,7 @@ AcpiNsDumpOneDevice (
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
|
||||
Info.HardwareId,
|
||||
ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
|
||||
Info.CurrentStatus));
|
||||
@ -818,6 +819,7 @@ void
|
||||
AcpiNsDumpRootDevices (void)
|
||||
{
|
||||
ACPI_HANDLE SysBusHandle;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME ("NsDumpRootDevices");
|
||||
@ -830,11 +832,17 @@ AcpiNsDumpRootDevices (void)
|
||||
return;
|
||||
}
|
||||
|
||||
AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
|
||||
Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
|
||||
AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiNsDumpOneDevice, NULL, NULL);
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle,
|
||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||
AcpiNsDumpOneDevice, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -914,7 +922,7 @@ AcpiNsDumpEntry (
|
||||
Info.OwnerId = ACPI_UINT32_MAX;
|
||||
Info.DisplayType = ACPI_DISPLAY_SUMMARY;
|
||||
|
||||
AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
|
||||
(void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Module Name: nseval - Object evaluation interfaces -- includes control
|
||||
* method lookup and execution.
|
||||
* $Revision: 1.103 $
|
||||
* $Revision: 1.114 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -10,7 +10,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
|
||||
@ -119,14 +119,13 @@
|
||||
#define __NSEVAL_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
#include "acparser.h"
|
||||
#include "acinterp.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_NAMESPACE
|
||||
MODULE_NAME ("nseval")
|
||||
ACPI_MODULE_NAME ("nseval")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -165,7 +164,7 @@ AcpiNsEvaluateRelative (
|
||||
ACPI_GENERIC_STATE ScopeInfo;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("NsEvaluateRelative");
|
||||
ACPI_FUNCTION_TRACE ("NsEvaluateRelative");
|
||||
|
||||
|
||||
/*
|
||||
@ -186,12 +185,16 @@ AcpiNsEvaluateRelative (
|
||||
|
||||
/* Get the prefix handle and Node */
|
||||
|
||||
AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
PrefixNode = AcpiNsMapHandleToNode (Handle);
|
||||
if (!PrefixNode)
|
||||
{
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AE_BAD_PARAMETER;
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -200,14 +203,14 @@ AcpiNsEvaluateRelative (
|
||||
|
||||
ScopeInfo.Scope.Node = PrefixNode;
|
||||
Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
|
||||
IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
|
||||
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
||||
&Node);
|
||||
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object [%s] not found [%s]\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
|
||||
Pathname, AcpiFormatException (Status)));
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -216,12 +219,12 @@ AcpiNsEvaluateRelative (
|
||||
* Now that we have a handle to the object, we can attempt
|
||||
* to evaluate it.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
|
||||
Pathname, Node, Node->Object));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
|
||||
Pathname, Node, AcpiNsGetAttachedObject (Node)));
|
||||
|
||||
Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
|
||||
Pathname));
|
||||
|
||||
Cleanup:
|
||||
@ -262,7 +265,7 @@ AcpiNsEvaluateByName (
|
||||
NATIVE_CHAR *InternalPath = NULL;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("NsEvaluateByName");
|
||||
ACPI_FUNCTION_TRACE ("NsEvaluateByName");
|
||||
|
||||
|
||||
/* Build an internal name string for the method */
|
||||
@ -273,19 +276,23 @@ AcpiNsEvaluateByName (
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Lookup the name in the namespace */
|
||||
|
||||
Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
|
||||
IMODE_EXECUTE, NS_NO_UPSEARCH, NULL,
|
||||
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
||||
&Node);
|
||||
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object at [%s] was not found, status=%.4X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X\n",
|
||||
Pathname, Status));
|
||||
goto Cleanup;
|
||||
}
|
||||
@ -294,12 +301,12 @@ AcpiNsEvaluateByName (
|
||||
* Now that we have a handle to the object, we can attempt
|
||||
* to evaluate it.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n",
|
||||
Pathname, Node, Node->Object));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
|
||||
Pathname, Node, AcpiNsGetAttachedObject (Node)));
|
||||
|
||||
Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*** Completed eval of object %s ***\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
|
||||
Pathname));
|
||||
|
||||
|
||||
@ -346,7 +353,7 @@ AcpiNsEvaluateByHandle (
|
||||
ACPI_OPERAND_OBJECT *LocalReturnObject;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("NsEvaluateByHandle");
|
||||
ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
|
||||
|
||||
|
||||
/* Check if namespace has been initialized */
|
||||
@ -372,12 +379,16 @@ AcpiNsEvaluateByHandle (
|
||||
|
||||
/* Get the prefix handle and Node */
|
||||
|
||||
AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
Node = AcpiNsMapHandleToNode (Handle);
|
||||
if (!Node)
|
||||
{
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
@ -431,13 +442,9 @@ AcpiNsEvaluateByHandle (
|
||||
*ReturnObject = LocalReturnObject;
|
||||
}
|
||||
|
||||
/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
|
||||
|
||||
/* Map AE_RETURN_VALUE to AE_OK, we are done with it */
|
||||
|
||||
if (Status == AE_CTRL_RETURN_VALUE)
|
||||
{
|
||||
Status = AE_OK;
|
||||
}
|
||||
Status = AE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -477,7 +484,7 @@ AcpiNsExecuteControlMethod (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("NsExecuteControlMethod");
|
||||
ACPI_FUNCTION_TRACE ("NsExecuteControlMethod");
|
||||
|
||||
|
||||
/* Verify that there is a method associated with this object */
|
||||
@ -487,21 +494,16 @@ AcpiNsExecuteControlMethod (
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
|
||||
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
||||
}
|
||||
|
||||
ACPI_DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing",
|
||||
ACPI_LV_INFO, _COMPONENT);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %p Length %x]\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
|
||||
ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1));
|
||||
|
||||
DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing",
|
||||
ACPI_LV_NAMES, _COMPONENT);
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n",
|
||||
ObjDesc->Method.AmlStart + 1));
|
||||
|
||||
|
||||
/*
|
||||
* Unlock the namespace before execution. This allows namespace access
|
||||
* via the external Acpi* interfaces while a method is being executed.
|
||||
@ -509,7 +511,11 @@ AcpiNsExecuteControlMethod (
|
||||
* interpreter locks to ensure that no thread is using the portion of the
|
||||
* namespace that is being deleted.
|
||||
*/
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute the method via the interpreter. The interpreter is locked
|
||||
@ -538,7 +544,7 @@ AcpiNsExecuteControlMethod (
|
||||
*
|
||||
* DESCRIPTION: Return the current value of the object
|
||||
*
|
||||
* MUTEX: Assumes namespace is locked
|
||||
* MUTEX: Assumes namespace is locked, leaves namespace unlocked
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -548,118 +554,62 @@ AcpiNsGetObjectValue (
|
||||
ACPI_OPERAND_OBJECT **ReturnObjDesc)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
ACPI_OPERAND_OBJECT *SourceDesc;
|
||||
ACPI_NAMESPACE_NODE *ResolvedNode = Node;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("NsGetObjectValue");
|
||||
ACPI_FUNCTION_TRACE ("NsGetObjectValue");
|
||||
|
||||
|
||||
/*
|
||||
* We take the value from certain objects directly
|
||||
* Objects require additional resolution steps (e.g., the
|
||||
* Node may be a field that must be read, etc.) -- we can't just grab
|
||||
* the object out of the node.
|
||||
*/
|
||||
if ((Node->Type == ACPI_TYPE_PROCESSOR) ||
|
||||
(Node->Type == ACPI_TYPE_POWER))
|
||||
|
||||
/*
|
||||
* Use ResolveNodeToValue() to get the associated value. This call
|
||||
* always deletes ObjDesc (allocated above).
|
||||
*
|
||||
* NOTE: we can get away with passing in NULL for a walk state
|
||||
* because ObjDesc is guaranteed to not be a reference to either
|
||||
* a method local or a method argument (because this interface can only be
|
||||
* called from the AcpiEvaluate external interface, never called from
|
||||
* a running control method.)
|
||||
*
|
||||
* Even though we do not directly invoke the interpreter
|
||||
* for this, we must enter it because we could access an opregion.
|
||||
* The opregion access code assumes that the interpreter
|
||||
* is locked.
|
||||
*
|
||||
* We must release the namespace lock before entering the
|
||||
* intepreter.
|
||||
*/
|
||||
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/*
|
||||
* Create a Reference object to contain the object
|
||||
*/
|
||||
ObjDesc = AcpiUtCreateInternalObject (Node->Type);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the attached object
|
||||
*/
|
||||
SourceDesc = AcpiNsGetAttachedObject (Node);
|
||||
if (!SourceDesc)
|
||||
{
|
||||
Status = AE_NULL_OBJECT;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Just copy from the original to the return object
|
||||
*
|
||||
* TBD: [Future] - need a low-level object copy that handles
|
||||
* the reference count automatically. (Don't want to copy it)
|
||||
*/
|
||||
MEMCPY (ObjDesc, SourceDesc, sizeof (ACPI_OPERAND_OBJECT));
|
||||
ObjDesc->Common.ReferenceCount = 1;
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Other objects require a reference object wrapper which we
|
||||
* then attempt to resolve.
|
||||
*/
|
||||
else
|
||||
{
|
||||
/* Create an Reference object to contain the object */
|
||||
|
||||
ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
|
||||
if (!ObjDesc)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
goto UnlockAndExit;
|
||||
}
|
||||
|
||||
/* Construct a descriptor pointing to the name */
|
||||
|
||||
ObjDesc->Reference.Opcode = (UINT8) AML_NAME_OP;
|
||||
ObjDesc->Reference.Object = (void *) Node;
|
||||
|
||||
/*
|
||||
* Use ResolveToValue() to get the associated value. This call
|
||||
* always deletes ObjDesc (allocated above).
|
||||
*
|
||||
* NOTE: we can get away with passing in NULL for a walk state
|
||||
* because ObjDesc is guaranteed to not be a reference to either
|
||||
* a method local or a method argument
|
||||
*
|
||||
* Even though we do not directly invoke the interpreter
|
||||
* for this, we must enter it because we could access an opregion.
|
||||
* The opregion access code assumes that the interpreter
|
||||
* is locked.
|
||||
*
|
||||
* We must release the namespace lock before entering the
|
||||
* intepreter.
|
||||
*/
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
Status = AcpiExEnterInterpreter ();
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
Status = AcpiExResolveToValue (&ObjDesc, NULL);
|
||||
|
||||
AcpiExExitInterpreter ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If AcpiExResolveToValue() succeeded, the return value was
|
||||
* placed in ObjDesc.
|
||||
*/
|
||||
Status = AcpiExEnterInterpreter ();
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
Status = AE_CTRL_RETURN_VALUE;
|
||||
Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL);
|
||||
/*
|
||||
* If AcpiExResolveNodeToValue() succeeded, the return value was
|
||||
* placed in ResolvedNode.
|
||||
*/
|
||||
AcpiExExitInterpreter ();
|
||||
|
||||
*ReturnObjDesc = ObjDesc;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Returning obj %p\n", *ReturnObjDesc));
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
Status = AE_CTRL_RETURN_VALUE;
|
||||
*ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", ResolvedNode));
|
||||
}
|
||||
}
|
||||
|
||||
/* Namespace is unlocked */
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
|
||||
UnlockAndExit:
|
||||
|
||||
/* Unlock the namespace */
|
||||
|
||||
AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: nsinit - namespace initialization
|
||||
* $Revision: 1.41 $
|
||||
* $Revision: 1.45 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -152,15 +152,11 @@ AcpiNsInitializeObjects (
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"**** Starting initialization of namespace objects ****\n"));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region and Field initialization:"));
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:"));
|
||||
|
||||
/* Set all init info to zero */
|
||||
|
||||
Info.FieldCount = 0;
|
||||
Info.FieldInit = 0;
|
||||
Info.OpRegionCount = 0;
|
||||
Info.OpRegionInit = 0;
|
||||
Info.ObjectCount = 0;
|
||||
|
||||
ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
|
||||
|
||||
/* Walk entire namespace from the supplied root */
|
||||
|
||||
@ -169,13 +165,16 @@ AcpiNsInitializeObjects (
|
||||
&Info, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
|
||||
AcpiFormatException (Status)));
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
|
||||
"\n%d/%d Regions, %d/%d Fields initialized (%d nodes total)\n",
|
||||
Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit,
|
||||
Info.FieldCount, Info.ObjectCount));
|
||||
"\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n",
|
||||
Info.OpRegionInit, Info.OpRegionCount,
|
||||
Info.FieldInit, Info.FieldCount,
|
||||
Info.BufferInit, Info.BufferCount,
|
||||
Info.PackageInit, Info.PackageCount, Info.ObjectCount));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"%d Control Methods found\n", Info.MethodCount));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
@ -212,24 +211,27 @@ AcpiNsInitializeDevices (
|
||||
ACPI_FUNCTION_TRACE ("NsInitializeDevices");
|
||||
|
||||
|
||||
/* Init counters */
|
||||
|
||||
Info.DeviceCount = 0;
|
||||
Info.Num_STA = 0;
|
||||
Info.Num_INI = 0;
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing all Device _STA and_INI methods:"));
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing device _INI methods:"));
|
||||
/* Walk namespace for all objects of type Device */
|
||||
|
||||
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
|
||||
AcpiFormatException (Status)));
|
||||
}
|
||||
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
|
||||
"\n%d Devices found: %d _STA, %d _INI\n",
|
||||
"\n%d Devices found containing: %d _STA, %d _INI methods\n",
|
||||
Info.DeviceCount, Info.Num_STA, Info.Num_INI));
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
@ -275,7 +277,6 @@ AcpiNsInitOneObject (
|
||||
|
||||
Info->ObjectCount++;
|
||||
|
||||
|
||||
/* And even then, we are only interested in a few object types */
|
||||
|
||||
Type = AcpiNsGetType (ObjHandle);
|
||||
@ -285,12 +286,39 @@ AcpiNsInitOneObject (
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if ((Type != ACPI_TYPE_REGION) &&
|
||||
(Type != ACPI_TYPE_BUFFER_FIELD))
|
||||
/* Increment counters for object types we are looking for */
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case ACPI_TYPE_REGION:
|
||||
Info->OpRegionCount++;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
Info->FieldCount++;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
Info->BufferCount++;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
Info->PackageCount++;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* No init required, just exit now */
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the object is already initialized, nothing else to do
|
||||
*/
|
||||
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Must lock the interpreter before executing AML code
|
||||
@ -301,68 +329,60 @@ AcpiNsInitOneObject (
|
||||
return (Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Each of these types can contain executable AML code within
|
||||
* the declaration.
|
||||
*/
|
||||
switch (Type)
|
||||
{
|
||||
|
||||
case ACPI_TYPE_REGION:
|
||||
|
||||
Info->OpRegionCount++;
|
||||
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Info->OpRegionInit++;
|
||||
Status = AcpiDsGetRegionArguments (ObjDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"%s while getting region arguments [%4.4s]\n",
|
||||
AcpiFormatException (Status), (char *) &Node->Name));
|
||||
}
|
||||
|
||||
if (!(AcpiDbgLevel & ACPI_LV_INIT))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
||||
Info->FieldCount++;
|
||||
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Info->FieldInit++;
|
||||
Status = AcpiDsGetBufferFieldArguments (ObjDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"%s while getting buffer field arguments [%4.4s]\n",
|
||||
AcpiFormatException (Status), (char *) &Node->Name));
|
||||
}
|
||||
if (!(AcpiDbgLevel & ACPI_LV_INIT))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
Info->BufferInit++;
|
||||
Status = AcpiDsGetBufferArguments (ObjDesc);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
Info->PackageInit++;
|
||||
Status = AcpiDsGetPackageArguments (ObjDesc);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* No other types can get here */
|
||||
break;
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Could not execute arguments for [%4.4s] (%s), %s\n",
|
||||
Node->Name.Ascii, AcpiUtGetTypeName (Type), AcpiFormatException (Status)));
|
||||
}
|
||||
|
||||
if (!(AcpiDbgLevel & ACPI_LV_INIT))
|
||||
{
|
||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
|
||||
}
|
||||
|
||||
/*
|
||||
* We ignore errors from above, and always return OK, since
|
||||
* we don't want to abort the walk on a single error.
|
||||
* we don't want to abort the walk on any single error.
|
||||
*/
|
||||
AcpiExExitInterpreter ();
|
||||
return (AE_OK);
|
||||
@ -446,7 +466,6 @@ AcpiNsInitOneDevice (
|
||||
return_ACPI_STATUS(AE_CTRL_DEPTH);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The device is present. Run _INI.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user