diff options
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Interpreter')
4 files changed, 30 insertions, 189 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c index ad40aec..24c9a2a 100644 --- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c +++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c @@ -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 diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c index 71d1dfb..c2c29d71 100644 --- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c +++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c @@ -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))); diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c index 0825891..a4bd94d 100644 --- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c +++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: amstorob - AML Interpreter object store support, store to object - * $Revision: 22 $ + * $Revision: 23 $ * *****************************************************************************/ @@ -160,6 +160,21 @@ AcpiAmlCopyBufferToBuffer ( 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))); } diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c index e106bfb..7f17991 100644 --- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c +++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c @@ -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) */ -} |