Belated vendor update to the Intel ACPI CA 20010208 snapshot.

This commit is contained in:
Mike Smith 2001-03-05 02:15:19 +00:00
parent 838fd87dd9
commit 7f97233002
69 changed files with 2550 additions and 1945 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmobject - ACPI object create/delete/size/cache routines
* $Revision: 35 $
* $Revision: 36 $
*
*****************************************************************************/
@ -127,7 +127,7 @@
MODULE_NAME ("cmobject")
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: _CmCreateInternalObject
*
@ -141,11 +141,11 @@
*
* DESCRIPTION: Create and initialize a new internal object.
*
* NOTE:
* We always allocate the worst-case object descriptor because these
* objects are cached, and we want them to be one-size-satisifies-any-request.
* This in itself may not be the most memory efficient, but the efficiency
* of the object cache should more than make up for this!
* NOTE: We always allocate the worst-case object descriptor because
* these objects are cached, and we want them to be
* one-size-satisifies-any-request. This in itself may not be
* the most memory efficient, but the efficiency of the object
* cache should more than make up for this!
*
******************************************************************************/
@ -187,7 +187,7 @@ _CmCreateInternalObject (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmValidInternalObject
*
@ -195,7 +195,7 @@ _CmCreateInternalObject (
*
* RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT
*
*****************************************************************************/
******************************************************************************/
BOOLEAN
AcpiCmValidInternalObject (
@ -257,7 +257,7 @@ AcpiCmValidInternalObject (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: _CmAllocateObjectDesc
*
@ -271,7 +271,7 @@ AcpiCmValidInternalObject (
* DESCRIPTION: Allocate a new object descriptor. Gracefully handle
* error conditions.
*
****************************************************************************/
******************************************************************************/
void *
_CmAllocateObjectDesc (
@ -341,7 +341,7 @@ _CmAllocateObjectDesc (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmDeleteObjectDesc
*
@ -351,7 +351,7 @@ _CmAllocateObjectDesc (
*
* DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
*
****************************************************************************/
******************************************************************************/
void
AcpiCmDeleteObjectDesc (
@ -414,7 +414,7 @@ AcpiCmDeleteObjectDesc (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmDeleteObjectCache
*
@ -461,7 +461,7 @@ AcpiCmDeleteObjectCache (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmInitStaticObject
*
@ -473,7 +473,7 @@ AcpiCmDeleteObjectCache (
* DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic
* deletion of the object.
*
****************************************************************************/
******************************************************************************/
void
AcpiCmInitStaticObject (
@ -512,14 +512,14 @@ AcpiCmInitStaticObject (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetSimpleObjectSize
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length is returned
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length is returned
*
* RETURN: Status - the status of the call
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain a simple object for return to an API user.
@ -531,19 +531,19 @@ AcpiCmInitStaticObject (
ACPI_STATUS
AcpiCmGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
UINT32 Length;
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObj);
FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObject);
/* Handle a null object (Could be a uninitialized package element -- which is legal) */
if (!InternalObj)
if (!InternalObject)
{
*ObjLength = 0;
return_ACPI_STATUS (AE_OK);
@ -554,7 +554,7 @@ AcpiCmGetSimpleObjectSize (
Length = sizeof (ACPI_OBJECT);
if (VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_NAMED))
if (VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_NAMED))
{
/* Object is a named object (reference), just return the length */
@ -571,18 +571,18 @@ AcpiCmGetSimpleObjectSize (
* TBD:[Investigate] do strings and buffers require alignment also?
*/
switch (InternalObj->Common.Type)
switch (InternalObject->Common.Type)
{
case ACPI_TYPE_STRING:
Length += InternalObj->String.Length + 1;
Length += InternalObject->String.Length + 1;
break;
case ACPI_TYPE_BUFFER:
Length += InternalObj->Buffer.Length;
Length += InternalObject->Buffer.Length;
break;
@ -602,11 +602,11 @@ AcpiCmGetSimpleObjectSize (
* The only type that should be here is opcode AML_NAMEPATH_OP -- since
* this means an object reference
*/
if (InternalObj->Reference.OpCode != AML_NAMEPATH_OP)
if (InternalObject->Reference.OpCode != AML_NAMEPATH_OP)
{
DEBUG_PRINT (ACPI_ERROR,
("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n",
InternalObj->Reference.OpCode, InternalObj));
InternalObject->Reference.OpCode, InternalObject));
Status = AE_TYPE;
}
break;
@ -616,7 +616,7 @@ AcpiCmGetSimpleObjectSize (
DEBUG_PRINT (ACPI_ERROR,
("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n",
InternalObj->Common.Type, InternalObj));
InternalObject->Common.Type, InternalObject));
Status = AE_TYPE;
break;
}
@ -634,161 +634,124 @@ AcpiCmGetSimpleObjectSize (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetPackageObjectSize
* FUNCTION: AcpiCmCopyPackageToInternal
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length is returned
* PARAMETERS: ACPI_PKG_CALLBACK
*
* RETURN: Status - the status of the call
*
* DESCRIPTION: This function is called to determine the space required to contain
* a package object for return to an API user.
* DESCRIPTION:
*
* This is moderately complex since a package contains other objects
* including packages.
******************************************************************************/
ACPI_STATUS
AcpiCmGetElementLength (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
ACPI_GENERIC_STATE *State,
void *Context)
{
ACPI_STATUS Status = AE_OK;
ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
UINT32 ObjectSpace;
switch (ObjectType)
{
case 0:
/*
* Simple object - just get the size (Null object/entry is handled
* here also) and sum it into the running package length
*/
Status = AcpiCmGetSimpleObjectSize (SourceObject, &ObjectSpace);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Info->Length += ObjectSpace;
break;
case 1:
/* Package - nothing much to do here, let the walk handle it */
Info->NumPackages++;
State->Pkg.ThisTargetObj = NULL;
break;
default:
return (AE_BAD_PARAMETER);
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmGetPackageObjectSize
*
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length is returned
*
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain a package object for return to an API user.
*
* This is moderately complex since a package contains other
* objects including packages.
*
******************************************************************************/
ACPI_STATUS
AcpiCmGetPackageObjectSize (
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
ACPI_OPERAND_OBJECT *ThisInternalObj;
ACPI_OPERAND_OBJECT *ParentObj[MAX_PACKAGE_DEPTH];
ACPI_OPERAND_OBJECT *ThisParent;
UINT32 ThisIndex;
UINT32 Index[MAX_PACKAGE_DEPTH];
UINT32 Length = 0;
UINT32 ObjectSpace;
UINT32 CurrentDepth = 0;
UINT32 PackageCount = 1;
ACPI_STATUS Status;
ACPI_PKG_INFO Info;
FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObj);
FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObject);
/* Init the package stack TBD: replace with linked list */
Info.Length = 0;
Info.ObjectSpace = 0;
Info.NumPackages = 1;
MEMSET(ParentObj, 0, MAX_PACKAGE_DEPTH);
MEMSET(Index, 0, MAX_PACKAGE_DEPTH);
Status = AcpiCmWalkPackageTree (InternalObject, NULL,
AcpiCmGetElementLength, &Info);
ParentObj[0] = InternalObj;
/*
* We have handled all of the objects in all levels of the package.
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
Info.Length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
Info.NumPackages;
while (1)
{
ThisParent = ParentObj[CurrentDepth];
ThisIndex = Index[CurrentDepth];
ThisInternalObj = ThisParent->Package.Elements[ThisIndex];
/* Return the total package length */
/*
* Check for 1) An uninitialized package element. It is completely
* legal to declare a package and leave it uninitialized
* 2) Any type other than a package. Packages are handled
* below.
*/
if ((!ThisInternalObj) ||
(!IS_THIS_OBJECT_TYPE (ThisInternalObj, ACPI_TYPE_PACKAGE)))
{
/*
* Simple object - just get the size (Null object/entry handled
* also)
*/
Status =
AcpiCmGetSimpleObjectSize (ThisInternalObj, &ObjectSpace);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Length += ObjectSpace;
Index[CurrentDepth]++;
while (Index[CurrentDepth] >=
ParentObj[CurrentDepth]->Package.Count)
{
/*
* We've handled all of the objects at
* this level, This means that we have
* just completed a package. That package
* may have contained one or more packages
* itself.
*/
if (CurrentDepth == 0)
{
/*
* We have handled all of the objects
* in the top level package just add the
* length of the package objects and
* get out. Round up to the next machine
* word.
*/
Length +=
ROUND_UP_TO_NATIVE_WORD (
sizeof (ACPI_OBJECT)) *
PackageCount;
*ObjLength = Length;
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index
* past the just completed package object.
*/
CurrentDepth--;
Index[CurrentDepth]++;
}
}
else
{
/*
* This object is a package
* -- go one level deeper
*/
PackageCount++;
if (CurrentDepth < MAX_PACKAGE_DEPTH-1)
{
CurrentDepth++;
ParentObj[CurrentDepth] = ThisInternalObj;
Index[CurrentDepth] = 0;
}
else
{
/*
* Too many nested levels of packages for us
* to handle
*/
DEBUG_PRINT (ACPI_ERROR,
("CmGetPackageObjectSize: Pkg nested too deep (max %X)\n",
MAX_PACKAGE_DEPTH));
return_ACPI_STATUS (AE_LIMIT);
}
}
}
*ObjLength = Info.Length;
return_ACPI_STATUS (Status);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetObjectSize
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length will be returned
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length will be returned
*
* RETURN: Status - the status of the call
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain an object for return to an API user.
@ -797,23 +760,21 @@ AcpiCmGetPackageObjectSize (
ACPI_STATUS
AcpiCmGetObjectSize(
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
ACPI_STATUS Status;
if ((VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_INTERNAL)) &&
(IS_THIS_OBJECT_TYPE (InternalObj, ACPI_TYPE_PACKAGE)))
if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) &&
(IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE)))
{
Status =
AcpiCmGetPackageObjectSize (InternalObj, ObjLength);
Status = AcpiCmGetPackageObjectSize (InternalObject, ObjLength);
}
else
{
Status =
AcpiCmGetSimpleObjectSize (InternalObj, ObjLength);
Status = AcpiCmGetSimpleObjectSize (InternalObject, ObjLength);
}
return (Status);

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: cmutils - common utility procedures
* $Revision: 23 $
* $Revision: 27 $
*
******************************************************************************/
@ -474,6 +474,44 @@ AcpiCmCreateUpdateStateAndPush (
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreatePkgStateAndPush
*
* PARAMETERS: *Object - Object to be added to the new state
* Action - Increment/Decrement
* StateList - List the state will be added to
*
* RETURN: None
*
* DESCRIPTION: Create a new state and push it
*
******************************************************************************/
ACPI_STATUS
AcpiCmCreatePkgStateAndPush (
void *InternalObject,
void *ExternalObject,
UINT16 Index,
ACPI_GENERIC_STATE **StateList)
{
ACPI_GENERIC_STATE *State;
State = AcpiCmCreatePkgState (InternalObject, ExternalObject, Index);
if (!State)
{
return (AE_NO_MEMORY);
}
AcpiCmPushGenericState (StateList, State);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmPushGenericState
@ -648,6 +686,54 @@ AcpiCmCreateUpdateState (
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreatePkgState
*
* PARAMETERS: Object - Initial Object to be installed in the
* state
* Action - Update action to be performed
*
* RETURN: Status
*
* DESCRIPTION: Create an "Update State" - a flavor of the generic state used
* to update reference counts and delete complex objects such
* as packages.
*
******************************************************************************/
ACPI_GENERIC_STATE *
AcpiCmCreatePkgState (
void *InternalObject,
void *ExternalObject,
UINT16 Index)
{
ACPI_GENERIC_STATE *State;
FUNCTION_TRACE_PTR ("CmCreatePkgState", InternalObject);
/* Create the generic state object */
State = AcpiCmCreateGenericState ();
if (!State)
{
return (NULL);
}
/* Init fields specific to the update struct */
State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
State->Pkg.DestObject = ExternalObject;
State->Pkg.Index = Index;
State->Pkg.NumPackages = 1;
return_PTR (State);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreateControlState
@ -793,19 +879,24 @@ ACPI_STATUS
AcpiCmResolvePackageReferences (
ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT32 Count;
ACPI_OPERAND_OBJECT *SubObject;
UINT32 Count;
ACPI_OPERAND_OBJECT *SubObject;
FUNCTION_TRACE ("AcpiCmResolvePackageReferences");
if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
/* Must be a package */
/* The object must be a package */
REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
return_ACPI_STATUS(AE_ERROR);
}
/*
* TBD: what about nested packages? */
for (Count = 0; Count < ObjDesc->Package.Count; Count++)
{
SubObject = ObjDesc->Package.Elements[Count];
@ -833,6 +924,181 @@ AcpiCmResolvePackageReferences (
return_ACPI_STATUS(AE_OK);
}
#ifdef ACPI_DEBUG
/******************************************************************************
*
* FUNCTION: AcpiCmDisplayInitPathname
*
* PARAMETERS: ObjHandle - Handle whose pathname will be displayed
* Path - Additional path string to be appended
*
* RETURN: ACPI_STATUS
*
* DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
*
*****************************************************************************/
void
AcpiCmDisplayInitPathname (
ACPI_HANDLE ObjHandle,
char *Path)
{
ACPI_STATUS Status;
UINT32 Length = 128;
char Buffer[128];
Status = AcpiNsHandleToPathname (ObjHandle, &Length, Buffer);
if (ACPI_SUCCESS (Status))
{
if (Path)
{
DEBUG_PRINT (TRACE_INIT, ("%s.%s\n", Buffer, Path))
}
else
{
DEBUG_PRINT (TRACE_INIT, ("%s\n", Buffer))
}
}
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiCmWalkPackageTree
*
* PARAMETERS: ObjDesc - The Package object on which to resolve refs
*
* RETURN: Status
*
* DESCRIPTION: Walk through a package
*
******************************************************************************/
ACPI_STATUS
AcpiCmWalkPackageTree (
ACPI_OPERAND_OBJECT *SourceObject,
void *TargetObject,
ACPI_PKG_CALLBACK WalkCallback,
void *Context)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_GENERIC_STATE *State;
UINT32 ThisIndex;
ACPI_OPERAND_OBJECT *ThisSourceObj;
FUNCTION_TRACE ("AcpiCmWalkPackageTree");
State = AcpiCmCreatePkgState (SourceObject, TargetObject, 0);
if (!State)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
while (State)
{
ThisIndex = State->Pkg.Index;
ThisSourceObj = (ACPI_OPERAND_OBJECT *)
State->Pkg.SourceObject->Package.Elements[ThisIndex];
/*
* Check for
* 1) An uninitialized package element. It is completely
* legal to declare a package and leave it uninitialized
* 2) Not an internal object - can be a namespace node instead
* 3) Any type other than a package. Packages are handled in else case below.
*/
if ((!ThisSourceObj) ||
(!VALID_DESCRIPTOR_TYPE (
ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) ||
(!IS_THIS_OBJECT_TYPE (
ThisSourceObj, ACPI_TYPE_PACKAGE)))
{
Status = WalkCallback (0, ThisSourceObj, State, Context);
if (ACPI_FAILURE (Status))
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (Status);
}
State->Pkg.Index++;
while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count)
{
/*
* We've handled all of the objects at this level, This means
* that we have just completed a package. That package may
* have contained one or more packages itself.
*
* Delete this state and pop the previous state (package).
*/
AcpiCmDeleteGenericState (State);
State = AcpiCmPopGenericState (&StateList);
/* Finished when there are no more states */
if (!State)
{
/*
* We have handled all of the objects in the top level
* package just add the length of the package objects
* and exit
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index past the just
* completed package object.
*/
State->Pkg.Index++;
}
}
else
{
/* This is a sub-object of type package */
Status = WalkCallback (1, ThisSourceObj, State, Context);
if (ACPI_FAILURE (Status))
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (Status);
}
/*
* The callback above returned a new target package object.
*/
/*
* Push the current state and create a new one
*/
AcpiCmPushGenericState (&StateList, State);
State = AcpiCmCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0);
if (!State)
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
}
/* We should never get here */
return (AE_AML_INTERNAL);
}
/*******************************************************************************
*
@ -845,7 +1111,7 @@ AcpiCmResolvePackageReferences (
*
* RETURN: None
*
* DESCRIPTION: Print error message from KD table
* DESCRIPTION: Print error message
*
******************************************************************************/
@ -872,7 +1138,7 @@ _ReportError (
*
* RETURN: None
*
* DESCRIPTION: Print warning message from KD table
* DESCRIPTION: Print warning message
*
******************************************************************************/
@ -898,7 +1164,7 @@ _ReportWarning (
*
* RETURN: None
*
* DESCRIPTION: Print information message from KD table
* DESCRIPTION: Print information message
*
******************************************************************************/

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmxface - External interfaces for "global" ACPI functions
* $Revision: 62 $
* $Revision: 64 $
*
*****************************************************************************/
@ -272,9 +272,8 @@ AcpiEnableSubsystem (
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
/* TBD: workaround. Old Lions don't enable properly */
DEBUG_PRINT(ACPI_WARN, ("AcpiEnable failed.\n"));
/*return_ACPI_STATUS (Status);*/
return_ACPI_STATUS (Status);
}
}
@ -299,15 +298,14 @@ AcpiEnableSubsystem (
/*
* Initialize all device objects in the namespace
* This runs the _STA, _INI, and _HID methods, and detects
* the PCI root bus(es)
* This runs the _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI Devices\n"));
Status = AcpiNsInitializeDevices (Flags & ACPI_NO_PCI_INIT);
Status = AcpiNsInitializeDevices ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -316,7 +314,7 @@ AcpiEnableSubsystem (
/*
* Initialize the objects that remain unitialized. This
* Initialize the objects that remain uninitialized. This
* runs the executable AML that is part of the declaration of OpRegions
* and Fields.
*/

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 45 $
* $Revision: 46 $
*
******************************************************************************/
@ -995,4 +995,76 @@ AcpiDbSetScope (
AcpiOsPrintf ("New scope: %s\n", ScopeBuf);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayResources
*
* PARAMETERS: ObjectArg - String with hex value of the object
*
* RETURN: None
*
* DESCRIPTION:
*
******************************************************************************/
void
AcpiDbDisplayResources (
NATIVE_CHAR *ObjectArg)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
PCI_ROUTING_TABLE *Prt;
UINT32 i;
AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
/* Convert string to object pointer */
ObjDesc = (ACPI_OPERAND_OBJECT *) STRTOUL (ObjectArg, NULL, 16);
/* Prepare for a return object of arbitrary size */
ReturnObj.Pointer = Buffer;
ReturnObj.Length = BUFFER_SIZE;
Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiCmFormatException (Status));
goto Cleanup;
}
ReturnObj.Pointer = Buffer;
ReturnObj.Length = BUFFER_SIZE;
Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiCmFormatException (Status));
goto Cleanup;
}
Prt = (PCI_ROUTING_TABLE *) Buffer;
i = 0;
while ((char *) Prt < (Buffer + ReturnObj.Length))
{
AcpiOsPrintf ("Prt[%d] Src=%s: Addr=%X\n", i, Prt->Source, Prt->Address);
i++;
Prt = (PCI_ROUTING_TABLE *) (((char *) Prt) + Prt->Length);
}
Cleanup:
AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
return;
}
#endif /* ENABLE_DEBUGGER */

View File

@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 37 $
* $Revision: 38 $
*
******************************************************************************/
@ -240,6 +240,10 @@ AcpiDbOpenDebugFile (
STRCPY (DebugFilename, Name);
OutputToFile = TRUE;
}
else
{
AcpiOsPrintf ("Could not open debug file %s\n", Name);
}
#endif
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 54 $
* $Revision: 56 $
*
******************************************************************************/
@ -153,6 +153,7 @@ BOOLEAN opt_disasm = FALSE;
BOOLEAN opt_stats = FALSE;
BOOLEAN opt_parse_jit = FALSE;
BOOLEAN opt_verbose = TRUE;
BOOLEAN opt_ini_methods = TRUE;
/*
@ -199,6 +200,7 @@ enum AcpiAmlDebuggerCommands
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
CMD_SET,
CMD_STATS,
@ -251,6 +253,7 @@ COMMAND_INFO Commands[] =
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESOURCES", 1},
{"RESULTS", 0},
{"SET", 3},
{"STATS", 0},
@ -337,6 +340,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
AcpiOsPrintf ("Resources xxx Get and display resources\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
return;
@ -765,6 +769,10 @@ AcpiDbCommandDispatch (
AcpiDbFindReferences (Args[1]);
break;
case CMD_RESOURCES:
AcpiDbDisplayResources (Args[1]);
break;
case CMD_RESULTS:
AcpiDbDisplayResults ();
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
@ -194,7 +194,10 @@ AcpiDsInitOneObject (
Info->MethodCount++;
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
/*
* Set the execution data width (32 or 64) based upon the

View File

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 30 $
* $Revision: 32 $
*
*****************************************************************************/
@ -169,6 +169,7 @@ AcpiDsGetFieldUnitArguments (
ExtraDesc = ObjDesc->FieldUnit.Extra;
Node = ObjDesc->FieldUnit.Node;
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Field]"));
DEBUG_PRINT (TRACE_EXEC,
("DsGetFieldUnitArguments: [%4.4s] FieldUnit JIT Init\n",
&Node->Name));
@ -289,6 +290,8 @@ AcpiDsGetRegionArguments (
ExtraDesc = ObjDesc->Region.Extra;
Node = ObjDesc->Region.Node;
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Operation Region]"));
DEBUG_PRINT (TRACE_EXEC,
("DsGetRegionArguments: [%4.4s] OpRegion Init at AML %p[%x]\n",
&Node->Name, ExtraDesc->Extra.Pcode, *(UINT32*) ExtraDesc->Extra.Pcode));

View File

@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose AcpiEvent
* handling and dispatch
* $Revision: 33 $
* $Revision: 34 $
*
*****************************************************************************/
@ -149,7 +149,7 @@ AcpiEvInitialize (
FUNCTION_TRACE ("EvInitialize");
/* Make sure we've got ACPI tables */
/* Make sure we have ACPI tables */
if (!AcpiGbl_DSDT)
{
@ -871,7 +871,7 @@ UINT32
AcpiEvGpeDispatch (
UINT32 GpeNumber)
{
ACPI_GPE_LEVEL_INFO GpeInfo;
ACPI_GPE_LEVEL_INFO GpeInfo;
FUNCTION_TRACE ("EvGpeDispatch");
@ -891,65 +891,64 @@ AcpiEvGpeDispatch (
*/
AcpiHwDisableGpe (GpeNumber);
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
/*
* Edge-Triggered?
* ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
/*
* Edge-Triggered?
* ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
AcpiHwClearGpe (GpeNumber);
}
/*
* Function Handler (e.g. EC)?
*/
if (GpeInfo.Handler)
if (GpeInfo.Handler)
{
/* Invoke function handler (at interrupt level). */
GpeInfo.Handler (GpeInfo.Context);
/* Invoke function handler (at interrupt level). */
GpeInfo.Handler (GpeInfo.Context);
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/* Enable GPE */
AcpiHwEnableGpe (GpeNumber);
AcpiHwClearGpe (GpeNumber);
}
/*
* Method Handler (e.g. _Exx/_Lxx)?
*/
else if (GpeInfo.MethodHandle)
/* Enable GPE */
AcpiHwEnableGpe (GpeNumber);
}
/*
* Method Handler (e.g. _Exx/_Lxx)?
*/
else if (GpeInfo.MethodHandle)
{
if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod, (void*)(NATIVE_UINT)GpeNumber)))
{
/*
* Shoudn't occur, but if it does report an error. Note that
* the GPE will remain disabled until the ACPI Core Subsystem
* is restarted, or the handler is removed/reinstalled.
*/
REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
}
}
/*
* No Handler? Report an error and leave the GPE disabled.
*/
else
{
REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/*
* Shoudn't occur, but if it does report an error. Note that
* the GPE will remain disabled until the ACPI Core Subsystem
* is restarted, or the handler is removed/reinstalled.
*/
REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
}
}
/*
* No Handler? Report an error and leave the GPE disabled.
*/
else
{
REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
}
return_VALUE (INTERRUPT_HANDLED);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 94 $
* $Revision: 96 $
*
*****************************************************************************/
@ -262,6 +262,7 @@ AcpiEvExecuteRegMethod (
/*
* Execute the method, no return value
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (RegionObj->Region.Extra->Extra.Method_REG, " [Method]"));
Status = AcpiNsEvaluateByHandle (RegionObj->Region.Extra->Extra.Method_REG, Params, NULL);
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 5 $
* $Revision: 7 $
*
*****************************************************************************/
@ -282,15 +282,14 @@ AcpiEnterSleepState (
DEBUG_PRINT(ACPI_OK, ("Entering S%d\n", SleepState));
/* the old version was disabling interrupts. let's try it without
* and see how that works
*/
/*disable();*/
disable();
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL,
(1 << AcpiHwGetBitShift (SLP_EN_MASK)));
/*enable();*/
enable();
return_ACPI_STATUS (AE_OK);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
* $Revision: 4 $
* $Revision: 5 $
*
*****************************************************************************/
@ -235,7 +235,7 @@ AcpiGetTimerDuration (
/*
* Compute Tick Delta:
* -------------------
* Handle timer rollovers on 24- versus 32-bit timers.
* Handle (max one) timer rollovers on 24- versus 32-bit timers.
*/
if (StartTicks < EndTicks)
{
@ -246,7 +246,7 @@ AcpiGetTimerDuration (
/* 24-bit Timer */
if (0 == AcpiGbl_FADT->TmrValExt)
{
DeltaTicks = (0x00FFFFFF - StartTicks) + EndTicks;
DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
}
/* 32-bit Timer */
else
@ -254,6 +254,11 @@ AcpiGetTimerDuration (
DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
}
}
else
{
*TimeElapsed = 0;
return_ACPI_STATUS (AE_OK);
}
/*
* Compute Duration:

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 87 $
* $Revision: 90 $
*
*****************************************************************************/
@ -118,6 +118,32 @@
#define _ACCOMMON_H
typedef
ACPI_STATUS (*ACPI_PKG_CALLBACK) (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
ACPI_GENERIC_STATE *State,
void *Context);
ACPI_STATUS
AcpiCmWalkPackageTree (
ACPI_OPERAND_OBJECT *SourceObject,
void *TargetObject,
ACPI_PKG_CALLBACK WalkCallback,
void *Context);
typedef struct acpi_pkg_info
{
UINT8 *FreeSpace;
UINT32 Length;
UINT32 ObjectSpace;
UINT32 NumPackages;
} ACPI_PKG_INFO;
#define REF_INCREMENT (UINT16) 0
#define REF_DECREMENT (UINT16) 1
#define REF_FORCE_DELETE (UINT16) 2
@ -285,29 +311,30 @@ AcpiCmBuildPackageObject (
UINT32 *SpaceUsed);
ACPI_STATUS
AcpiCmBuildExternalObject (
AcpiCmCopyIobjectToEobject (
ACPI_OPERAND_OBJECT *Obj,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiCmBuildInternalSimpleObject(
AcpiCmCopyEsimpleToIsimple(
ACPI_OBJECT *UserObj,
ACPI_OPERAND_OBJECT *Obj);
ACPI_STATUS
AcpiCmBuildInternalObject (
AcpiCmCopyEobjectToIobject (
ACPI_OBJECT *Obj,
ACPI_OPERAND_OBJECT *InternalObj);
ACPI_STATUS
AcpiCmCopyInternalSimpleObject (
AcpiCmCopyISimpleToIsimple (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj);
ACPI_STATUS
AcpiCmBuildCopyInternalPackageObject (
AcpiCmCopyIpackageToIpackage (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj);
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState);
/*
@ -617,12 +644,25 @@ AcpiCmCreateUpdateState (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action);
ACPI_GENERIC_STATE *
AcpiCmCreatePkgState (
void *InternalObject,
void *ExternalObject,
UINT16 Index);
ACPI_STATUS
AcpiCmCreateUpdateStateAndPush (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action,
ACPI_GENERIC_STATE **StateList);
ACPI_STATUS
AcpiCmCreatePkgStateAndPush (
void *InternalObject,
void *ExternalObject,
UINT16 Index,
ACPI_GENERIC_STATE **StateList);
ACPI_GENERIC_STATE *
AcpiCmCreateControlState (
void);
@ -655,6 +695,15 @@ ACPI_STATUS
AcpiCmResolvePackageReferences (
ACPI_OPERAND_OBJECT *ObjDesc);
#ifdef ACPI_DEBUG
void
AcpiCmDisplayInitPathname (
ACPI_HANDLE ObjHandle,
char *Path);
#endif
/*
* Memory allocation functions and related macros.

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 53 $
* $Revision: 55 $
*
*****************************************************************************/
@ -144,7 +144,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20010125
#define ACPI_CA_VERSION 0x20010208
/* Maximum objects in the various object caches */
@ -240,10 +240,5 @@
#define RSDP_SCAN_STEP 16
/* Maximum nesting of package objects */
#define MAX_PACKAGE_DEPTH 16
#endif /* _ACCONFIG_H */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 39 $
* $Revision: 41 $
*
*****************************************************************************/
@ -134,6 +134,7 @@ extern BOOLEAN opt_disasm;
extern BOOLEAN opt_stats;
extern BOOLEAN opt_parse_jit;
extern BOOLEAN opt_verbose;
extern BOOLEAN opt_ini_methods;
extern NATIVE_CHAR *Args[DB_MAX_ARGS];
@ -289,6 +290,10 @@ void
AcpiDbFindReferences (
NATIVE_CHAR *ObjectArg);
void
AcpiDbDisplayResources (
NATIVE_CHAR *ObjectArg);
/*
* dbdisasm - AML disassembler

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 4 $
* $Revision: 5 $
*
*****************************************************************************/
@ -117,12 +117,12 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#ifdef __ia64__
#define _IA64
#define COMPILER_DEPENDENT_UINT64 unsigned long
/* Single threaded */
#define ACPI_APPLICATION
@ -186,8 +186,7 @@
#else /* DO IA32 */
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 91 $
* $Revision: 92 $
*
*****************************************************************************/
@ -650,12 +650,6 @@ AcpiAmlUnsignedIntegerToString (
ACPI_INTEGER Value,
NATIVE_CHAR *OutString);
ACPI_STATUS
AcpiAmlBuildCopyInternalPackageObject (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState);
/*
* amregion - default OpRegion handlers

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 7 $
* $Revision: 9 $
*
*****************************************************************************/
@ -117,7 +117,6 @@
#ifndef __ACLINUX_H__
#define __ACLINUX_H__
#define ACPI_OS_NAME "Linux"
#include <linux/config.h>
@ -126,6 +125,7 @@
#include <linux/ctype.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/div64.h>
/* Linux uses GCC */
@ -134,9 +134,14 @@
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
/* Linux ia32 can't do int64 well */
#ifndef _IA64
/* Linux ia32 can't do int64 well */
#define ACPI_NO_INTEGER64_SUPPORT
/* And the ia32 kernel doesn't include 64-bit divide support */
#define ACPI_DIV64(dividend, divisor) do_div(dividend, divisor)
#else
#define ACPI_DIV64(dividend, divisor) ACPI_DIVIDE(dividend, divisor)
#endif
#endif /* __ACLINUX_H__ */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 100 $
* $Revision: 104 $
*
*****************************************************************************/
@ -459,6 +459,23 @@ typedef struct acpi_update_state
} ACPI_UPDATE_STATE;
/*
* Pkg state - used to traverse nested package structures
*/
typedef struct acpi_pkg_state
{
ACPI_STATE_COMMON
union acpi_operand_obj *SourceObject;
union acpi_operand_obj *DestObject;
struct acpi_walk_state *WalkState;
void *ThisTargetObj;
UINT32 NumPackages;
UINT16 Index;
} ACPI_PKG_STATE;
/*
* Control state - one per if/else and while constructs.
* Allows nesting of these constructs
@ -519,6 +536,7 @@ typedef union acpi_gen_state
ACPI_UPDATE_STATE Update;
ACPI_SCOPE_STATE Scope;
ACPI_PSCOPE_STATE ParseScope;
ACPI_PKG_STATE Pkg;
ACPI_RESULT_VALUES Results;
} ACPI_GENERIC_STATE;
@ -741,7 +759,6 @@ typedef struct acpi_init_walk_info
typedef struct acpi_device_walk_info
{
UINT32 Flags;
UINT16 DeviceCount;
UINT16 Num_STA;
UINT16 Num_INI;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 101 $
* $Revision: 103 $
*
*****************************************************************************/
@ -163,7 +163,7 @@ AcpiNsInitializeObjects (
ACPI_STATUS
AcpiNsInitializeDevices (
UINT32 Flags);
void);
/* Namespace init - nsxfinit */
@ -408,6 +408,11 @@ AcpiNsGetNode (
ACPI_NAMESPACE_NODE *InPrefixNode,
ACPI_NAMESPACE_NODE **OutNode);
UINT32
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node);
/*
* Object management for NTEs - nsobject
*/

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 69 $
* $Revision: 70 $
*
*****************************************************************************/
@ -187,6 +187,7 @@
#define TRACE_USER_REQUESTS 0x01000000
#define TRACE_PACKAGE 0x02000000
#define TRACE_MUTEX 0x04000000
#define TRACE_INIT 0x08000000
#define TRACE_ALL 0x0FFFFF00

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 163 $
* $Revision: 165 $
*
*****************************************************************************/
@ -328,8 +328,7 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_NO_EVENT_INIT 0x04
#define ACPI_NO_ACPI_ENABLE 0x08
#define ACPI_NO_DEVICE_INIT 0x10
#define ACPI_NO_PCI_INIT 0x20
#define ACPI_NO_OBJECT_INIT 0x40
#define ACPI_NO_OBJECT_INIT 0x20
/*
@ -759,6 +758,8 @@ ACPI_STATUS (*WALK_CALLBACK) (
void **ReturnValue);
/* Interrupt handler return values */
#define INTERRUPT_NOT_HANDLED 0x00
@ -1120,22 +1121,14 @@ typedef struct _resource_tag
* END: Definitions for Resource Attributes
*/
/*
* Definitions for PCI Routing tables
*/
typedef struct
{
ACPI_INTEGER Address;
UINT32 Pin;
UINT32 SourceIndex;
NATIVE_CHAR Source[1];
} PRT_ENTRY;
typedef struct _prt_tag
typedef struct pci_routing_table
{
UINT32 Length;
PRT_ENTRY Data;
UINT32 Pin;
ACPI_INTEGER Address; /* here for 64-bit alignment */
UINT32 SourceIndex;
NATIVE_CHAR Source[4]; /* pad to 64 bits so sizeof() works in all cases */
} PCI_ROUTING_TABLE;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amfldio - Aml Field I/O
* $Revision: 37 $
* $Revision: 39 $
*
*****************************************************************************/
@ -572,7 +572,8 @@ AcpiAmlWriteFieldDataWithUpdateRule (
/* Check if update rule needs to be applied (not if mask is all ones) */
if (((1 << BitGranularity) -1) & ~Mask)
/* The left shift drops the bits we want to ignore. */
if ((~Mask << (sizeof(Mask)*8 - BitGranularity)) != 0)
{
/*
* Read the current contents of the byte/word/dword containing

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstore - AML Interpreter object store support
* $Revision: 121 $
* $Revision: 123 $
*
*****************************************************************************/
@ -407,8 +407,7 @@ AcpiAmlStoreObjectToIndex (
*/
if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
{
Status = AcpiAmlBuildCopyInternalPackageObject (
ValDesc, ObjDesc, WalkState);
Status = AcpiCmCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
AcpiCmRemoveReference (ObjDesc);
@ -718,7 +717,7 @@ AcpiAmlStoreObjectToObject (
*/
ACPI_ASSERT((DestDesc) && (SourceDesc));
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to (%p)%s\n",
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to %p(%s)\n",
SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstorob - AML Interpreter object store support, store to object
* $Revision: 22 $
* $Revision: 23 $
*
*****************************************************************************/
@ -159,6 +159,21 @@ AcpiAmlCopyBufferToBuffer (
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
/*
* If target is a buffer of length zero, allocate a new
* buffer of the proper length
*/
if (TargetDesc->Buffer.Length == 0)
{
TargetDesc->Buffer.Pointer = AcpiCmAllocate (Length);
if (!TargetDesc->Buffer.Pointer)
{
return (AE_NO_MEMORY);
}
TargetDesc->Buffer.Length = Length;
}
/*
* Buffer is a static allocation,
* only place what will fit in the buffer.
@ -171,7 +186,7 @@ AcpiAmlCopyBufferToBuffer (
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length);
}
else
else
{
/*
* Truncate the source, copy only what will fit
@ -179,7 +194,7 @@ AcpiAmlCopyBufferToBuffer (
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: Truncating src buffer from %X to %X\n",
("AmlCopyBufferToBuffer: Truncating src buffer from %X to %X\n",
Length, TargetDesc->Buffer.Length));
}
@ -244,12 +259,12 @@ AcpiAmlCopyStringToString (
}
TargetDesc->String.Pointer = AcpiCmAllocate (Length + 1);
TargetDesc->String.Length = Length;
if (!TargetDesc->String.Pointer)
{
return (AE_NO_MEMORY);
}
TargetDesc->String.Length = Length;
MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
}
@ -306,14 +321,14 @@ AcpiAmlCopyIntegerToIndexField (
sizeof (SourceDesc->Integer.Value));
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set data returned %s\n",
("AmlCopyIntegerToIndexField: IndexField: set data returned %s\n",
AcpiCmFormatException (Status)));
}
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set index returned %s\n",
("AmlCopyIntegerToIndexField: IndexField: set index returned %s\n",
AcpiCmFormatException (Status)));
}
@ -379,7 +394,7 @@ AcpiAmlCopyIntegerToBankField (
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: BankField: set bakn returned %s\n",
("AmlCopyIntegerToBankField: BankField: set bakn returned %s\n",
AcpiCmFormatException (Status)));
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amutils - interpreter/scanner utilities
* $Revision: 68 $
* $Revision: 69 $
*
*****************************************************************************/
@ -128,20 +128,6 @@
MODULE_NAME ("amutils")
typedef struct Internal_Search_st
{
ACPI_OPERAND_OBJECT *DestObj;
UINT32 Index;
ACPI_OPERAND_OBJECT *SourceObj;
} INTERNAL_PKG_SEARCH_INFO;
/* Used to traverse nested packages when copying*/
/* TBD: This must be removed! */
INTERNAL_PKG_SEARCH_INFO CopyLevel[MAX_PACKAGE_DEPTH];
/*******************************************************************************
*
@ -504,167 +490,7 @@ AcpiAmlUnsignedIntegerToString (
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlBuildCopyInternalPackageObject
*
* PARAMETERS: *SourceObj - Pointer to the source package object
* *DestObj - Where the internal object is returned
*
* RETURN: Status - the status of the call
*
* DESCRIPTION: This function is called to copy an internal package object
* into another internal package object.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlBuildCopyInternalPackageObject (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState)
{
UINT32 CurrentDepth = 0;
ACPI_STATUS Status = AE_OK;
UINT32 Length = 0;
UINT32 ThisIndex;
UINT32 ObjectSpace = 0;
ACPI_OPERAND_OBJECT *ThisDestObj;
ACPI_OPERAND_OBJECT *ThisSourceObj;
INTERNAL_PKG_SEARCH_INFO *LevelPtr;
FUNCTION_TRACE ("AmlBuildCopyInternalPackageObject");
/*
* Initialize the working variables
*/
MEMSET ((void *) CopyLevel, 0, sizeof(CopyLevel));
CopyLevel[0].DestObj = DestObj;
CopyLevel[0].SourceObj = SourceObj;
LevelPtr = &CopyLevel[0];
CurrentDepth = 0;
DestObj->Common.Type = SourceObj->Common.Type;
DestObj->Package.Count = SourceObj->Package.Count;
/*
* Build an array of ACPI_OBJECTS in the buffer
* and move the free space past it
*/
DestObj->Package.Elements = AcpiCmCallocate (
(DestObj->Package.Count + 1) *
sizeof (void *));
if (!DestObj->Package.Elements)
{
/* Package vector allocation failure */
REPORT_ERROR (("AmlBuildCopyInternalPackageObject: Package vector allocation failure\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
DestObj->Package.NextElement = DestObj->Package.Elements;
while (1)
{
ThisIndex = LevelPtr->Index;
ThisDestObj = (ACPI_OPERAND_OBJECT *) LevelPtr->DestObj->Package.Elements[ThisIndex];
ThisSourceObj = (ACPI_OPERAND_OBJECT *) LevelPtr->SourceObj->Package.Elements[ThisIndex];
if (IS_THIS_OBJECT_TYPE (ThisSourceObj, ACPI_TYPE_PACKAGE))
{
/*
* If this object is a package then we go one deeper
*/
if (CurrentDepth >= MAX_PACKAGE_DEPTH-1)
{
/*
* Too many nested levels of packages for us to handle
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlBuildCopyInternalPackageObject: Pkg nested too deep (max %X)\n",
MAX_PACKAGE_DEPTH));
return_ACPI_STATUS (AE_LIMIT);
}
/*
* Build the package object
*/
ThisDestObj = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE);
LevelPtr->DestObj->Package.Elements[ThisIndex] = ThisDestObj;
ThisDestObj->Common.Type = ACPI_TYPE_PACKAGE;
ThisDestObj->Package.Count = ThisDestObj->Package.Count;
/*
* Save space for the array of objects (Package elements)
* update the buffer length counter
*/
ObjectSpace = ThisDestObj->Package.Count *
sizeof (ACPI_OPERAND_OBJECT);
Length += ObjectSpace;
CurrentDepth++;
LevelPtr = &CopyLevel[CurrentDepth];
LevelPtr->DestObj = ThisDestObj;
LevelPtr->SourceObj = ThisSourceObj;
LevelPtr->Index = 0;
} /* if object is a package */
else
{
ThisDestObj = AcpiCmCreateInternalObject (
ThisSourceObj->Common.Type);
LevelPtr->DestObj->Package.Elements[ThisIndex] = ThisDestObj;
Status = AcpiAmlStoreObjectToObject(ThisSourceObj, ThisDestObj, WalkState);
if (ACPI_FAILURE (Status))
{
/*
* Failure get out
*/
return_ACPI_STATUS (Status);
}
Length +=ObjectSpace;
LevelPtr->Index++;
while (LevelPtr->Index >= LevelPtr->DestObj->Package.Count)
{
/*
* We've handled all of the objects at this level, This means
* that we have just completed a package. That package may
* have contained one or more packages itself
*/
if (CurrentDepth == 0)
{
/*
* We have handled all of the objects in the top level
* package just add the length of the package objects
* and exit
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index past the just
* completed package object.
*/
CurrentDepth--;
LevelPtr = &CopyLevel[CurrentDepth];
LevelPtr->Index++;
}
} /* else object is NOT a package */
} /* while (1) */
}

View File

@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 81 $
* $Revision: 83 $
*
******************************************************************************/
@ -388,8 +388,8 @@ AcpiNsEvaluateByHandle (
Node = AcpiNsConvertHandleToEntry (Handle);
if (!Node)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -456,12 +456,6 @@ AcpiNsEvaluateByHandle (
* so we just return
*/
return_ACPI_STATUS (Status);
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@ -497,6 +491,16 @@ AcpiNsExecuteControlMethod (
FUNCTION_TRACE ("NsExecuteControlMethod");
/*
* Unlock the namespace before execution. This allows namespace access
* via the external Acpi* interfaces while a method is being executed.
* However, any namespace deletion must acquire both the namespace and
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/* Verify that there is a method associated with this object */
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) MethodNode);
@ -518,19 +522,8 @@ AcpiNsExecuteControlMethod (
DEBUG_PRINT (TRACE_NAMES,
("At offset %8XH\n", ObjDesc->Method.Pcode + 1));
/*
* Unlock the namespace before execution. This allows namespace access
* via the external Acpi* interfaces while a method is being executed.
* However, any namespace deletion must acquire both the namespace and
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/*
* Excecute the method via the interpreter
* Execute the method via the interpreter
*/
Status = AcpiAmlExecuteMethod (MethodNode, Params, ReturnObjDesc);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 12 $
* $Revision: 15 $
*
*****************************************************************************/
@ -203,7 +203,7 @@ AcpiNsInitializeObjects (
ACPI_STATUS
AcpiNsInitializeDevices (
UINT32 Flags)
void)
{
ACPI_STATUS Status;
ACPI_DEVICE_WALK_INFO Info;
@ -212,7 +212,6 @@ AcpiNsInitializeDevices (
FUNCTION_TRACE ("NsInitializeDevices");
Info.Flags = Flags;
Info.DeviceCount = 0;
Info.Num_STA = 0;
Info.Num_INI = 0;
@ -304,7 +303,11 @@ AcpiNsInitOneObject (
AcpiCmFormatException (Status), &Node->Name));
}
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
break;
@ -324,7 +327,11 @@ AcpiNsInitOneObject (
DEBUG_PRINT (ACPI_ERROR, ("%s while getting field arguments [%4.4s]\n",
AcpiCmFormatException (Status), &Node->Name));
}
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
break;
@ -344,7 +351,7 @@ AcpiNsInitOneObject (
*
* FUNCTION: AcpiNsInitOneDevice
*
* PARAMETERS: The usual "I'm a namespace callback" stuff
* PARAMETERS: WALK_CALLBACK
*
* RETURN: ACPI_STATUS
*
@ -370,7 +377,11 @@ AcpiNsInitOneDevice (
FUNCTION_TRACE ("AcpiNsInitOneDevice");
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
Info->DeviceCount++;
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
@ -388,6 +399,7 @@ AcpiNsInitOneDevice (
* Run _STA to determine if we can run _INI on the device.
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, "_STA [Method]"));
Status = AcpiCmExecute_STA (Node, &Flags);
if (ACPI_FAILURE (Status))
{
@ -404,10 +416,13 @@ AcpiNsInitOneDevice (
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
/*
* The device is present. Run _INI.
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (ObjHandle, "_INI [Method]"));
Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL);
if (AE_NOT_FOUND == Status)
{

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 53 $
* $Revision: 54 $
*
******************************************************************************/
@ -217,6 +217,48 @@ AcpiNsGetTablePathname (
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetPathnameLength
*
* PARAMETERS: Node - Namespace node
*
* RETURN: Length of path, including prefix
*
* DESCRIPTION: Get the length of the pathname string for this node
*
******************************************************************************/
UINT32
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node)
{
UINT32 Size;
ACPI_NAMESPACE_NODE *NextNode;
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
for (Size = 0, NextNode = Node;
AcpiNsGetParentObject (NextNode);
NextNode = AcpiNsGetParentObject (NextNode))
{
Size += PATH_SEGMENT_LENGTH;
}
/* Special case for size still 0 - no parent for "special" nodes */
if (!Size)
{
Size = PATH_SEGMENT_LENGTH;
}
return (Size + 1);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsHandleToPathname
@ -242,11 +284,10 @@ AcpiNsHandleToPathname (
{
ACPI_STATUS Status = AE_OK;
ACPI_NAMESPACE_NODE *Node;
ACPI_NAMESPACE_NODE *NextNode;
UINT32 PathLength;
UINT32 Size;
UINT32 UserBufSize;
ACPI_NAME Name;
UINT32 Size;
FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
@ -267,27 +308,12 @@ AcpiNsHandleToPathname (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
for (Size = 0, NextNode = Node;
AcpiNsGetParentObject (NextNode);
NextNode = AcpiNsGetParentObject (NextNode))
{
Size += PATH_SEGMENT_LENGTH;
}
/* Special case for size still 0 - no parent for "special" nodes */
if (!Size)
{
Size = PATH_SEGMENT_LENGTH;
}
/* Set return length to the required path length */
PathLength = Size + 1;
PathLength = AcpiNsGetPathnameLength (Node);
Size = PathLength - 1;
UserBufSize = *BufSize;
*BufSize = PathLength;

View File

@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
* $Revision: 78 $
* $Revision: 80 $
*
******************************************************************************/
@ -217,9 +217,8 @@ AcpiEvaluateObject (
*/
for (i = 0; i < Count; i++)
{
Status =
AcpiCmBuildInternalObject (&ParamObjects->Pointer[i],
ParamPtr[i]);
Status = AcpiCmCopyEobjectToIobject (&ParamObjects->Pointer[i],
ParamPtr[i]);
if (ACPI_FAILURE (Status))
{
@ -362,7 +361,7 @@ AcpiEvaluateObject (
/*
* We have enough space for the object, build it
*/
Status = AcpiCmBuildExternalObject (ReturnObj,
Status = AcpiCmCopyIobjectToEobject (ReturnObj,
ReturnBuffer);
ReturnBuffer->Length = BufferSpaceNeeded;
}
@ -725,14 +724,14 @@ AcpiNsGetDeviceCallback (
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
Node = AcpiNsConvertHandleToEntry (ObjHandle);
if (!Node)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
if (!Node)
{
return (AE_BAD_PARAMETER);
}
/*
* Run _STA to determine if device is present
*/

View File

@ -2,7 +2,7 @@
*
* Module Name: rscalc - AcpiRsCalculateByteStreamLength
* AcpiRsCalculateListLength
* $Revision: 18 $
* $Revision: 21 $
*
******************************************************************************/
@ -119,6 +119,8 @@
#include "acpi.h"
#include "acresrc.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT RESOURCE_MANAGER
MODULE_NAME ("rscalc")
@ -825,6 +827,7 @@ AcpiRsCalculateListLength (
*/
BytesConsumed = 2;
StructureSize = RESOURCE_LENGTH;
ByteStreamBufferLength = BytesParsed;
break;
@ -936,7 +939,9 @@ AcpiRsCalculatePciRoutingTableLength (
for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++)
{
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
if ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) ||
((INTERNAL_TYPE_REFERENCE == (*SubObjectList)->Common.Type) &&
((*SubObjectList)->Reference.OpCode == AML_NAMEPATH_OP)))
{
NameFound = TRUE;
}
@ -950,18 +955,25 @@ AcpiRsCalculatePciRoutingTableLength (
}
}
TempSizeNeeded += (sizeof (PCI_ROUTING_TABLE) - 1);
TempSizeNeeded += (sizeof (PCI_ROUTING_TABLE) - 4);
/*
* Was a String type found?
*/
if (TRUE == NameFound)
{
/*
* The length String.Length field includes the
* terminating NULL
*/
TempSizeNeeded += (*SubObjectList)->String.Length;
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
{
/*
* The length String.Length field includes the
* terminating NULL
*/
TempSizeNeeded += (*SubObjectList)->String.Length;
}
else
{
TempSizeNeeded += AcpiNsGetPathnameLength ((*SubObjectList)->Reference.Node);
}
}
else
@ -985,7 +997,7 @@ AcpiRsCalculatePciRoutingTableLength (
}
*BufferSizeNeeded = TempSizeNeeded + sizeof (PCI_ROUTING_TABLE);
*BufferSizeNeeded = TempSizeNeeded;
return_ACPI_STATUS (AE_OK);
}

View File

@ -3,7 +3,7 @@
* Module Name: rscreate - AcpiRsCreateResourceList
* AcpiRsCreatePciRoutingTable
* AcpiRsCreateByteStream
* $Revision: 24 $
* $Revision: 25 $
*
******************************************************************************/
@ -121,6 +121,8 @@
#include "acpi.h"
#include "acresrc.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT RESOURCE_MANAGER
MODULE_NAME ("rscreate")
@ -266,6 +268,7 @@ AcpiRsCreatePciRoutingTable (
UINT32 NumberOfElements = 0;
UINT32 Index = 0;
PCI_ROUTING_TABLE *UserPrt = NULL;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
@ -321,10 +324,10 @@ AcpiRsCreatePciRoutingTable (
/*
* Fill in the Length field with the information we
* have at this point.
* The minus one is to subtract the size of the
* UINT8 Source[1] member because it is added below.
* The minus four is to subtract the size of the
* UINT8 Source[4] member because it is added below.
*/
UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) - 1);
UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) -4);
/*
* Dereference the sub-package
@ -339,71 +342,99 @@ AcpiRsCreatePciRoutingTable (
SubObjectList = PackageElement->Package.Elements;
/*
* Dereference the Address
* 1) First subobject: Dereference the Address
*/
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Address =
(*SubObjectList)->Integer.Value;
UserPrt->Address = (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Dereference the Pin
* 2) Second subobject: Dereference the Pin
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Pin =
UserPrt->Pin =
(UINT32) (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Dereference the Source Name
* 3) Third subobject: Dereference the Source Name
*/
SubObjectList++;
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
switch ((*SubObjectList)->Common.Type)
{
STRCPY (UserPrt->Data.Source,
case INTERNAL_TYPE_REFERENCE:
if ((*SubObjectList)->Reference.OpCode != AML_NAMEPATH_OP)
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need name, found reference op %X\n",
(*SubObjectList)->Reference.OpCode));
return_ACPI_STATUS (AE_BAD_DATA);
}
Node = (*SubObjectList)->Reference.Node;
/* TBD: use *remaining* length of the buffer! */
Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node,
OutputBufferLength, UserPrt->Source);
UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */
break;
case ACPI_TYPE_STRING:
STRCPY (UserPrt->Source,
(*SubObjectList)->String.Pointer);
/*
* Add to the Length field the length of the string
*/
UserPrt->Length += (*SubObjectList)->String.Length;
}
break;
else
{
case ACPI_TYPE_INTEGER:
/*
* If this is a number, then the Source Name
* is NULL, since the entire buffer was zeroed
* out, we can leave this alone.
*/
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
/*
* Add to the Length field the length of
* the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
}
/*
* Add to the Length field the length of
* the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
break;
else
{
return_ACPI_STATUS (AE_BAD_DATA);
}
default:
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
break;
}
/* Now align the current length */
@ -411,18 +442,21 @@ AcpiRsCreatePciRoutingTable (
UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length);
/*
* Dereference the Source Index
* 4) Fourth subobject: Dereference the Source Index
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.SourceIndex =
UserPrt->SourceIndex =
(UINT32) (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions do dump out the resource structures.
* $Revision: 15 $
* $Revision: 16 $
*
******************************************************************************/
@ -1013,25 +1013,25 @@ AcpiRsDumpIrqList (
if (AcpiDbgLevel & TRACE_RESOURCES && _COMPONENT & AcpiDbgLayer)
{
PrtElement = (PCI_ROUTING_TABLE *)Buffer;
PrtElement = (PCI_ROUTING_TABLE *) Buffer;
while (!Done)
{
AcpiOsPrintf ("\tPCI IRQ Routing Table structure %X.\n", Count++);
AcpiOsPrintf ("\t\tAddress: %X\n",
PrtElement->Data.Address);
PrtElement->Address);
AcpiOsPrintf ("\t\tPin: %X\n", PrtElement->Data.Pin);
AcpiOsPrintf ("\t\tPin: %X\n", PrtElement->Pin);
AcpiOsPrintf ("\t\tSource: %s\n", PrtElement->Data.Source);
AcpiOsPrintf ("\t\tSource: %s\n", PrtElement->Source);
AcpiOsPrintf ("\t\tSourceIndex: %X\n",
PrtElement->Data.SourceIndex);
PrtElement->SourceIndex);
Buffer += PrtElement->Length;
PrtElement = (PCI_ROUTING_TABLE *)Buffer;
PrtElement = (PCI_ROUTING_TABLE *) Buffer;
if(0 == PrtElement->Length)
{

View File

@ -2,7 +2,7 @@
*
* Module Name: rslist - AcpiRsByteStreamToList
* AcpiListToByteStream
* $Revision: 10 $
* $Revision: 11 $
*
******************************************************************************/
@ -399,8 +399,7 @@ AcpiRsByteStreamToList (
/*
* Check the reason for exiting the while loop
*/
if (!(ByteStreamBufferLength == BytesParsed) ||
(TRUE != EndTagProcessed))
if (TRUE != EndTagProcessed)
{
return_ACPI_STATUS (AE_AML_ERROR);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 53 $
* $Revision: 55 $
*
*****************************************************************************/
@ -144,7 +144,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20010125
#define ACPI_CA_VERSION 0x20010208
/* Maximum objects in the various object caches */
@ -240,10 +240,5 @@
#define RSDP_SCAN_STEP 16
/* Maximum nesting of package objects */
#define MAX_PACKAGE_DEPTH 16
#endif /* _ACCONFIG_H */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 39 $
* $Revision: 41 $
*
*****************************************************************************/
@ -134,6 +134,7 @@ extern BOOLEAN opt_disasm;
extern BOOLEAN opt_stats;
extern BOOLEAN opt_parse_jit;
extern BOOLEAN opt_verbose;
extern BOOLEAN opt_ini_methods;
extern NATIVE_CHAR *Args[DB_MAX_ARGS];
@ -289,6 +290,10 @@ void
AcpiDbFindReferences (
NATIVE_CHAR *ObjectArg);
void
AcpiDbDisplayResources (
NATIVE_CHAR *ObjectArg);
/*
* dbdisasm - AML disassembler

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 4 $
* $Revision: 5 $
*
*****************************************************************************/
@ -117,12 +117,12 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#ifdef __ia64__
#define _IA64
#define COMPILER_DEPENDENT_UINT64 unsigned long
/* Single threaded */
#define ACPI_APPLICATION
@ -186,8 +186,7 @@
#else /* DO IA32 */
#define COMPILER_DEPENDENT_UINT64 unsigned long long
#define ACPI_ASM_MACROS
#define causeinterrupt(level)
#define BREAKPOINT3

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 91 $
* $Revision: 92 $
*
*****************************************************************************/
@ -650,12 +650,6 @@ AcpiAmlUnsignedIntegerToString (
ACPI_INTEGER Value,
NATIVE_CHAR *OutString);
ACPI_STATUS
AcpiAmlBuildCopyInternalPackageObject (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState);
/*
* amregion - default OpRegion handlers

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 100 $
* $Revision: 104 $
*
*****************************************************************************/
@ -459,6 +459,23 @@ typedef struct acpi_update_state
} ACPI_UPDATE_STATE;
/*
* Pkg state - used to traverse nested package structures
*/
typedef struct acpi_pkg_state
{
ACPI_STATE_COMMON
union acpi_operand_obj *SourceObject;
union acpi_operand_obj *DestObject;
struct acpi_walk_state *WalkState;
void *ThisTargetObj;
UINT32 NumPackages;
UINT16 Index;
} ACPI_PKG_STATE;
/*
* Control state - one per if/else and while constructs.
* Allows nesting of these constructs
@ -519,6 +536,7 @@ typedef union acpi_gen_state
ACPI_UPDATE_STATE Update;
ACPI_SCOPE_STATE Scope;
ACPI_PSCOPE_STATE ParseScope;
ACPI_PKG_STATE Pkg;
ACPI_RESULT_VALUES Results;
} ACPI_GENERIC_STATE;
@ -741,7 +759,6 @@ typedef struct acpi_init_walk_info
typedef struct acpi_device_walk_info
{
UINT32 Flags;
UINT16 DeviceCount;
UINT16 Num_STA;
UINT16 Num_INI;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 101 $
* $Revision: 103 $
*
*****************************************************************************/
@ -163,7 +163,7 @@ AcpiNsInitializeObjects (
ACPI_STATUS
AcpiNsInitializeDevices (
UINT32 Flags);
void);
/* Namespace init - nsxfinit */
@ -408,6 +408,11 @@ AcpiNsGetNode (
ACPI_NAMESPACE_NODE *InPrefixNode,
ACPI_NAMESPACE_NODE **OutNode);
UINT32
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node);
/*
* Object management for NTEs - nsobject
*/

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
* $Revision: 69 $
* $Revision: 70 $
*
*****************************************************************************/
@ -187,6 +187,7 @@
#define TRACE_USER_REQUESTS 0x01000000
#define TRACE_PACKAGE 0x02000000
#define TRACE_MUTEX 0x04000000
#define TRACE_INIT 0x08000000
#define TRACE_ALL 0x0FFFFF00

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 163 $
* $Revision: 165 $
*
*****************************************************************************/
@ -328,8 +328,7 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_NO_EVENT_INIT 0x04
#define ACPI_NO_ACPI_ENABLE 0x08
#define ACPI_NO_DEVICE_INIT 0x10
#define ACPI_NO_PCI_INIT 0x20
#define ACPI_NO_OBJECT_INIT 0x40
#define ACPI_NO_OBJECT_INIT 0x20
/*
@ -759,6 +758,8 @@ ACPI_STATUS (*WALK_CALLBACK) (
void **ReturnValue);
/* Interrupt handler return values */
#define INTERRUPT_NOT_HANDLED 0x00
@ -1120,22 +1121,14 @@ typedef struct _resource_tag
* END: Definitions for Resource Attributes
*/
/*
* Definitions for PCI Routing tables
*/
typedef struct
{
ACPI_INTEGER Address;
UINT32 Pin;
UINT32 SourceIndex;
NATIVE_CHAR Source[1];
} PRT_ENTRY;
typedef struct _prt_tag
typedef struct pci_routing_table
{
UINT32 Length;
PRT_ENTRY Data;
UINT32 Pin;
ACPI_INTEGER Address; /* here for 64-bit alignment */
UINT32 SourceIndex;
NATIVE_CHAR Source[4]; /* pad to 64 bits so sizeof() works in all cases */
} PCI_ROUTING_TABLE;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: accommon.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 87 $
* $Revision: 90 $
*
*****************************************************************************/
@ -118,6 +118,32 @@
#define _ACCOMMON_H
typedef
ACPI_STATUS (*ACPI_PKG_CALLBACK) (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
ACPI_GENERIC_STATE *State,
void *Context);
ACPI_STATUS
AcpiCmWalkPackageTree (
ACPI_OPERAND_OBJECT *SourceObject,
void *TargetObject,
ACPI_PKG_CALLBACK WalkCallback,
void *Context);
typedef struct acpi_pkg_info
{
UINT8 *FreeSpace;
UINT32 Length;
UINT32 ObjectSpace;
UINT32 NumPackages;
} ACPI_PKG_INFO;
#define REF_INCREMENT (UINT16) 0
#define REF_DECREMENT (UINT16) 1
#define REF_FORCE_DELETE (UINT16) 2
@ -285,29 +311,30 @@ AcpiCmBuildPackageObject (
UINT32 *SpaceUsed);
ACPI_STATUS
AcpiCmBuildExternalObject (
AcpiCmCopyIobjectToEobject (
ACPI_OPERAND_OBJECT *Obj,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiCmBuildInternalSimpleObject(
AcpiCmCopyEsimpleToIsimple(
ACPI_OBJECT *UserObj,
ACPI_OPERAND_OBJECT *Obj);
ACPI_STATUS
AcpiCmBuildInternalObject (
AcpiCmCopyEobjectToIobject (
ACPI_OBJECT *Obj,
ACPI_OPERAND_OBJECT *InternalObj);
ACPI_STATUS
AcpiCmCopyInternalSimpleObject (
AcpiCmCopyISimpleToIsimple (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj);
ACPI_STATUS
AcpiCmBuildCopyInternalPackageObject (
AcpiCmCopyIpackageToIpackage (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj);
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState);
/*
@ -617,12 +644,25 @@ AcpiCmCreateUpdateState (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action);
ACPI_GENERIC_STATE *
AcpiCmCreatePkgState (
void *InternalObject,
void *ExternalObject,
UINT16 Index);
ACPI_STATUS
AcpiCmCreateUpdateStateAndPush (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action,
ACPI_GENERIC_STATE **StateList);
ACPI_STATUS
AcpiCmCreatePkgStateAndPush (
void *InternalObject,
void *ExternalObject,
UINT16 Index,
ACPI_GENERIC_STATE **StateList);
ACPI_GENERIC_STATE *
AcpiCmCreateControlState (
void);
@ -655,6 +695,15 @@ ACPI_STATUS
AcpiCmResolvePackageReferences (
ACPI_OPERAND_OBJECT *ObjDesc);
#ifdef ACPI_DEBUG
void
AcpiCmDisplayInitPathname (
ACPI_HANDLE ObjHandle,
char *Path);
#endif
/*
* Memory allocation functions and related macros.

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 45 $
* $Revision: 46 $
*
******************************************************************************/
@ -995,4 +995,76 @@ AcpiDbSetScope (
AcpiOsPrintf ("New scope: %s\n", ScopeBuf);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayResources
*
* PARAMETERS: ObjectArg - String with hex value of the object
*
* RETURN: None
*
* DESCRIPTION:
*
******************************************************************************/
void
AcpiDbDisplayResources (
NATIVE_CHAR *ObjectArg)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
PCI_ROUTING_TABLE *Prt;
UINT32 i;
AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
/* Convert string to object pointer */
ObjDesc = (ACPI_OPERAND_OBJECT *) STRTOUL (ObjectArg, NULL, 16);
/* Prepare for a return object of arbitrary size */
ReturnObj.Pointer = Buffer;
ReturnObj.Length = BUFFER_SIZE;
Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiCmFormatException (Status));
goto Cleanup;
}
ReturnObj.Pointer = Buffer;
ReturnObj.Length = BUFFER_SIZE;
Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiCmFormatException (Status));
goto Cleanup;
}
Prt = (PCI_ROUTING_TABLE *) Buffer;
i = 0;
while ((char *) Prt < (Buffer + ReturnObj.Length))
{
AcpiOsPrintf ("Prt[%d] Src=%s: Addr=%X\n", i, Prt->Source, Prt->Address);
i++;
Prt = (PCI_ROUTING_TABLE *) (((char *) Prt) + Prt->Length);
}
Cleanup:
AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
return;
}
#endif /* ENABLE_DEBUGGER */

View File

@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 37 $
* $Revision: 38 $
*
******************************************************************************/
@ -240,6 +240,10 @@ AcpiDbOpenDebugFile (
STRCPY (DebugFilename, Name);
OutputToFile = TRUE;
}
else
{
AcpiOsPrintf ("Could not open debug file %s\n", Name);
}
#endif
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 54 $
* $Revision: 56 $
*
******************************************************************************/
@ -153,6 +153,7 @@ BOOLEAN opt_disasm = FALSE;
BOOLEAN opt_stats = FALSE;
BOOLEAN opt_parse_jit = FALSE;
BOOLEAN opt_verbose = TRUE;
BOOLEAN opt_ini_methods = TRUE;
/*
@ -199,6 +200,7 @@ enum AcpiAmlDebuggerCommands
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
CMD_SET,
CMD_STATS,
@ -251,6 +253,7 @@ COMMAND_INFO Commands[] =
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESOURCES", 1},
{"RESULTS", 0},
{"SET", 3},
{"STATS", 0},
@ -337,6 +340,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
AcpiOsPrintf ("Resources xxx Get and display resources\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
return;
@ -765,6 +769,10 @@ AcpiDbCommandDispatch (
AcpiDbFindReferences (Args[1]);
break;
case CMD_RESOURCES:
AcpiDbDisplayResources (Args[1]);
break;
case CMD_RESULTS:
AcpiDbDisplayResults ();
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
@ -194,7 +194,10 @@ AcpiDsInitOneObject (
Info->MethodCount++;
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
/*
* Set the execution data width (32 or 64) based upon the

View File

@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 30 $
* $Revision: 32 $
*
*****************************************************************************/
@ -169,6 +169,7 @@ AcpiDsGetFieldUnitArguments (
ExtraDesc = ObjDesc->FieldUnit.Extra;
Node = ObjDesc->FieldUnit.Node;
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Field]"));
DEBUG_PRINT (TRACE_EXEC,
("DsGetFieldUnitArguments: [%4.4s] FieldUnit JIT Init\n",
&Node->Name));
@ -289,6 +290,8 @@ AcpiDsGetRegionArguments (
ExtraDesc = ObjDesc->Region.Extra;
Node = ObjDesc->Region.Node;
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Operation Region]"));
DEBUG_PRINT (TRACE_EXEC,
("DsGetRegionArguments: [%4.4s] OpRegion Init at AML %p[%x]\n",
&Node->Name, ExtraDesc->Extra.Pcode, *(UINT32*) ExtraDesc->Extra.Pcode));

View File

@ -2,7 +2,7 @@
*
* Module Name: evevent - Fixed and General Purpose AcpiEvent
* handling and dispatch
* $Revision: 33 $
* $Revision: 34 $
*
*****************************************************************************/
@ -149,7 +149,7 @@ AcpiEvInitialize (
FUNCTION_TRACE ("EvInitialize");
/* Make sure we've got ACPI tables */
/* Make sure we have ACPI tables */
if (!AcpiGbl_DSDT)
{
@ -871,7 +871,7 @@ UINT32
AcpiEvGpeDispatch (
UINT32 GpeNumber)
{
ACPI_GPE_LEVEL_INFO GpeInfo;
ACPI_GPE_LEVEL_INFO GpeInfo;
FUNCTION_TRACE ("EvGpeDispatch");
@ -891,65 +891,64 @@ AcpiEvGpeDispatch (
*/
AcpiHwDisableGpe (GpeNumber);
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
GpeInfo = AcpiGbl_GpeInfo [GpeNumber];
/*
* Edge-Triggered?
* ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
/*
* Edge-Triggered?
* ---------------
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if (GpeInfo.Type & ACPI_EVENT_EDGE_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
AcpiHwClearGpe (GpeNumber);
}
/*
* Function Handler (e.g. EC)?
*/
if (GpeInfo.Handler)
if (GpeInfo.Handler)
{
/* Invoke function handler (at interrupt level). */
GpeInfo.Handler (GpeInfo.Context);
/* Invoke function handler (at interrupt level). */
GpeInfo.Handler (GpeInfo.Context);
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/* Enable GPE */
AcpiHwEnableGpe (GpeNumber);
AcpiHwClearGpe (GpeNumber);
}
/*
* Method Handler (e.g. _Exx/_Lxx)?
*/
else if (GpeInfo.MethodHandle)
/* Enable GPE */
AcpiHwEnableGpe (GpeNumber);
}
/*
* Method Handler (e.g. _Exx/_Lxx)?
*/
else if (GpeInfo.MethodHandle)
{
if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod, (void*)(NATIVE_UINT)GpeNumber)))
{
/*
* Shoudn't occur, but if it does report an error. Note that
* the GPE will remain disabled until the ACPI Core Subsystem
* is restarted, or the handler is removed/reinstalled.
*/
REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
}
}
/*
* No Handler? Report an error and leave the GPE disabled.
*/
else
{
REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
/*
* Shoudn't occur, but if it does report an error. Note that
* the GPE will remain disabled until the ACPI Core Subsystem
* is restarted, or the handler is removed/reinstalled.
*/
REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE bit [%X]\n", GpeNumber));
}
}
/*
* No Handler? Report an error and leave the GPE disabled.
*/
else
{
REPORT_ERROR (("AcpiEvGpeDispatch: No installed handler for GPE [%X]\n", GpeNumber));
/* Level-Triggered? */
if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED)
{
AcpiHwClearGpe (GpeNumber);
}
}
return_VALUE (INTERRUPT_HANDLED);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 94 $
* $Revision: 96 $
*
*****************************************************************************/
@ -262,6 +262,7 @@ AcpiEvExecuteRegMethod (
/*
* Execute the method, no return value
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (RegionObj->Region.Extra->Extra.Method_REG, " [Method]"));
Status = AcpiNsEvaluateByHandle (RegionObj->Region.Extra->Extra.Method_REG, Params, NULL);
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: amfldio - Aml Field I/O
* $Revision: 37 $
* $Revision: 39 $
*
*****************************************************************************/
@ -572,7 +572,8 @@ AcpiAmlWriteFieldDataWithUpdateRule (
/* Check if update rule needs to be applied (not if mask is all ones) */
if (((1 << BitGranularity) -1) & ~Mask)
/* The left shift drops the bits we want to ignore. */
if ((~Mask << (sizeof(Mask)*8 - BitGranularity)) != 0)
{
/*
* Read the current contents of the byte/word/dword containing

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstore - AML Interpreter object store support
* $Revision: 121 $
* $Revision: 123 $
*
*****************************************************************************/
@ -407,8 +407,7 @@ AcpiAmlStoreObjectToIndex (
*/
if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
{
Status = AcpiAmlBuildCopyInternalPackageObject (
ValDesc, ObjDesc, WalkState);
Status = AcpiCmCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
AcpiCmRemoveReference (ObjDesc);
@ -718,7 +717,7 @@ AcpiAmlStoreObjectToObject (
*/
ACPI_ASSERT((DestDesc) && (SourceDesc));
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to (%p)%s\n",
DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to %p(%s)\n",
SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amstorob - AML Interpreter object store support, store to object
* $Revision: 22 $
* $Revision: 23 $
*
*****************************************************************************/
@ -159,6 +159,21 @@ AcpiAmlCopyBufferToBuffer (
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
/*
* If target is a buffer of length zero, allocate a new
* buffer of the proper length
*/
if (TargetDesc->Buffer.Length == 0)
{
TargetDesc->Buffer.Pointer = AcpiCmAllocate (Length);
if (!TargetDesc->Buffer.Pointer)
{
return (AE_NO_MEMORY);
}
TargetDesc->Buffer.Length = Length;
}
/*
* Buffer is a static allocation,
* only place what will fit in the buffer.
@ -171,7 +186,7 @@ AcpiAmlCopyBufferToBuffer (
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length);
}
else
else
{
/*
* Truncate the source, copy only what will fit
@ -179,7 +194,7 @@ AcpiAmlCopyBufferToBuffer (
MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: Truncating src buffer from %X to %X\n",
("AmlCopyBufferToBuffer: Truncating src buffer from %X to %X\n",
Length, TargetDesc->Buffer.Length));
}
@ -244,12 +259,12 @@ AcpiAmlCopyStringToString (
}
TargetDesc->String.Pointer = AcpiCmAllocate (Length + 1);
TargetDesc->String.Length = Length;
if (!TargetDesc->String.Pointer)
{
return (AE_NO_MEMORY);
}
TargetDesc->String.Length = Length;
MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
}
@ -306,14 +321,14 @@ AcpiAmlCopyIntegerToIndexField (
sizeof (SourceDesc->Integer.Value));
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set data returned %s\n",
("AmlCopyIntegerToIndexField: IndexField: set data returned %s\n",
AcpiCmFormatException (Status)));
}
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: IndexField: set index returned %s\n",
("AmlCopyIntegerToIndexField: IndexField: set index returned %s\n",
AcpiCmFormatException (Status)));
}
@ -379,7 +394,7 @@ AcpiAmlCopyIntegerToBankField (
else
{
DEBUG_PRINT (ACPI_INFO,
("AmlStoreObjectToNode: BankField: set bakn returned %s\n",
("AmlCopyIntegerToBankField: BankField: set bakn returned %s\n",
AcpiCmFormatException (Status)));
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amutils - interpreter/scanner utilities
* $Revision: 68 $
* $Revision: 69 $
*
*****************************************************************************/
@ -128,20 +128,6 @@
MODULE_NAME ("amutils")
typedef struct Internal_Search_st
{
ACPI_OPERAND_OBJECT *DestObj;
UINT32 Index;
ACPI_OPERAND_OBJECT *SourceObj;
} INTERNAL_PKG_SEARCH_INFO;
/* Used to traverse nested packages when copying*/
/* TBD: This must be removed! */
INTERNAL_PKG_SEARCH_INFO CopyLevel[MAX_PACKAGE_DEPTH];
/*******************************************************************************
*
@ -504,167 +490,7 @@ AcpiAmlUnsignedIntegerToString (
}
/*******************************************************************************
*
* FUNCTION: AcpiAmlBuildCopyInternalPackageObject
*
* PARAMETERS: *SourceObj - Pointer to the source package object
* *DestObj - Where the internal object is returned
*
* RETURN: Status - the status of the call
*
* DESCRIPTION: This function is called to copy an internal package object
* into another internal package object.
*
******************************************************************************/
ACPI_STATUS
AcpiAmlBuildCopyInternalPackageObject (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj,
ACPI_WALK_STATE *WalkState)
{
UINT32 CurrentDepth = 0;
ACPI_STATUS Status = AE_OK;
UINT32 Length = 0;
UINT32 ThisIndex;
UINT32 ObjectSpace = 0;
ACPI_OPERAND_OBJECT *ThisDestObj;
ACPI_OPERAND_OBJECT *ThisSourceObj;
INTERNAL_PKG_SEARCH_INFO *LevelPtr;
FUNCTION_TRACE ("AmlBuildCopyInternalPackageObject");
/*
* Initialize the working variables
*/
MEMSET ((void *) CopyLevel, 0, sizeof(CopyLevel));
CopyLevel[0].DestObj = DestObj;
CopyLevel[0].SourceObj = SourceObj;
LevelPtr = &CopyLevel[0];
CurrentDepth = 0;
DestObj->Common.Type = SourceObj->Common.Type;
DestObj->Package.Count = SourceObj->Package.Count;
/*
* Build an array of ACPI_OBJECTS in the buffer
* and move the free space past it
*/
DestObj->Package.Elements = AcpiCmCallocate (
(DestObj->Package.Count + 1) *
sizeof (void *));
if (!DestObj->Package.Elements)
{
/* Package vector allocation failure */
REPORT_ERROR (("AmlBuildCopyInternalPackageObject: Package vector allocation failure\n"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
DestObj->Package.NextElement = DestObj->Package.Elements;
while (1)
{
ThisIndex = LevelPtr->Index;
ThisDestObj = (ACPI_OPERAND_OBJECT *) LevelPtr->DestObj->Package.Elements[ThisIndex];
ThisSourceObj = (ACPI_OPERAND_OBJECT *) LevelPtr->SourceObj->Package.Elements[ThisIndex];
if (IS_THIS_OBJECT_TYPE (ThisSourceObj, ACPI_TYPE_PACKAGE))
{
/*
* If this object is a package then we go one deeper
*/
if (CurrentDepth >= MAX_PACKAGE_DEPTH-1)
{
/*
* Too many nested levels of packages for us to handle
*/
DEBUG_PRINT (ACPI_ERROR,
("AmlBuildCopyInternalPackageObject: Pkg nested too deep (max %X)\n",
MAX_PACKAGE_DEPTH));
return_ACPI_STATUS (AE_LIMIT);
}
/*
* Build the package object
*/
ThisDestObj = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE);
LevelPtr->DestObj->Package.Elements[ThisIndex] = ThisDestObj;
ThisDestObj->Common.Type = ACPI_TYPE_PACKAGE;
ThisDestObj->Package.Count = ThisDestObj->Package.Count;
/*
* Save space for the array of objects (Package elements)
* update the buffer length counter
*/
ObjectSpace = ThisDestObj->Package.Count *
sizeof (ACPI_OPERAND_OBJECT);
Length += ObjectSpace;
CurrentDepth++;
LevelPtr = &CopyLevel[CurrentDepth];
LevelPtr->DestObj = ThisDestObj;
LevelPtr->SourceObj = ThisSourceObj;
LevelPtr->Index = 0;
} /* if object is a package */
else
{
ThisDestObj = AcpiCmCreateInternalObject (
ThisSourceObj->Common.Type);
LevelPtr->DestObj->Package.Elements[ThisIndex] = ThisDestObj;
Status = AcpiAmlStoreObjectToObject(ThisSourceObj, ThisDestObj, WalkState);
if (ACPI_FAILURE (Status))
{
/*
* Failure get out
*/
return_ACPI_STATUS (Status);
}
Length +=ObjectSpace;
LevelPtr->Index++;
while (LevelPtr->Index >= LevelPtr->DestObj->Package.Count)
{
/*
* We've handled all of the objects at this level, This means
* that we have just completed a package. That package may
* have contained one or more packages itself
*/
if (CurrentDepth == 0)
{
/*
* We have handled all of the objects in the top level
* package just add the length of the package objects
* and exit
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index past the just
* completed package object.
*/
CurrentDepth--;
LevelPtr = &CopyLevel[CurrentDepth];
LevelPtr->Index++;
}
} /* else object is NOT a package */
} /* while (1) */
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 5 $
* $Revision: 7 $
*
*****************************************************************************/
@ -282,15 +282,14 @@ AcpiEnterSleepState (
DEBUG_PRINT(ACPI_OK, ("Entering S%d\n", SleepState));
/* the old version was disabling interrupts. let's try it without
* and see how that works
*/
/*disable();*/
disable();
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl);
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl);
AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL,
(1 << AcpiHwGetBitShift (SLP_EN_MASK)));
/*enable();*/
enable();
return_ACPI_STATUS (AE_OK);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
* $Revision: 4 $
* $Revision: 5 $
*
*****************************************************************************/
@ -235,7 +235,7 @@ AcpiGetTimerDuration (
/*
* Compute Tick Delta:
* -------------------
* Handle timer rollovers on 24- versus 32-bit timers.
* Handle (max one) timer rollovers on 24- versus 32-bit timers.
*/
if (StartTicks < EndTicks)
{
@ -246,7 +246,7 @@ AcpiGetTimerDuration (
/* 24-bit Timer */
if (0 == AcpiGbl_FADT->TmrValExt)
{
DeltaTicks = (0x00FFFFFF - StartTicks) + EndTicks;
DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF);
}
/* 32-bit Timer */
else
@ -254,6 +254,11 @@ AcpiGetTimerDuration (
DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks;
}
}
else
{
*TimeElapsed = 0;
return_ACPI_STATUS (AE_OK);
}
/*
* Compute Duration:

View File

@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 81 $
* $Revision: 83 $
*
******************************************************************************/
@ -388,8 +388,8 @@ AcpiNsEvaluateByHandle (
Node = AcpiNsConvertHandleToEntry (Handle);
if (!Node)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -456,12 +456,6 @@ AcpiNsEvaluateByHandle (
* so we just return
*/
return_ACPI_STATUS (Status);
UnlockAndExit:
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
@ -497,6 +491,16 @@ AcpiNsExecuteControlMethod (
FUNCTION_TRACE ("NsExecuteControlMethod");
/*
* Unlock the namespace before execution. This allows namespace access
* via the external Acpi* interfaces while a method is being executed.
* However, any namespace deletion must acquire both the namespace and
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/* Verify that there is a method associated with this object */
ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) MethodNode);
@ -518,19 +522,8 @@ AcpiNsExecuteControlMethod (
DEBUG_PRINT (TRACE_NAMES,
("At offset %8XH\n", ObjDesc->Method.Pcode + 1));
/*
* Unlock the namespace before execution. This allows namespace access
* via the external Acpi* interfaces while a method is being executed.
* However, any namespace deletion must acquire both the namespace and
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
/*
* Excecute the method via the interpreter
* Execute the method via the interpreter
*/
Status = AcpiAmlExecuteMethod (MethodNode, Params, ReturnObjDesc);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
* $Revision: 12 $
* $Revision: 15 $
*
*****************************************************************************/
@ -203,7 +203,7 @@ AcpiNsInitializeObjects (
ACPI_STATUS
AcpiNsInitializeDevices (
UINT32 Flags)
void)
{
ACPI_STATUS Status;
ACPI_DEVICE_WALK_INFO Info;
@ -212,7 +212,6 @@ AcpiNsInitializeDevices (
FUNCTION_TRACE ("NsInitializeDevices");
Info.Flags = Flags;
Info.DeviceCount = 0;
Info.Num_STA = 0;
Info.Num_INI = 0;
@ -304,7 +303,11 @@ AcpiNsInitOneObject (
AcpiCmFormatException (Status), &Node->Name));
}
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
break;
@ -324,7 +327,11 @@ AcpiNsInitOneObject (
DEBUG_PRINT (ACPI_ERROR, ("%s while getting field arguments [%4.4s]\n",
AcpiCmFormatException (Status), &Node->Name));
}
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
break;
@ -344,7 +351,7 @@ AcpiNsInitOneObject (
*
* FUNCTION: AcpiNsInitOneDevice
*
* PARAMETERS: The usual "I'm a namespace callback" stuff
* PARAMETERS: WALK_CALLBACK
*
* RETURN: ACPI_STATUS
*
@ -370,7 +377,11 @@ AcpiNsInitOneDevice (
FUNCTION_TRACE ("AcpiNsInitOneDevice");
DEBUG_PRINT_RAW (ACPI_OK, ("."));
if (!(AcpiDbgLevel & TRACE_INIT))
{
DEBUG_PRINT_RAW (ACPI_OK, ("."));
}
Info->DeviceCount++;
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
@ -388,6 +399,7 @@ AcpiNsInitOneDevice (
* Run _STA to determine if we can run _INI on the device.
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, "_STA [Method]"));
Status = AcpiCmExecute_STA (Node, &Flags);
if (ACPI_FAILURE (Status))
{
@ -404,10 +416,13 @@ AcpiNsInitOneDevice (
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
/*
* The device is present. Run _INI.
*/
DEBUG_EXEC(AcpiCmDisplayInitPathname (ObjHandle, "_INI [Method]"));
Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL);
if (AE_NOT_FOUND == Status)
{

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 53 $
* $Revision: 54 $
*
******************************************************************************/
@ -217,6 +217,48 @@ AcpiNsGetTablePathname (
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetPathnameLength
*
* PARAMETERS: Node - Namespace node
*
* RETURN: Length of path, including prefix
*
* DESCRIPTION: Get the length of the pathname string for this node
*
******************************************************************************/
UINT32
AcpiNsGetPathnameLength (
ACPI_NAMESPACE_NODE *Node)
{
UINT32 Size;
ACPI_NAMESPACE_NODE *NextNode;
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
for (Size = 0, NextNode = Node;
AcpiNsGetParentObject (NextNode);
NextNode = AcpiNsGetParentObject (NextNode))
{
Size += PATH_SEGMENT_LENGTH;
}
/* Special case for size still 0 - no parent for "special" nodes */
if (!Size)
{
Size = PATH_SEGMENT_LENGTH;
}
return (Size + 1);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsHandleToPathname
@ -242,11 +284,10 @@ AcpiNsHandleToPathname (
{
ACPI_STATUS Status = AE_OK;
ACPI_NAMESPACE_NODE *Node;
ACPI_NAMESPACE_NODE *NextNode;
UINT32 PathLength;
UINT32 Size;
UINT32 UserBufSize;
ACPI_NAME Name;
UINT32 Size;
FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
@ -267,27 +308,12 @@ AcpiNsHandleToPathname (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
*/
for (Size = 0, NextNode = Node;
AcpiNsGetParentObject (NextNode);
NextNode = AcpiNsGetParentObject (NextNode))
{
Size += PATH_SEGMENT_LENGTH;
}
/* Special case for size still 0 - no parent for "special" nodes */
if (!Size)
{
Size = PATH_SEGMENT_LENGTH;
}
/* Set return length to the required path length */
PathLength = Size + 1;
PathLength = AcpiNsGetPathnameLength (Node);
Size = PathLength - 1;
UserBufSize = *BufSize;
*BufSize = PathLength;

View File

@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
* $Revision: 78 $
* $Revision: 80 $
*
******************************************************************************/
@ -217,9 +217,8 @@ AcpiEvaluateObject (
*/
for (i = 0; i < Count; i++)
{
Status =
AcpiCmBuildInternalObject (&ParamObjects->Pointer[i],
ParamPtr[i]);
Status = AcpiCmCopyEobjectToIobject (&ParamObjects->Pointer[i],
ParamPtr[i]);
if (ACPI_FAILURE (Status))
{
@ -362,7 +361,7 @@ AcpiEvaluateObject (
/*
* We have enough space for the object, build it
*/
Status = AcpiCmBuildExternalObject (ReturnObj,
Status = AcpiCmCopyIobjectToEobject (ReturnObj,
ReturnBuffer);
ReturnBuffer->Length = BufferSpaceNeeded;
}
@ -725,14 +724,14 @@ AcpiNsGetDeviceCallback (
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
Node = AcpiNsConvertHandleToEntry (ObjHandle);
if (!Node)
{
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
if (!Node)
{
return (AE_BAD_PARAMETER);
}
/*
* Run _STA to determine if device is present
*/

View File

@ -2,7 +2,7 @@
*
* Module Name: rscalc - AcpiRsCalculateByteStreamLength
* AcpiRsCalculateListLength
* $Revision: 18 $
* $Revision: 21 $
*
******************************************************************************/
@ -119,6 +119,8 @@
#include "acpi.h"
#include "acresrc.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT RESOURCE_MANAGER
MODULE_NAME ("rscalc")
@ -825,6 +827,7 @@ AcpiRsCalculateListLength (
*/
BytesConsumed = 2;
StructureSize = RESOURCE_LENGTH;
ByteStreamBufferLength = BytesParsed;
break;
@ -936,7 +939,9 @@ AcpiRsCalculatePciRoutingTableLength (
for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++)
{
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
if ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) ||
((INTERNAL_TYPE_REFERENCE == (*SubObjectList)->Common.Type) &&
((*SubObjectList)->Reference.OpCode == AML_NAMEPATH_OP)))
{
NameFound = TRUE;
}
@ -950,18 +955,25 @@ AcpiRsCalculatePciRoutingTableLength (
}
}
TempSizeNeeded += (sizeof (PCI_ROUTING_TABLE) - 1);
TempSizeNeeded += (sizeof (PCI_ROUTING_TABLE) - 4);
/*
* Was a String type found?
*/
if (TRUE == NameFound)
{
/*
* The length String.Length field includes the
* terminating NULL
*/
TempSizeNeeded += (*SubObjectList)->String.Length;
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
{
/*
* The length String.Length field includes the
* terminating NULL
*/
TempSizeNeeded += (*SubObjectList)->String.Length;
}
else
{
TempSizeNeeded += AcpiNsGetPathnameLength ((*SubObjectList)->Reference.Node);
}
}
else
@ -985,7 +997,7 @@ AcpiRsCalculatePciRoutingTableLength (
}
*BufferSizeNeeded = TempSizeNeeded + sizeof (PCI_ROUTING_TABLE);
*BufferSizeNeeded = TempSizeNeeded;
return_ACPI_STATUS (AE_OK);
}

View File

@ -3,7 +3,7 @@
* Module Name: rscreate - AcpiRsCreateResourceList
* AcpiRsCreatePciRoutingTable
* AcpiRsCreateByteStream
* $Revision: 24 $
* $Revision: 25 $
*
******************************************************************************/
@ -121,6 +121,8 @@
#include "acpi.h"
#include "acresrc.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT RESOURCE_MANAGER
MODULE_NAME ("rscreate")
@ -266,6 +268,7 @@ AcpiRsCreatePciRoutingTable (
UINT32 NumberOfElements = 0;
UINT32 Index = 0;
PCI_ROUTING_TABLE *UserPrt = NULL;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
@ -321,10 +324,10 @@ AcpiRsCreatePciRoutingTable (
/*
* Fill in the Length field with the information we
* have at this point.
* The minus one is to subtract the size of the
* UINT8 Source[1] member because it is added below.
* The minus four is to subtract the size of the
* UINT8 Source[4] member because it is added below.
*/
UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) - 1);
UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) -4);
/*
* Dereference the sub-package
@ -339,71 +342,99 @@ AcpiRsCreatePciRoutingTable (
SubObjectList = PackageElement->Package.Elements;
/*
* Dereference the Address
* 1) First subobject: Dereference the Address
*/
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Address =
(*SubObjectList)->Integer.Value;
UserPrt->Address = (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Dereference the Pin
* 2) Second subobject: Dereference the Pin
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Pin =
UserPrt->Pin =
(UINT32) (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Dereference the Source Name
* 3) Third subobject: Dereference the Source Name
*/
SubObjectList++;
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
switch ((*SubObjectList)->Common.Type)
{
STRCPY (UserPrt->Data.Source,
case INTERNAL_TYPE_REFERENCE:
if ((*SubObjectList)->Reference.OpCode != AML_NAMEPATH_OP)
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need name, found reference op %X\n",
(*SubObjectList)->Reference.OpCode));
return_ACPI_STATUS (AE_BAD_DATA);
}
Node = (*SubObjectList)->Reference.Node;
/* TBD: use *remaining* length of the buffer! */
Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node,
OutputBufferLength, UserPrt->Source);
UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */
break;
case ACPI_TYPE_STRING:
STRCPY (UserPrt->Source,
(*SubObjectList)->String.Pointer);
/*
* Add to the Length field the length of the string
*/
UserPrt->Length += (*SubObjectList)->String.Length;
}
break;
else
{
case ACPI_TYPE_INTEGER:
/*
* If this is a number, then the Source Name
* is NULL, since the entire buffer was zeroed
* out, we can leave this alone.
*/
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
/*
* Add to the Length field the length of
* the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
}
/*
* Add to the Length field the length of
* the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
break;
else
{
return_ACPI_STATUS (AE_BAD_DATA);
}
default:
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
break;
}
/* Now align the current length */
@ -411,18 +442,21 @@ AcpiRsCreatePciRoutingTable (
UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length);
/*
* Dereference the Source Index
* 4) Fourth subobject: Dereference the Source Index
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.SourceIndex =
UserPrt->SourceIndex =
(UINT32) (*SubObjectList)->Integer.Value;
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("CreatePciRoutingTable: Need Integer, found %s\n",
AcpiCmGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions do dump out the resource structures.
* $Revision: 15 $
* $Revision: 16 $
*
******************************************************************************/
@ -1013,25 +1013,25 @@ AcpiRsDumpIrqList (
if (AcpiDbgLevel & TRACE_RESOURCES && _COMPONENT & AcpiDbgLayer)
{
PrtElement = (PCI_ROUTING_TABLE *)Buffer;
PrtElement = (PCI_ROUTING_TABLE *) Buffer;
while (!Done)
{
AcpiOsPrintf ("\tPCI IRQ Routing Table structure %X.\n", Count++);
AcpiOsPrintf ("\t\tAddress: %X\n",
PrtElement->Data.Address);
PrtElement->Address);
AcpiOsPrintf ("\t\tPin: %X\n", PrtElement->Data.Pin);
AcpiOsPrintf ("\t\tPin: %X\n", PrtElement->Pin);
AcpiOsPrintf ("\t\tSource: %s\n", PrtElement->Data.Source);
AcpiOsPrintf ("\t\tSource: %s\n", PrtElement->Source);
AcpiOsPrintf ("\t\tSourceIndex: %X\n",
PrtElement->Data.SourceIndex);
PrtElement->SourceIndex);
Buffer += PrtElement->Length;
PrtElement = (PCI_ROUTING_TABLE *)Buffer;
PrtElement = (PCI_ROUTING_TABLE *) Buffer;
if(0 == PrtElement->Length)
{

View File

@ -2,7 +2,7 @@
*
* Module Name: rslist - AcpiRsByteStreamToList
* AcpiListToByteStream
* $Revision: 10 $
* $Revision: 11 $
*
******************************************************************************/
@ -399,8 +399,7 @@ AcpiRsByteStreamToList (
/*
* Check the reason for exiting the while loop
*/
if (!(ByteStreamBufferLength == BytesParsed) ||
(TRUE != EndTagProcessed))
if (TRUE != EndTagProcessed)
{
return_ACPI_STATUS (AE_AML_ERROR);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: cmutils - common utility procedures
* $Revision: 23 $
* $Revision: 27 $
*
******************************************************************************/
@ -474,6 +474,44 @@ AcpiCmCreateUpdateStateAndPush (
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreatePkgStateAndPush
*
* PARAMETERS: *Object - Object to be added to the new state
* Action - Increment/Decrement
* StateList - List the state will be added to
*
* RETURN: None
*
* DESCRIPTION: Create a new state and push it
*
******************************************************************************/
ACPI_STATUS
AcpiCmCreatePkgStateAndPush (
void *InternalObject,
void *ExternalObject,
UINT16 Index,
ACPI_GENERIC_STATE **StateList)
{
ACPI_GENERIC_STATE *State;
State = AcpiCmCreatePkgState (InternalObject, ExternalObject, Index);
if (!State)
{
return (AE_NO_MEMORY);
}
AcpiCmPushGenericState (StateList, State);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmPushGenericState
@ -648,6 +686,54 @@ AcpiCmCreateUpdateState (
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreatePkgState
*
* PARAMETERS: Object - Initial Object to be installed in the
* state
* Action - Update action to be performed
*
* RETURN: Status
*
* DESCRIPTION: Create an "Update State" - a flavor of the generic state used
* to update reference counts and delete complex objects such
* as packages.
*
******************************************************************************/
ACPI_GENERIC_STATE *
AcpiCmCreatePkgState (
void *InternalObject,
void *ExternalObject,
UINT16 Index)
{
ACPI_GENERIC_STATE *State;
FUNCTION_TRACE_PTR ("CmCreatePkgState", InternalObject);
/* Create the generic state object */
State = AcpiCmCreateGenericState ();
if (!State)
{
return (NULL);
}
/* Init fields specific to the update struct */
State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
State->Pkg.DestObject = ExternalObject;
State->Pkg.Index = Index;
State->Pkg.NumPackages = 1;
return_PTR (State);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmCreateControlState
@ -793,19 +879,24 @@ ACPI_STATUS
AcpiCmResolvePackageReferences (
ACPI_OPERAND_OBJECT *ObjDesc)
{
UINT32 Count;
ACPI_OPERAND_OBJECT *SubObject;
UINT32 Count;
ACPI_OPERAND_OBJECT *SubObject;
FUNCTION_TRACE ("AcpiCmResolvePackageReferences");
if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
/* Must be a package */
/* The object must be a package */
REPORT_ERROR (("Must resolve Package Refs on a Package\n"));
return_ACPI_STATUS(AE_ERROR);
}
/*
* TBD: what about nested packages? */
for (Count = 0; Count < ObjDesc->Package.Count; Count++)
{
SubObject = ObjDesc->Package.Elements[Count];
@ -833,6 +924,181 @@ AcpiCmResolvePackageReferences (
return_ACPI_STATUS(AE_OK);
}
#ifdef ACPI_DEBUG
/******************************************************************************
*
* FUNCTION: AcpiCmDisplayInitPathname
*
* PARAMETERS: ObjHandle - Handle whose pathname will be displayed
* Path - Additional path string to be appended
*
* RETURN: ACPI_STATUS
*
* DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY
*
*****************************************************************************/
void
AcpiCmDisplayInitPathname (
ACPI_HANDLE ObjHandle,
char *Path)
{
ACPI_STATUS Status;
UINT32 Length = 128;
char Buffer[128];
Status = AcpiNsHandleToPathname (ObjHandle, &Length, Buffer);
if (ACPI_SUCCESS (Status))
{
if (Path)
{
DEBUG_PRINT (TRACE_INIT, ("%s.%s\n", Buffer, Path))
}
else
{
DEBUG_PRINT (TRACE_INIT, ("%s\n", Buffer))
}
}
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiCmWalkPackageTree
*
* PARAMETERS: ObjDesc - The Package object on which to resolve refs
*
* RETURN: Status
*
* DESCRIPTION: Walk through a package
*
******************************************************************************/
ACPI_STATUS
AcpiCmWalkPackageTree (
ACPI_OPERAND_OBJECT *SourceObject,
void *TargetObject,
ACPI_PKG_CALLBACK WalkCallback,
void *Context)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *StateList = NULL;
ACPI_GENERIC_STATE *State;
UINT32 ThisIndex;
ACPI_OPERAND_OBJECT *ThisSourceObj;
FUNCTION_TRACE ("AcpiCmWalkPackageTree");
State = AcpiCmCreatePkgState (SourceObject, TargetObject, 0);
if (!State)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
while (State)
{
ThisIndex = State->Pkg.Index;
ThisSourceObj = (ACPI_OPERAND_OBJECT *)
State->Pkg.SourceObject->Package.Elements[ThisIndex];
/*
* Check for
* 1) An uninitialized package element. It is completely
* legal to declare a package and leave it uninitialized
* 2) Not an internal object - can be a namespace node instead
* 3) Any type other than a package. Packages are handled in else case below.
*/
if ((!ThisSourceObj) ||
(!VALID_DESCRIPTOR_TYPE (
ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) ||
(!IS_THIS_OBJECT_TYPE (
ThisSourceObj, ACPI_TYPE_PACKAGE)))
{
Status = WalkCallback (0, ThisSourceObj, State, Context);
if (ACPI_FAILURE (Status))
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (Status);
}
State->Pkg.Index++;
while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count)
{
/*
* We've handled all of the objects at this level, This means
* that we have just completed a package. That package may
* have contained one or more packages itself.
*
* Delete this state and pop the previous state (package).
*/
AcpiCmDeleteGenericState (State);
State = AcpiCmPopGenericState (&StateList);
/* Finished when there are no more states */
if (!State)
{
/*
* We have handled all of the objects in the top level
* package just add the length of the package objects
* and exit
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index past the just
* completed package object.
*/
State->Pkg.Index++;
}
}
else
{
/* This is a sub-object of type package */
Status = WalkCallback (1, ThisSourceObj, State, Context);
if (ACPI_FAILURE (Status))
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (Status);
}
/*
* The callback above returned a new target package object.
*/
/*
* Push the current state and create a new one
*/
AcpiCmPushGenericState (&StateList, State);
State = AcpiCmCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0);
if (!State)
{
/* TBD: must delete package created up to this point */
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
}
/* We should never get here */
return (AE_AML_INTERNAL);
}
/*******************************************************************************
*
@ -845,7 +1111,7 @@ AcpiCmResolvePackageReferences (
*
* RETURN: None
*
* DESCRIPTION: Print error message from KD table
* DESCRIPTION: Print error message
*
******************************************************************************/
@ -872,7 +1138,7 @@ _ReportError (
*
* RETURN: None
*
* DESCRIPTION: Print warning message from KD table
* DESCRIPTION: Print warning message
*
******************************************************************************/
@ -898,7 +1164,7 @@ _ReportWarning (
*
* RETURN: None
*
* DESCRIPTION: Print information message from KD table
* DESCRIPTION: Print information message
*
******************************************************************************/

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmobject - ACPI object create/delete/size/cache routines
* $Revision: 35 $
* $Revision: 36 $
*
*****************************************************************************/
@ -127,7 +127,7 @@
MODULE_NAME ("cmobject")
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: _CmCreateInternalObject
*
@ -141,11 +141,11 @@
*
* DESCRIPTION: Create and initialize a new internal object.
*
* NOTE:
* We always allocate the worst-case object descriptor because these
* objects are cached, and we want them to be one-size-satisifies-any-request.
* This in itself may not be the most memory efficient, but the efficiency
* of the object cache should more than make up for this!
* NOTE: We always allocate the worst-case object descriptor because
* these objects are cached, and we want them to be
* one-size-satisifies-any-request. This in itself may not be
* the most memory efficient, but the efficiency of the object
* cache should more than make up for this!
*
******************************************************************************/
@ -187,7 +187,7 @@ _CmCreateInternalObject (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmValidInternalObject
*
@ -195,7 +195,7 @@ _CmCreateInternalObject (
*
* RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT
*
*****************************************************************************/
******************************************************************************/
BOOLEAN
AcpiCmValidInternalObject (
@ -257,7 +257,7 @@ AcpiCmValidInternalObject (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: _CmAllocateObjectDesc
*
@ -271,7 +271,7 @@ AcpiCmValidInternalObject (
* DESCRIPTION: Allocate a new object descriptor. Gracefully handle
* error conditions.
*
****************************************************************************/
******************************************************************************/
void *
_CmAllocateObjectDesc (
@ -341,7 +341,7 @@ _CmAllocateObjectDesc (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmDeleteObjectDesc
*
@ -351,7 +351,7 @@ _CmAllocateObjectDesc (
*
* DESCRIPTION: Free an ACPI object descriptor or add it to the object cache
*
****************************************************************************/
******************************************************************************/
void
AcpiCmDeleteObjectDesc (
@ -414,7 +414,7 @@ AcpiCmDeleteObjectDesc (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmDeleteObjectCache
*
@ -461,7 +461,7 @@ AcpiCmDeleteObjectCache (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmInitStaticObject
*
@ -473,7 +473,7 @@ AcpiCmDeleteObjectCache (
* DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic
* deletion of the object.
*
****************************************************************************/
******************************************************************************/
void
AcpiCmInitStaticObject (
@ -512,14 +512,14 @@ AcpiCmInitStaticObject (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetSimpleObjectSize
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length is returned
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length is returned
*
* RETURN: Status - the status of the call
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain a simple object for return to an API user.
@ -531,19 +531,19 @@ AcpiCmInitStaticObject (
ACPI_STATUS
AcpiCmGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
UINT32 Length;
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObj);
FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObject);
/* Handle a null object (Could be a uninitialized package element -- which is legal) */
if (!InternalObj)
if (!InternalObject)
{
*ObjLength = 0;
return_ACPI_STATUS (AE_OK);
@ -554,7 +554,7 @@ AcpiCmGetSimpleObjectSize (
Length = sizeof (ACPI_OBJECT);
if (VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_NAMED))
if (VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_NAMED))
{
/* Object is a named object (reference), just return the length */
@ -571,18 +571,18 @@ AcpiCmGetSimpleObjectSize (
* TBD:[Investigate] do strings and buffers require alignment also?
*/
switch (InternalObj->Common.Type)
switch (InternalObject->Common.Type)
{
case ACPI_TYPE_STRING:
Length += InternalObj->String.Length + 1;
Length += InternalObject->String.Length + 1;
break;
case ACPI_TYPE_BUFFER:
Length += InternalObj->Buffer.Length;
Length += InternalObject->Buffer.Length;
break;
@ -602,11 +602,11 @@ AcpiCmGetSimpleObjectSize (
* The only type that should be here is opcode AML_NAMEPATH_OP -- since
* this means an object reference
*/
if (InternalObj->Reference.OpCode != AML_NAMEPATH_OP)
if (InternalObject->Reference.OpCode != AML_NAMEPATH_OP)
{
DEBUG_PRINT (ACPI_ERROR,
("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n",
InternalObj->Reference.OpCode, InternalObj));
InternalObject->Reference.OpCode, InternalObject));
Status = AE_TYPE;
}
break;
@ -616,7 +616,7 @@ AcpiCmGetSimpleObjectSize (
DEBUG_PRINT (ACPI_ERROR,
("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n",
InternalObj->Common.Type, InternalObj));
InternalObject->Common.Type, InternalObject));
Status = AE_TYPE;
break;
}
@ -634,161 +634,124 @@ AcpiCmGetSimpleObjectSize (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetPackageObjectSize
* FUNCTION: AcpiCmCopyPackageToInternal
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length is returned
* PARAMETERS: ACPI_PKG_CALLBACK
*
* RETURN: Status - the status of the call
*
* DESCRIPTION: This function is called to determine the space required to contain
* a package object for return to an API user.
* DESCRIPTION:
*
* This is moderately complex since a package contains other objects
* including packages.
******************************************************************************/
ACPI_STATUS
AcpiCmGetElementLength (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
ACPI_GENERIC_STATE *State,
void *Context)
{
ACPI_STATUS Status = AE_OK;
ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
UINT32 ObjectSpace;
switch (ObjectType)
{
case 0:
/*
* Simple object - just get the size (Null object/entry is handled
* here also) and sum it into the running package length
*/
Status = AcpiCmGetSimpleObjectSize (SourceObject, &ObjectSpace);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Info->Length += ObjectSpace;
break;
case 1:
/* Package - nothing much to do here, let the walk handle it */
Info->NumPackages++;
State->Pkg.ThisTargetObj = NULL;
break;
default:
return (AE_BAD_PARAMETER);
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiCmGetPackageObjectSize
*
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length is returned
*
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain a package object for return to an API user.
*
* This is moderately complex since a package contains other
* objects including packages.
*
******************************************************************************/
ACPI_STATUS
AcpiCmGetPackageObjectSize (
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
ACPI_OPERAND_OBJECT *ThisInternalObj;
ACPI_OPERAND_OBJECT *ParentObj[MAX_PACKAGE_DEPTH];
ACPI_OPERAND_OBJECT *ThisParent;
UINT32 ThisIndex;
UINT32 Index[MAX_PACKAGE_DEPTH];
UINT32 Length = 0;
UINT32 ObjectSpace;
UINT32 CurrentDepth = 0;
UINT32 PackageCount = 1;
ACPI_STATUS Status;
ACPI_PKG_INFO Info;
FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObj);
FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObject);
/* Init the package stack TBD: replace with linked list */
Info.Length = 0;
Info.ObjectSpace = 0;
Info.NumPackages = 1;
MEMSET(ParentObj, 0, MAX_PACKAGE_DEPTH);
MEMSET(Index, 0, MAX_PACKAGE_DEPTH);
Status = AcpiCmWalkPackageTree (InternalObject, NULL,
AcpiCmGetElementLength, &Info);
ParentObj[0] = InternalObj;
/*
* We have handled all of the objects in all levels of the package.
* just add the length of the package objects themselves.
* Round up to the next machine word.
*/
Info.Length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) *
Info.NumPackages;
while (1)
{
ThisParent = ParentObj[CurrentDepth];
ThisIndex = Index[CurrentDepth];
ThisInternalObj = ThisParent->Package.Elements[ThisIndex];
/* Return the total package length */
/*
* Check for 1) An uninitialized package element. It is completely
* legal to declare a package and leave it uninitialized
* 2) Any type other than a package. Packages are handled
* below.
*/
if ((!ThisInternalObj) ||
(!IS_THIS_OBJECT_TYPE (ThisInternalObj, ACPI_TYPE_PACKAGE)))
{
/*
* Simple object - just get the size (Null object/entry handled
* also)
*/
Status =
AcpiCmGetSimpleObjectSize (ThisInternalObj, &ObjectSpace);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Length += ObjectSpace;
Index[CurrentDepth]++;
while (Index[CurrentDepth] >=
ParentObj[CurrentDepth]->Package.Count)
{
/*
* We've handled all of the objects at
* this level, This means that we have
* just completed a package. That package
* may have contained one or more packages
* itself.
*/
if (CurrentDepth == 0)
{
/*
* We have handled all of the objects
* in the top level package just add the
* length of the package objects and
* get out. Round up to the next machine
* word.
*/
Length +=
ROUND_UP_TO_NATIVE_WORD (
sizeof (ACPI_OBJECT)) *
PackageCount;
*ObjLength = Length;
return_ACPI_STATUS (AE_OK);
}
/*
* Go back up a level and move the index
* past the just completed package object.
*/
CurrentDepth--;
Index[CurrentDepth]++;
}
}
else
{
/*
* This object is a package
* -- go one level deeper
*/
PackageCount++;
if (CurrentDepth < MAX_PACKAGE_DEPTH-1)
{
CurrentDepth++;
ParentObj[CurrentDepth] = ThisInternalObj;
Index[CurrentDepth] = 0;
}
else
{
/*
* Too many nested levels of packages for us
* to handle
*/
DEBUG_PRINT (ACPI_ERROR,
("CmGetPackageObjectSize: Pkg nested too deep (max %X)\n",
MAX_PACKAGE_DEPTH));
return_ACPI_STATUS (AE_LIMIT);
}
}
}
*ObjLength = Info.Length;
return_ACPI_STATUS (Status);
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: AcpiCmGetObjectSize
*
* PARAMETERS: *InternalObj - Pointer to the object we are examining
* *RetLength - Where the length will be returned
* PARAMETERS: *InternalObject - Pointer to the object we are examining
* *RetLength - Where the length will be returned
*
* RETURN: Status - the status of the call
* RETURN: Status
*
* DESCRIPTION: This function is called to determine the space required to
* contain an object for return to an API user.
@ -797,23 +760,21 @@ AcpiCmGetPackageObjectSize (
ACPI_STATUS
AcpiCmGetObjectSize(
ACPI_OPERAND_OBJECT *InternalObj,
ACPI_OPERAND_OBJECT *InternalObject,
UINT32 *ObjLength)
{
ACPI_STATUS Status;
if ((VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_INTERNAL)) &&
(IS_THIS_OBJECT_TYPE (InternalObj, ACPI_TYPE_PACKAGE)))
if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) &&
(IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE)))
{
Status =
AcpiCmGetPackageObjectSize (InternalObj, ObjLength);
Status = AcpiCmGetPackageObjectSize (InternalObject, ObjLength);
}
else
{
Status =
AcpiCmGetSimpleObjectSize (InternalObj, ObjLength);
Status = AcpiCmGetSimpleObjectSize (InternalObject, ObjLength);
}
return (Status);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmxface - External interfaces for "global" ACPI functions
* $Revision: 62 $
* $Revision: 64 $
*
*****************************************************************************/
@ -272,9 +272,8 @@ AcpiEnableSubsystem (
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
/* TBD: workaround. Old Lions don't enable properly */
DEBUG_PRINT(ACPI_WARN, ("AcpiEnable failed.\n"));
/*return_ACPI_STATUS (Status);*/
return_ACPI_STATUS (Status);
}
}
@ -299,15 +298,14 @@ AcpiEnableSubsystem (
/*
* Initialize all device objects in the namespace
* This runs the _STA, _INI, and _HID methods, and detects
* the PCI root bus(es)
* This runs the _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI Devices\n"));
Status = AcpiNsInitializeDevices (Flags & ACPI_NO_PCI_INIT);
Status = AcpiNsInitializeDevices ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -316,7 +314,7 @@ AcpiEnableSubsystem (
/*
* Initialize the objects that remain unitialized. This
* Initialize the objects that remain uninitialized. This
* runs the executable AML that is part of the declaration of OpRegions
* and Fields.
*/