diff options
author | jkim <jkim@FreeBSD.org> | 2016-09-30 22:40:58 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2016-09-30 22:40:58 +0000 |
commit | dba8c0a565199df70a86f6a036d00c92f0c7675f (patch) | |
tree | cf4924274c6e92898c01efb3c8ba31b34f0630f2 /sys/contrib/dev/acpica/components/utilities | |
parent | 0f41551ef9dde560d9d191d7190af02904dbf611 (diff) | |
download | FreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.zip FreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.tar.gz |
MFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
r300879
Merge ACPICA up to 20160527.
Requested by: mav
Diffstat (limited to 'sys/contrib/dev/acpica/components/utilities')
36 files changed, 1541 insertions, 1381 deletions
diff --git a/sys/contrib/dev/acpica/components/utilities/utaddress.c b/sys/contrib/dev/acpica/components/utilities/utaddress.c index 5ed2b4d..166f552 100644 --- a/sys/contrib/dev/acpica/components/utilities/utaddress.c +++ b/sys/contrib/dev/acpica/components/utilities/utaddress.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -263,7 +263,7 @@ AcpiUtCheckAddressRange ( OverlapCount++; if (Warn) /* Optional warning message */ { - Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode); + Pathname = AcpiNsGetNormalizedPathname (RangeInfo->RegionNode, TRUE); ACPI_WARNING ((AE_INFO, "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", diff --git a/sys/contrib/dev/acpica/components/utilities/utalloc.c b/sys/contrib/dev/acpica/components/utilities/utalloc.c index 99fb15a1..b768f58 100644 --- a/sys/contrib/dev/acpica/components/utilities/utalloc.c +++ b/sys/contrib/dev/acpica/components/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ AcpiOsAllocateZeroed ( { /* Clear the memory block */ - ACPI_MEMSET (Allocation, 0, Size); + memset (Allocation, 0, Size); } return (Allocation); @@ -110,35 +110,35 @@ AcpiUtCreateCaches ( /* Object Caches, for frequently used objects */ Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache); + ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE), - ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache); + ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON), - ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache); + ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED), - ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache); + ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT), - ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache); + ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache); if (ACPI_FAILURE (Status)) { return (Status); @@ -150,14 +150,14 @@ AcpiUtCreateCaches ( /* Memory allocation lists */ Status = AcpiUtCreateList ("Acpi-Global", 0, - &AcpiGbl_GlobalList); + &AcpiGbl_GlobalList); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE), - &AcpiGbl_NsNodeList); + &AcpiGbl_NsNodeList); if (ACPI_FAILURE (Status)) { return (Status); @@ -187,9 +187,10 @@ AcpiUtDeleteCaches ( #ifdef ACPI_DBG_TRACK_ALLOCATIONS char Buffer[7]; + if (AcpiGbl_DisplayFinalMemStats) { - ACPI_STRCPY (Buffer, "MEMORY"); + strcpy (Buffer, "MEMORY"); (void) AcpiDbDisplayStatistics (Buffer); } #endif @@ -359,6 +360,6 @@ AcpiUtInitializeBuffer ( /* Have a valid buffer, clear it */ - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); + memset (Buffer->Pointer, 0, RequiredLength); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/utilities/utascii.c b/sys/contrib/dev/acpica/components/utilities/utascii.c new file mode 100644 index 0000000..9081c55 --- /dev/null +++ b/sys/contrib/dev/acpica/components/utilities/utascii.c @@ -0,0 +1,161 @@ +/****************************************************************************** + * + * Module Name: utascii - Utility ascii functions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidNameseg + * + * PARAMETERS: Name - The name or table signature to be examined. + * Four characters, does not have to be a + * NULL terminated string. + * + * RETURN: TRUE if signature is has 4 valid ACPI characters + * + * DESCRIPTION: Validate an ACPI table signature. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidNameseg ( + char *Name) +{ + UINT32 i; + + + /* Validate each character in the signature */ + + for (i = 0; i < ACPI_NAME_SIZE; i++) + { + if (!AcpiUtValidNameChar (Name[i], i)) + { + return (FALSE); + } + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidNameChar + * + * PARAMETERS: Char - The character to be examined + * Position - Byte position (0-3) + * + * RETURN: TRUE if the character is valid, FALSE otherwise + * + * DESCRIPTION: Check for a valid ACPI character. Must be one of: + * 1) Upper case alpha + * 2) numeric + * 3) underscore + * + * We allow a '!' as the last character because of the ASF! table + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidNameChar ( + char Character, + UINT32 Position) +{ + + if (!((Character >= 'A' && Character <= 'Z') || + (Character >= '0' && Character <= '9') || + (Character == '_'))) + { + /* Allow a '!' in the last position */ + + if (Character == '!' && Position == 3) + { + return (TRUE); + } + + return (FALSE); + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCheckAndRepairAscii + * + * PARAMETERS: Name - Ascii string + * Count - Number of characters to check + * + * RETURN: None + * + * DESCRIPTION: Ensure that the requested number of characters are printable + * Ascii characters. Sets non-printable and null chars to <space>. + * + ******************************************************************************/ + +void +AcpiUtCheckAndRepairAscii ( + UINT8 *Name, + char *RepairedName, + UINT32 Count) +{ + UINT32 i; + + + for (i = 0; i < Count; i++) + { + RepairedName[i] = (char) Name[i]; + + if (!Name[i]) + { + return; + } + if (!isprint (Name[i])) + { + RepairedName[i] = ' '; + } + } +} diff --git a/sys/contrib/dev/acpica/components/utilities/utbuffer.c b/sys/contrib/dev/acpica/components/utilities/utbuffer.c index cc41419..dfe54d1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utbuffer.c +++ b/sys/contrib/dev/acpica/components/utilities/utbuffer.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -168,7 +168,7 @@ AcpiUtDumpBuffer ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiOsPrintf ("%c", BufChar); } @@ -341,7 +341,7 @@ AcpiUtDumpBufferToFile ( } BufChar = Buffer[(ACPI_SIZE) i + j]; - if (ACPI_IS_PRINT (BufChar)) + if (isprint (BufChar)) { AcpiUtFilePrintf (File, "%c", BufChar); } diff --git a/sys/contrib/dev/acpica/components/utilities/utcache.c b/sys/contrib/dev/acpica/components/utilities/utcache.c index aa0161c..af6df92 100644 --- a/sys/contrib/dev/acpica/components/utilities/utcache.c +++ b/sys/contrib/dev/acpica/components/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,10 +92,10 @@ AcpiOsCreateCache ( /* Populate the cache object and return it */ - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = CacheName; + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + Cache->ListName = CacheName; Cache->ObjectSize = ObjectSize; - Cache->MaxDepth = MaxDepth; + Cache->MaxDepth = MaxDepth; *ReturnCache = Cache; return (AE_OK); @@ -242,7 +242,7 @@ AcpiOsReleaseObject ( /* Mark the object as cached */ - ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize); + memset (Object, 0xCA, Cache->ObjectSize); ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ @@ -279,7 +279,7 @@ AcpiOsAcquireObject ( void *Object; - ACPI_FUNCTION_NAME (OsAcquireObject); + ACPI_FUNCTION_TRACE (OsAcquireObject); if (!Cache) @@ -318,7 +318,7 @@ AcpiOsAcquireObject ( /* Clear (zero) the previously used Object */ - ACPI_MEMSET (Object, 0, Cache->ObjectSize); + memset (Object, 0, Cache->ObjectSize); } else { diff --git a/sys/contrib/dev/acpica/components/utilities/utcopy.c b/sys/contrib/dev/acpica/components/utilities/utcopy.c index 8a94ea6..c1be4cc 100644 --- a/sys/contrib/dev/acpica/components/utilities/utcopy.c +++ b/sys/contrib/dev/acpica/components/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,7 +146,7 @@ AcpiUtCopyIsimpleToEsimple ( /* Always clear the external object */ - ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); + memset (ExternalObject, 0, sizeof (ACPI_OBJECT)); /* * In general, the external object will be the same type as @@ -163,9 +163,9 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->String.Pointer = (char *) DataSpace; ExternalObject->String.Length = InternalObject->String.Length; *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) InternalObject->String.Length + 1); + (ACPI_SIZE) InternalObject->String.Length + 1); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->String.Pointer, (ACPI_SIZE) InternalObject->String.Length + 1); break; @@ -175,9 +175,9 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->Buffer.Pointer = DataSpace; ExternalObject->Buffer.Length = InternalObject->Buffer.Length; *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ( - InternalObject->String.Length); + InternalObject->String.Length); - ACPI_MEMCPY ((void *) DataSpace, + memcpy ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, InternalObject->Buffer.Length); break; @@ -275,9 +275,9 @@ AcpiUtCopyIelementToEelement ( ACPI_FUNCTION_ENTRY (); - ThisIndex = State->Pkg.Index; - TargetObject = (ACPI_OBJECT *) - &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex]; + ThisIndex = State->Pkg.Index; + TargetObject = (ACPI_OBJECT *) &((ACPI_OBJECT *) + (State->Pkg.DestObject))->Package.Elements[ThisIndex]; switch (ObjectType) { @@ -286,7 +286,7 @@ AcpiUtCopyIelementToEelement ( * This is a simple or null object */ Status = AcpiUtCopyIsimpleToEsimple (SourceObject, - TargetObject, Info->FreeSpace, &ObjectSpace); + TargetObject, Info->FreeSpace, &ObjectSpace); if (ACPI_FAILURE (Status)) { return (Status); @@ -297,9 +297,9 @@ AcpiUtCopyIelementToEelement ( /* * Build the package object */ - TargetObject->Type = ACPI_TYPE_PACKAGE; - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = + TargetObject->Type = ACPI_TYPE_PACKAGE; + TargetObject->Package.Count = SourceObject->Package.Count; + TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace); /* @@ -312,8 +312,8 @@ AcpiUtCopyIelementToEelement ( * update the buffer length counter */ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD ( - (ACPI_SIZE) TargetObject->Package.Count * - sizeof (ACPI_OBJECT)); + (ACPI_SIZE) TargetObject->Package.Count * + sizeof (ACPI_OBJECT)); break; default: @@ -321,8 +321,8 @@ AcpiUtCopyIelementToEelement ( return (AE_BAD_PARAMETER); } - Info->FreeSpace += ObjectSpace; - Info->Length += ObjectSpace; + Info->FreeSpace += ObjectSpace; + Info->Length += ObjectSpace; return (Status); } @@ -368,28 +368,28 @@ AcpiUtCopyIpackageToEpackage ( /* * Free space begins right after the first package */ - Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD ( - sizeof (ACPI_OBJECT)); + Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + Info.FreeSpace = Buffer + + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.ObjectSpace = 0; Info.NumPackages = 1; - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, - Info.FreeSpace); + ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Package.Count = InternalObject->Package.Count; + ExternalObject->Package.Elements = + ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); /* * Leave room for an array of ACPI_OBJECTS in the buffer * and move the free space past it */ - Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + Info.Length += (ACPI_SIZE) ExternalObject->Package.Count * + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Info.FreeSpace += ExternalObject->Package.Count * - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, - AcpiUtCopyIelementToEelement, &Info); + AcpiUtCopyIelementToEelement, &Info); *SpaceUsed = Info.Length; return_ACPI_STATUS (Status); @@ -428,7 +428,7 @@ AcpiUtCopyIobjectToEobject ( * nested packages) */ Status = AcpiUtCopyIpackageToEpackage (InternalObject, - RetBuffer->Pointer, &RetBuffer->Length); + RetBuffer->Pointer, &RetBuffer->Length); } else { @@ -436,10 +436,10 @@ AcpiUtCopyIobjectToEobject ( * Build a simple object (no nested objects) */ Status = AcpiUtCopyIsimpleToEsimple (InternalObject, - ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer), - ACPI_ADD_PTR (UINT8, RetBuffer->Pointer, - ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), - &RetBuffer->Length); + ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer), + ACPI_ADD_PTR (UINT8, RetBuffer->Pointer, + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), + &RetBuffer->Length); /* * build simple does not include the object size in the length * so we add it in here @@ -489,7 +489,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_LOCAL_REFERENCE: InternalObject = AcpiUtCreateInternalObject ( - (UINT8) ExternalObject->Type); + (UINT8) ExternalObject->Type); if (!InternalObject) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -528,11 +528,11 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->String.Pointer, - ExternalObject->String.Pointer, - ExternalObject->String.Length); + memcpy (InternalObject->String.Pointer, + ExternalObject->String.Pointer, + ExternalObject->String.Length); - InternalObject->String.Length = ExternalObject->String.Length; + InternalObject->String.Length = ExternalObject->String.Length; break; case ACPI_TYPE_BUFFER: @@ -544,11 +544,11 @@ AcpiUtCopyEsimpleToIsimple ( goto ErrorExit; } - ACPI_MEMCPY (InternalObject->Buffer.Pointer, - ExternalObject->Buffer.Pointer, - ExternalObject->Buffer.Length); + memcpy (InternalObject->Buffer.Pointer, + ExternalObject->Buffer.Pointer, + ExternalObject->Buffer.Length); - InternalObject->Buffer.Length = ExternalObject->Buffer.Length; + InternalObject->Buffer.Length = ExternalObject->Buffer.Length; /* Mark buffer data valid */ @@ -557,7 +557,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_INTEGER: - InternalObject->Integer.Value = ExternalObject->Integer.Value; + InternalObject->Integer.Value = ExternalObject->Integer.Value; break; case ACPI_TYPE_LOCAL_REFERENCE: @@ -615,7 +615,8 @@ AcpiUtCopyEpackageToIpackage ( /* Create the package object */ - PackageObject = AcpiUtCreatePackageObject (ExternalObject->Package.Count); + PackageObject = AcpiUtCreatePackageObject ( + ExternalObject->Package.Count); if (!PackageObject) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -624,14 +625,14 @@ AcpiUtCopyEpackageToIpackage ( PackageElements = PackageObject->Package.Elements; /* - * Recursive implementation. Probably ok, since nested external packages - * as parameters should be very rare. + * Recursive implementation. Probably ok, since nested external + * packages as parameters should be very rare. */ for (i = 0; i < ExternalObject->Package.Count; i++) { Status = AcpiUtCopyEobjectToIobject ( - &ExternalObject->Package.Elements[i], - &PackageElements[i]); + &ExternalObject->Package.Elements[i], + &PackageElements[i]); if (ACPI_FAILURE (Status)) { /* Truncate package and delete it */ @@ -678,14 +679,16 @@ AcpiUtCopyEobjectToIobject ( if (ExternalObject->Type == ACPI_TYPE_PACKAGE) { - Status = AcpiUtCopyEpackageToIpackage (ExternalObject, InternalObject); + Status = AcpiUtCopyEpackageToIpackage ( + ExternalObject, InternalObject); } else { /* * Build a simple object (no nested objects) */ - Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject); + Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, + InternalObject); } return_ACPI_STATUS (Status); @@ -732,7 +735,7 @@ AcpiUtCopySimpleObject ( CopySize = sizeof (ACPI_NAMESPACE_NODE); } - ACPI_MEMCPY (ACPI_CAST_PTR (char, DestDesc), + memcpy (ACPI_CAST_PTR (char, DestDesc), ACPI_CAST_PTR (char, SourceDesc), CopySize); /* Restore the saved fields */ @@ -766,7 +769,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual buffer data */ - ACPI_MEMCPY (DestDesc->Buffer.Pointer, + memcpy (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer, SourceDesc->Buffer.Length); } break; @@ -788,7 +791,7 @@ AcpiUtCopySimpleObject ( /* Copy the actual string data */ - ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer, + memcpy (DestDesc->String.Pointer, SourceDesc->String.Pointer, (ACPI_SIZE) SourceDesc->String.Length + 1); } break; @@ -836,7 +839,7 @@ AcpiUtCopySimpleObject ( case ACPI_TYPE_EVENT: Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, - &DestDesc->Event.OsSemaphore); + &DestDesc->Event.OsSemaphore); if (ACPI_FAILURE (Status)) { return (Status); @@ -882,9 +885,9 @@ AcpiUtCopyIelementToIelement ( ACPI_FUNCTION_ENTRY (); - ThisIndex = State->Pkg.Index; + ThisIndex = State->Pkg.Index; ThisTargetPtr = (ACPI_OPERAND_OBJECT **) - &State->Pkg.DestObject->Package.Elements[ThisIndex]; + &State->Pkg.DestObject->Package.Elements[ThisIndex]; switch (ObjectType) { @@ -898,7 +901,7 @@ AcpiUtCopyIelementToIelement ( * This is a simple object, just copy it */ TargetObject = AcpiUtCreateInternalObject ( - SourceObject->Common.Type); + SourceObject->Common.Type); if (!TargetObject) { return (AE_NO_MEMORY); @@ -925,7 +928,8 @@ AcpiUtCopyIelementToIelement ( * This object is a package - go down another nesting level * Create and build the package object */ - TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count); + TargetObject = AcpiUtCreatePackageObject ( + SourceObject->Package.Count); if (!TargetObject) { return (AE_NO_MEMORY); @@ -982,16 +986,16 @@ AcpiUtCopyIpackageToIpackage ( ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage); - DestObj->Common.Type = SourceObj->Common.Type; - DestObj->Common.Flags = SourceObj->Common.Flags; - DestObj->Package.Count = SourceObj->Package.Count; + DestObj->Common.Type = SourceObj->Common.Type; + DestObj->Common.Flags = SourceObj->Common.Flags; + DestObj->Package.Count = SourceObj->Package.Count; /* * Create the object array and walk the source package tree */ DestObj->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) SourceObj->Package.Count + 1) * - sizeof (void *)); + ((ACPI_SIZE) SourceObj->Package.Count + 1) * + sizeof (void *)); if (!DestObj->Package.Elements) { ACPI_ERROR ((AE_INFO, "Package allocation failure")); @@ -1003,7 +1007,7 @@ AcpiUtCopyIpackageToIpackage ( * This handles nested packages of arbitrary depth. */ Status = AcpiUtWalkPackageTree (SourceObj, DestObj, - AcpiUtCopyIelementToIelement, WalkState); + AcpiUtCopyIelementToIelement, WalkState); if (ACPI_FAILURE (Status)) { /* On failure, delete the destination package object */ @@ -1053,8 +1057,8 @@ AcpiUtCopyIobjectToIobject ( if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) { - Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc, - WalkState); + Status = AcpiUtCopyIpackageToIpackage ( + SourceDesc, *DestDesc, WalkState); } else { @@ -1065,7 +1069,7 @@ AcpiUtCopyIobjectToIobject ( if (ACPI_FAILURE (Status)) { - AcpiUtRemoveReference(*DestDesc); + AcpiUtRemoveReference (*DestDesc); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/components/utilities/utdebug.c b/sys/contrib/dev/acpica/components/utilities/utdebug.c index 544450d..7e03b22 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acinterp.h> #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdebug") @@ -52,15 +53,9 @@ #ifdef ACPI_DEBUG_OUTPUT -static ACPI_THREAD_ID AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; -static char *AcpiGbl_FnEntryStr = "----Entry"; -static char *AcpiGbl_FnExitStr = "----Exit-"; - -/* Local prototypes */ - -static const char * -AcpiUtTrimFunctionName ( - const char *FunctionName); +static ACPI_THREAD_ID AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; +static const char *AcpiGbl_FunctionEntryPrefix = "----Entry"; +static const char *AcpiGbl_FunctionExitPrefix = "----Exit-"; /******************************************************************************* @@ -200,16 +195,16 @@ AcpiDebugPrint ( * Thread tracking and context switch notification */ ThreadId = AcpiOsGetThreadId (); - if (ThreadId != AcpiGbl_PrevThreadId) + if (ThreadId != AcpiGbl_PreviousThreadId) { if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ( "\n**** Context Switch from TID %u to TID %u ****\n\n", - (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId); + (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId); } - AcpiGbl_PrevThreadId = ThreadId; + AcpiGbl_PreviousThreadId = ThreadId; AcpiGbl_NestingLevel = 0; } @@ -324,7 +319,7 @@ AcpiUtTrace ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s\n", AcpiGbl_FnEntryStr); + "%s\n", AcpiGbl_FunctionEntryPrefix); } } @@ -354,7 +349,7 @@ AcpiUtTracePtr ( const char *FunctionName, const char *ModuleName, UINT32 ComponentId, - void *Pointer) + const void *Pointer) { AcpiGbl_NestingLevel++; @@ -366,7 +361,7 @@ AcpiUtTracePtr ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %p\n", AcpiGbl_FnEntryStr, Pointer); + "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer); } } @@ -394,7 +389,7 @@ AcpiUtTraceStr ( const char *FunctionName, const char *ModuleName, UINT32 ComponentId, - char *String) + const char *String) { AcpiGbl_NestingLevel++; @@ -406,7 +401,7 @@ AcpiUtTraceStr ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %s\n", AcpiGbl_FnEntryStr, String); + "%s %s\n", AcpiGbl_FunctionEntryPrefix, String); } } @@ -446,7 +441,7 @@ AcpiUtTraceU32 ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %08X\n", AcpiGbl_FnEntryStr, Integer); + "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer); } } @@ -481,7 +476,7 @@ AcpiUtExit ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s\n", AcpiGbl_FnExitStr); + "%s\n", AcpiGbl_FunctionExitPrefix); } if (AcpiGbl_NestingLevel) @@ -527,14 +522,14 @@ AcpiUtStatusExit ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %s\n", AcpiGbl_FnExitStr, + "%s %s\n", AcpiGbl_FunctionExitPrefix, AcpiFormatException (Status)); } else { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, + "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix, AcpiFormatException (Status)); } } @@ -580,7 +575,7 @@ AcpiUtValueExit ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, + "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix, ACPI_FORMAT_UINT64 (Value)); } @@ -625,7 +620,49 @@ AcpiUtPtrExit ( { AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, - "%s %p\n", AcpiGbl_FnExitStr, Ptr); + "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr); + } + + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrExit + * + * PARAMETERS: LineNumber - Caller's line number + * FunctionName - Caller's procedure name + * ModuleName - Caller's module name + * ComponentId - Caller's component ID + * String - String to display + * + * RETURN: None + * + * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is + * set in DebugLevel. Prints exit value also. + * + ******************************************************************************/ + +void +AcpiUtStrExit ( + UINT32 LineNumber, + const char *FunctionName, + const char *ModuleName, + UINT32 ComponentId, + const char *String) +{ + + /* Check if enabled up-front for performance */ + + if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) + { + AcpiDebugPrint (ACPI_LV_FUNCTIONS, + LineNumber, FunctionName, ModuleName, ComponentId, + "%s %s\n", AcpiGbl_FunctionExitPrefix, String); } if (AcpiGbl_NestingLevel) @@ -634,6 +671,42 @@ AcpiUtPtrExit ( } } + +/******************************************************************************* + * + * FUNCTION: AcpiTracePoint + * + * PARAMETERS: Type - Trace event type + * Begin - TRUE if before execution + * Aml - Executed AML address + * Pathname - Object path + * Pointer - Pointer to the related object + * + * RETURN: None + * + * DESCRIPTION: Interpreter execution trace. + * + ******************************************************************************/ + +void +AcpiTracePoint ( + ACPI_TRACE_EVENT_TYPE Type, + BOOLEAN Begin, + UINT8 *Aml, + char *Pathname) +{ + + ACPI_FUNCTION_ENTRY (); + + AcpiExTracePoint (Type, Begin, Aml, Pathname); + +#ifdef ACPI_USE_SYSTEM_TRACER + AcpiOsTracePoint (Type, Begin, Aml, Pathname); +#endif +} + +ACPI_EXPORT_SYMBOL (AcpiTracePoint) + #endif diff --git a/sys/contrib/dev/acpica/components/utilities/utdecode.c b/sys/contrib/dev/acpica/components/utilities/utdecode.c index c1887ee..8f8f06e 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdecode.c +++ b/sys/contrib/dev/acpica/components/utilities/utdecode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,7 +119,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = }; -char * +const char * AcpiUtGetRegionName ( UINT8 SpaceId) { @@ -141,7 +141,7 @@ AcpiUtGetRegionName ( return ("InvalidSpaceId"); } - return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); + return (AcpiGbl_RegionTypes[SpaceId]); } @@ -169,7 +169,7 @@ static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = }; -char * +const char * AcpiUtGetEventName ( UINT32 EventId) { @@ -179,7 +179,7 @@ AcpiUtGetEventName ( return ("InvalidEventID"); } - return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); + return (AcpiGbl_EventTypes[EventId]); } @@ -201,7 +201,8 @@ AcpiUtGetEventName ( * * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this entry. + * evidence to indicate what type is actually going to be stored for this + & entry. */ static const char AcpiGbl_BadType[] = "UNDEFINED"; @@ -243,31 +244,47 @@ static const char *AcpiGbl_NsTypeNames[] = }; -char * +const char * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type) { if (Type > ACPI_TYPE_INVALID) { - return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); + return (AcpiGbl_BadType); } - return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); + return (AcpiGbl_NsTypeNames[Type]); } -char * +const char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc) { + ACPI_FUNCTION_TRACE (UtGetObjectTypeName); + if (!ObjDesc) { - return ("[NULL Object Descriptor]"); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); + return_PTR ("[NULL Object Descriptor]"); + } + + /* These descriptor types share a common area */ + + if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_NAMED)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n", + ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), + AcpiUtGetDescriptorName (ObjDesc), ObjDesc)); + + return_PTR ("Invalid object"); } - return (AcpiUtGetTypeName (ObjDesc->Common.Type)); + return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type)); } @@ -283,7 +300,7 @@ AcpiUtGetObjectTypeName ( * ******************************************************************************/ -char * +const char * AcpiUtGetNodeName ( void *Object) { @@ -359,7 +376,7 @@ static const char *AcpiGbl_DescTypeNames[] = }; -char * +const char * AcpiUtGetDescriptorName ( void *Object) { @@ -374,9 +391,7 @@ AcpiUtGetDescriptorName ( return ("Not a Descriptor"); } - return (ACPI_CAST_PTR (char, - AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); - + return (AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]); } @@ -453,7 +468,7 @@ AcpiUtGetReferenceName ( /* Names for internal mutex objects, used for debug output */ -static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = +static const char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = { "ACPI_MTX_Interpreter", "ACPI_MTX_Namespace", @@ -461,11 +476,9 @@ static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = "ACPI_MTX_Events", "ACPI_MTX_Caches", "ACPI_MTX_Memory", - "ACPI_MTX_CommandComplete", - "ACPI_MTX_CommandReady" }; -char * +const char * AcpiUtGetMutexName ( UINT32 MutexId) { @@ -493,7 +506,7 @@ AcpiUtGetMutexName ( /* Names for Notify() values, used for debug output */ -static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = +static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] = { /* 00 */ "Bus Check", /* 01 */ "Device Check", @@ -507,32 +520,35 @@ static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request", + /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */ /* 0D */ "System Resource Affinity Update" }; -static const char *AcpiGbl_DeviceNotify[4] = +static const char *AcpiGbl_DeviceNotify[5] = { /* 80 */ "Status Change", /* 81 */ "Information Change", /* 82 */ "Device-Specific Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Device-Specific Change", + /* 84 */ "Reserved" }; -static const char *AcpiGbl_ProcessorNotify[4] = +static const char *AcpiGbl_ProcessorNotify[5] = { /* 80 */ "Performance Capability Change", /* 81 */ "C-State Change", /* 82 */ "Throttling Capability Change", - /* 83 */ "Device-Specific Change" + /* 83 */ "Guaranteed Change", + /* 84 */ "Minimum Excursion" }; -static const char *AcpiGbl_ThermalNotify[4] = +static const char *AcpiGbl_ThermalNotify[5] = { /* 80 */ "Thermal Status Change", /* 81 */ "Thermal Trip Point Change", /* 82 */ "Thermal Device List Change", - /* 83 */ "Thermal Relationship Change" + /* 83 */ "Thermal Relationship Change", + /* 84 */ "Reserved" }; @@ -542,23 +558,23 @@ AcpiUtGetNotifyName ( ACPI_OBJECT_TYPE Type) { - /* 00 - 0D are common to all object types */ + /* 00 - 0D are "common to all object types" (from ACPI Spec) */ - if (NotifyValue <= ACPI_NOTIFY_MAX) + if (NotifyValue <= ACPI_GENERIC_NOTIFY_MAX) { return (AcpiGbl_GenericNotify[NotifyValue]); } - /* 0D - 7F are reserved */ + /* 0E - 7F are reserved */ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { return ("Reserved"); } - /* 80 - 83 are per-object-type */ + /* 80 - 84 are per-object-type */ - if (NotifyValue <= 0x83) + if (NotifyValue <= ACPI_SPECIFIC_NOTIFY_MAX) { switch (Type) { diff --git a/sys/contrib/dev/acpica/components/utilities/utdelete.c b/sys/contrib/dev/acpica/components/utilities/utdelete.c index bc9ab70..49d6cdd 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/components/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -220,6 +220,11 @@ AcpiUtDeleteInternalObj ( AcpiUtDeleteObjectDesc (Object->Method.Mutex); Object->Method.Mutex = NULL; } + + if (Object->Method.Node) + { + Object->Method.Node = NULL; + } break; case ACPI_TYPE_REGION: @@ -549,8 +554,8 @@ AcpiUtUpdateObjectReference ( } /* - * All sub-objects must have their reference count incremented also. - * Different object types have different subobjects. + * All sub-objects must have their reference count incremented + * also. Different object types have different subobjects. */ switch (Object->Common.Type) { @@ -610,7 +615,7 @@ AcpiUtUpdateObjectReference ( * for later processing (this eliminates recursion.) */ Status = AcpiUtCreateUpdateStateAndPush ( - NextObject, Action, &StateList); + NextObject, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -635,7 +640,7 @@ AcpiUtUpdateObjectReference ( NextObject = Object->BankField.BankObj; Status = AcpiUtCreateUpdateStateAndPush ( - Object->BankField.RegionObj, Action, &StateList); + Object->BankField.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -646,7 +651,7 @@ AcpiUtUpdateObjectReference ( NextObject = Object->IndexField.IndexObj; Status = AcpiUtCreateUpdateStateAndPush ( - Object->IndexField.DataObj, Action, &StateList); + Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; diff --git a/sys/contrib/dev/acpica/components/utilities/uterror.c b/sys/contrib/dev/acpica/components/utilities/uterror.c index 35e9ce6..bc4193f 100644 --- a/sys/contrib/dev/acpica/components/utilities/uterror.c +++ b/sys/contrib/dev/acpica/components/utilities/uterror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -244,8 +244,8 @@ AcpiUtNamespaceError ( { /* Convert path to external format */ - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, - InternalName, NULL, &Name); + Status = AcpiNsExternalizeName ( + ACPI_UINT32_MAX, InternalName, NULL, &Name); /* Print target name */ @@ -307,8 +307,8 @@ AcpiUtMethodError ( if (Path) { - Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, - &Node); + Status = AcpiNsGetNode (PrefixNode, Path, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("[Could not get node by pathname]"); diff --git a/sys/contrib/dev/acpica/components/utilities/uteval.c b/sys/contrib/dev/acpica/components/utilities/uteval.c index b9d63b4..8fb6929 100644 --- a/sys/contrib/dev/acpica/components/utilities/uteval.c +++ b/sys/contrib/dev/acpica/components/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,7 +72,7 @@ ACPI_STATUS AcpiUtEvaluateObject ( ACPI_NAMESPACE_NODE *PrefixNode, - char *Path, + const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc) { @@ -219,7 +219,7 @@ Cleanup: ACPI_STATUS AcpiUtEvaluateNumericObject ( - char *ObjectName, + const char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, UINT64 *Value) { @@ -231,7 +231,7 @@ AcpiUtEvaluateNumericObject ( Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -278,7 +278,7 @@ AcpiUtExecute_STA ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_FAILURE (Status)) { if (AE_NOT_FOUND == Status) @@ -351,8 +351,8 @@ AcpiUtExecutePowerMethods ( * return type is an Integer. */ Status = AcpiUtEvaluateObject (DeviceNode, - ACPI_CAST_PTR (char, MethodNames[i]), - ACPI_BTYPE_INTEGER, &ObjDesc); + ACPI_CAST_PTR (char, MethodNames[i]), + ACPI_BTYPE_INTEGER, &ObjDesc); if (ACPI_SUCCESS (Status)) { OutValues[i] = (UINT8) ObjDesc->Integer.Value; diff --git a/sys/contrib/dev/acpica/components/utilities/utexcep.c b/sys/contrib/dev/acpica/components/utilities/utexcep.c index 2a38cff..d2ee5bb 100644 --- a/sys/contrib/dev/acpica/components/utilities/utexcep.c +++ b/sys/contrib/dev/acpica/components/utilities/utexcep.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/utilities/utfileio.c b/sys/contrib/dev/acpica/components/utilities/utfileio.c deleted file mode 100644 index 15cb3d0..0000000 --- a/sys/contrib/dev/acpica/components/utilities/utfileio.c +++ /dev/null @@ -1,358 +0,0 @@ -/******************************************************************************* - * - * Module Name: utfileio - simple file I/O routines - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2015, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include <contrib/dev/acpica/include/acpi.h> -#include <contrib/dev/acpica/include/accommon.h> -#include <contrib/dev/acpica/include/actables.h> -#include <contrib/dev/acpica/include/acapps.h> - -#ifdef ACPI_ASL_COMPILER -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#endif - - -#define _COMPONENT ACPI_CA_DEBUGGER - ACPI_MODULE_NAME ("utfileio") - - -#ifdef ACPI_APPLICATION - -/* Local prototypes */ - -static ACPI_STATUS -AcpiUtCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength); - -static ACPI_STATUS -AcpiUtReadTable ( - FILE *fp, - ACPI_TABLE_HEADER **Table, - UINT32 *TableLength); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCheckTextModeCorruption - * - * PARAMETERS: Table - Table buffer - * TableLength - Length of table from the table header - * FileLength - Length of the file that contains the table - * - * RETURN: Status - * - * DESCRIPTION: Check table for text mode file corruption where all linefeed - * characters (LF) have been replaced by carriage return linefeed - * pairs (CR/LF). - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtCheckTextModeCorruption ( - UINT8 *Table, - UINT32 TableLength, - UINT32 FileLength) -{ - UINT32 i; - UINT32 Pairs = 0; - - - if (TableLength != FileLength) - { - ACPI_WARNING ((AE_INFO, - "File length (0x%X) is not the same as the table length (0x%X)", - FileLength, TableLength)); - } - - /* Scan entire table to determine if each LF has been prefixed with a CR */ - - for (i = 1; i < FileLength; i++) - { - if (Table[i] == 0x0A) - { - if (Table[i - 1] != 0x0D) - { - /* The LF does not have a preceding CR, table not corrupted */ - - return (AE_OK); - } - else - { - /* Found a CR/LF pair */ - - Pairs++; - } - i++; - } - } - - if (!Pairs) - { - return (AE_OK); - } - - /* - * Entire table scanned, each CR is part of a CR/LF pair -- - * meaning that the table was treated as a text file somewhere. - * - * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the - * original table are left untouched by the text conversion process -- - * meaning that we cannot simply replace CR/LF pairs with LFs. - */ - AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); - AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs); - AcpiOsPrintf ("Table cannot be repaired!\n"); - return (AE_BAD_VALUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReadTable - * - * PARAMETERS: fp - File that contains table - * Table - Return value, buffer with table - * TableLength - Return value, length of table - * - * RETURN: Status - * - * DESCRIPTION: Load the DSDT from the file pointer - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtReadTable ( - FILE *fp, - ACPI_TABLE_HEADER **Table, - UINT32 *TableLength) -{ - ACPI_TABLE_HEADER TableHeader; - UINT32 Actual; - ACPI_STATUS Status; - UINT32 FileSize; - BOOLEAN StandardHeader = TRUE; - INT32 Count; - - /* Get the file size */ - - FileSize = CmGetFileSize (fp); - if (FileSize == ACPI_UINT32_MAX) - { - return (AE_ERROR); - } - - if (FileSize < 4) - { - return (AE_BAD_HEADER); - } - - /* Read the signature */ - - fseek (fp, 0, SEEK_SET); - - Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp); - if (Count != sizeof (ACPI_TABLE_HEADER)) - { - AcpiOsPrintf ("Could not read the table header\n"); - return (AE_BAD_HEADER); - } - - /* The RSDP table does not have standard ACPI header */ - - if (ACPI_VALIDATE_RSDP_SIG (TableHeader.Signature)) - { - *TableLength = FileSize; - StandardHeader = FALSE; - } - else - { - -#if 0 - /* Validate the table header/length */ - - Status = AcpiTbValidateTableHeader (&TableHeader); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Table header is invalid!\n"); - return (Status); - } -#endif - - /* File size must be at least as long as the Header-specified length */ - - if (TableHeader.Length > FileSize) - { - AcpiOsPrintf ( - "TableHeader length [0x%X] greater than the input file size [0x%X]\n", - TableHeader.Length, FileSize); - -#ifdef ACPI_ASL_COMPILER - AcpiOsPrintf ("File is corrupt or is ASCII text -- " - "it must be a binary file\n"); -#endif - return (AE_BAD_HEADER); - } - -#ifdef ACPI_OBSOLETE_CODE - /* We only support a limited number of table types */ - - if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && - !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && - !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) - { - AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", - (char *) TableHeader.Signature); - ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); - return (AE_ERROR); - } -#endif - - *TableLength = TableHeader.Length; - } - - /* Allocate a buffer for the table */ - - *Table = AcpiOsAllocate ((size_t) FileSize); - if (!*Table) - { - AcpiOsPrintf ( - "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", - TableHeader.Signature, *TableLength); - return (AE_NO_MEMORY); - } - - /* Get the rest of the table */ - - fseek (fp, 0, SEEK_SET); - Actual = fread (*Table, 1, (size_t) FileSize, fp); - if (Actual == FileSize) - { - if (StandardHeader) - { - /* Now validate the checksum */ - - Status = AcpiTbVerifyChecksum ((void *) *Table, - ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); - - if (Status == AE_BAD_CHECKSUM) - { - Status = AcpiUtCheckTextModeCorruption ((UINT8 *) *Table, - FileSize, (*Table)->Length); - return (Status); - } - } - return (AE_OK); - } - - if (Actual > 0) - { - AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", - FileSize, Actual); - return (AE_OK); - } - - AcpiOsPrintf ("Error - could not read the table file\n"); - AcpiOsFree (*Table); - *Table = NULL; - *TableLength = 0; - return (AE_ERROR); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtReadTableFromFile - * - * PARAMETERS: Filename - File where table is located - * Table - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Get an ACPI table from a file - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table) -{ - FILE *File; - UINT32 FileSize; - UINT32 TableLength; - ACPI_STATUS Status = AE_ERROR; - - - /* Open the file, get current size */ - - File = fopen (Filename, "rb"); - if (!File) - { - perror ("Could not open input file"); - return (Status); - } - - FileSize = CmGetFileSize (File); - if (FileSize == ACPI_UINT32_MAX) - { - goto Exit; - } - - /* Get the entire file */ - - fprintf (stderr, "Reading ACPI table from file %10s - Length %.8u (0x%06X)\n", - Filename, FileSize, FileSize); - - Status = AcpiUtReadTable (File, Table, &TableLength); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get table from the file\n"); - } - -Exit: - fclose(File); - return (Status); -} - -#endif diff --git a/sys/contrib/dev/acpica/components/utilities/utglobal.c b/sys/contrib/dev/acpica/components/utilities/utglobal.c index e027aa1..759780a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/components/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,6 +87,12 @@ const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = }; +/* Hex-to-ascii */ + +const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; +const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; + + /******************************************************************************* * * Namespace globals @@ -179,6 +185,55 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = }; #endif /* !ACPI_REDUCED_HARDWARE */ + +#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) + +/* ToPld macro: compile/disassemble strings */ + +const char *AcpiGbl_PldPanelList[] = +{ + "TOP", + "BOTTOM", + "LEFT", + "RIGHT", + "FRONT", + "BACK", + "UNKNOWN", + NULL +}; + +const char *AcpiGbl_PldVerticalPositionList[] = +{ + "UPPER", + "CENTER", + "LOWER", + NULL +}; + +const char *AcpiGbl_PldHorizontalPositionList[] = +{ + "LEFT", + "CENTER", + "RIGHT", + NULL +}; + +const char *AcpiGbl_PldShapeList[] = +{ + "ROUND", + "OVAL", + "SQUARE", + "VERTICALRECTANGLE", + "HORIZONTALRECTANGLE", + "VERTICALTRAPEZOID", + "HORIZONTALTRAPEZOID", + "UNKNOWN", + "CHAMFERED", + NULL +}; +#endif + + /* Public globals */ ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) diff --git a/sys/contrib/dev/acpica/components/utilities/uthex.c b/sys/contrib/dev/acpica/components/utilities/uthex.c index 7eede9d..2bae5c7 100644 --- a/sys/contrib/dev/acpica/components/utilities/uthex.c +++ b/sys/contrib/dev/acpica/components/utilities/uthex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,7 +50,7 @@ /* Hex to ASCII conversion table */ -static char AcpiGbl_HexToAscii[] = +static const char AcpiGbl_HexToAscii[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; diff --git a/sys/contrib/dev/acpica/components/utilities/utids.c b/sys/contrib/dev/acpica/components/utilities/utids.c index 7d31429..4c8a8be 100644 --- a/sys/contrib/dev/acpica/components/utilities/utids.c +++ b/sys/contrib/dev/acpica/components/utilities/utids.c @@ -1,11 +1,11 @@ /****************************************************************************** * - * Module Name: utids - support for device IDs - HID, UID, CID + * Module Name: utids - support for device IDs - HID, UID, CID, SUB, CLS * *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,7 +83,7 @@ AcpiUtExecute_HID ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -102,7 +102,8 @@ AcpiUtExecute_HID ( /* Allocate a buffer for the HID */ - Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + Hid = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Hid) { Status = AE_NO_MEMORY; @@ -121,7 +122,7 @@ AcpiUtExecute_HID ( } else { - ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); + strcpy (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -139,77 +140,6 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiUtExecute_SUB - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnId - Where the _SUB is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _SUB control method that returns the subsystem - * ID of the device. The _SUB value is always a string containing - * either a valid PNP or ACPI ID. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_SUB ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_PNP_DEVICE_ID **ReturnId) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PNP_DEVICE_ID *Sub; - UINT32 Length; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_SUB); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__SUB, - ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - Length = ObjDesc->String.Length + 1; - - /* Allocate a buffer for the SUB */ - - Sub = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); - if (!Sub) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - Sub->String = ACPI_ADD_PTR (char, Sub, sizeof (ACPI_PNP_DEVICE_ID)); - - /* Simply copy existing string */ - - ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer); - Sub->Length = Length; - *ReturnId = Sub; - - -Cleanup: - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtExecute_UID * * PARAMETERS: DeviceNode - Node for the device @@ -241,7 +171,7 @@ AcpiUtExecute_UID ( Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -260,7 +190,8 @@ AcpiUtExecute_UID ( /* Allocate a buffer for the UID */ - Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + Uid = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Uid) { Status = AE_NO_MEMORY; @@ -279,7 +210,7 @@ AcpiUtExecute_UID ( } else { - ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); + strcpy (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -341,8 +272,8 @@ AcpiUtExecute_CID ( /* Evaluate the _CID method for this device */ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &ObjDesc); + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, + &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -419,14 +350,15 @@ AcpiUtExecute_CID ( { /* Convert the Integer (EISAID) CID to a string */ - AcpiExEisaIdToString (NextIdString, CidObjects[i]->Integer.Value); + AcpiExEisaIdToString ( + NextIdString, CidObjects[i]->Integer.Value); Length = ACPI_EISAID_STRING_SIZE; } else /* ACPI_TYPE_STRING */ { /* Copy the String CID from the returned object */ - ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); + strcpy (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } @@ -449,3 +381,98 @@ Cleanup: AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CLS + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the _CLS is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined + * class code of the device. The _CLS value is always a package + * containing PCI class information as a list of integers. + * The returned string has format "BBSSPP", where: + * BB = Base-class code + * SS = Sub-class code + * PP = Programming Interface code + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CLS ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **ClsObjects; + UINT32 Count; + ACPI_PNP_DEVICE_ID *Cls; + UINT32 Length; + ACPI_STATUS Status; + UINT8 ClassCode[3] = {0, 0, 0}; + + + ACPI_FUNCTION_TRACE (UtExecute_CLS); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CLS, + ACPI_BTYPE_PACKAGE, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + Length = ACPI_PCICLS_STRING_SIZE; + ClsObjects = ObjDesc->Package.Elements; + Count = ObjDesc->Package.Count; + + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + if (Count > 0 && ClsObjects[0]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[0] = (UINT8) ClsObjects[0]->Integer.Value; + } + if (Count > 1 && ClsObjects[1]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[1] = (UINT8) ClsObjects[1]->Integer.Value; + } + if (Count > 2 && ClsObjects[2]->Common.Type == ACPI_TYPE_INTEGER) + { + ClassCode[2] = (UINT8) ClsObjects[2]->Integer.Value; + } + } + + /* Allocate a buffer for the CLS */ + + Cls = ACPI_ALLOCATE_ZEROED ( + sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Cls) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after PNP_DEVICE_ID struct */ + + Cls->String = ACPI_ADD_PTR (char, Cls, sizeof (ACPI_PNP_DEVICE_ID)); + + /* Simply copy existing string */ + + AcpiExPciClsToString (Cls->String, ClassCode); + Cls->Length = Length; + *ReturnId = Cls; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c index fd7fba2..a33c4bc 100644 --- a/sys/contrib/dev/acpica/components/utilities/utinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -224,11 +224,9 @@ AcpiUtInitGlobals ( AcpiGbl_AcpiHardwarePresent = TRUE; AcpiGbl_LastOwnerIdIndex = 0; AcpiGbl_NextOwnerIdOffset = 0; - AcpiGbl_TraceDbgLevel = 0; - AcpiGbl_TraceDbgLayer = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_OsiMutex = NULL; - AcpiGbl_RegMethodsExecuted = FALSE; + AcpiGbl_MaxLoopIterations = 0xFFFF; /* Hardware oriented */ @@ -263,8 +261,6 @@ AcpiUtInitGlobals ( AcpiGbl_DisableMemTracking = FALSE; #endif - ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE); - return_ACPI_STATUS (AE_OK); } @@ -313,6 +309,20 @@ AcpiUtSubsystemShutdown ( ACPI_FUNCTION_TRACE (UtSubsystemShutdown); + /* Just exit if subsystem is already shutdown */ + + if (AcpiGbl_Shutdown) + { + ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); + return_VOID; + } + + /* Subsystem appears active, go ahead and shut it down */ + + AcpiGbl_Shutdown = TRUE; + AcpiGbl_StartupFlags = 0; + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); + #ifndef ACPI_ASL_COMPILER /* Close the AcpiEvent Handling */ diff --git a/sys/contrib/dev/acpica/components/utilities/utlock.c b/sys/contrib/dev/acpica/components/utilities/utlock.c index 3903e99..39d1808 100644 --- a/sys/contrib/dev/acpica/components/utilities/utlock.c +++ b/sys/contrib/dev/acpica/components/utilities/utlock.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/contrib/dev/acpica/components/utilities/utmath.c b/sys/contrib/dev/acpica/components/utilities/utmath.c index ce11f39..788e330 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmath.c +++ b/sys/contrib/dev/acpica/components/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,9 +122,10 @@ AcpiUtShortDivide ( * and is generated by the second divide. */ ACPI_DIV_64_BY_32 (0, DividendOvl.Part.Hi, Divisor, - Quotient.Part.Hi, Remainder32); + Quotient.Part.Hi, Remainder32); + ACPI_DIV_64_BY_32 (Remainder32, DividendOvl.Part.Lo, Divisor, - Quotient.Part.Lo, Remainder32); + Quotient.Part.Lo, Remainder32); /* Return only what was requested */ @@ -200,9 +201,10 @@ AcpiUtDivide ( * and is generated by the second divide. */ ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo, - Quotient.Part.Hi, Partial1); + Quotient.Part.Hi, Partial1); + ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo, - Quotient.Part.Lo, Remainder.Part.Lo); + Quotient.Part.Lo, Remainder.Part.Lo); } else @@ -219,25 +221,24 @@ AcpiUtDivide ( do { - ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi, - NormalizedDivisor.Part.Lo); - ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi, - NormalizedDividend.Part.Lo); + ACPI_SHIFT_RIGHT_64 ( + NormalizedDivisor.Part.Hi, NormalizedDivisor.Part.Lo); + ACPI_SHIFT_RIGHT_64 ( + NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo); } while (NormalizedDivisor.Part.Hi != 0); /* Partial divide */ - ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi, - NormalizedDividend.Part.Lo, - NormalizedDivisor.Part.Lo, - Quotient.Part.Lo, Partial1); + ACPI_DIV_64_BY_32 ( + NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo, + NormalizedDivisor.Part.Lo, Quotient.Part.Lo, Partial1); /* - * The quotient is always 32 bits, and simply requires adjustment. - * The 64-bit remainder must be generated. + * The quotient is always 32 bits, and simply requires + * adjustment. The 64-bit remainder must be generated. */ - Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; + Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; Partial2.Full = (UINT64) Quotient.Part.Lo * Divisor.Part.Lo; Partial3.Full = (UINT64) Partial2.Part.Hi + Partial1; @@ -263,7 +264,7 @@ AcpiUtDivide ( } } - Remainder.Full = Remainder.Full - Dividend.Full; + Remainder.Full = Remainder.Full - Dividend.Full; Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi); Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo); diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c index f3d2222..13d920f 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/components/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,11 +71,11 @@ AcpiUtIsPciRootBridge ( * Check if this is a PCI root bridge. * ACPI 3.0+: check for a PCI Express root also. */ - if (!(ACPI_STRCMP (Id, - PCI_ROOT_HID_STRING)) || + if (!(strcmp (Id, + PCI_ROOT_HID_STRING)) || - !(ACPI_STRCMP (Id, - PCI_EXPRESS_ROOT_HID_STRING))) + !(strcmp (Id, + PCI_EXPRESS_ROOT_HID_STRING))) { return (TRUE); } @@ -84,7 +84,7 @@ AcpiUtIsPciRootBridge ( } -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP) +#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) /******************************************************************************* * * FUNCTION: AcpiUtIsAmlTable @@ -108,7 +108,8 @@ AcpiUtIsAmlTable ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) || ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) || - ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT)) + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) || + ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_OSDT)) { return (TRUE); } @@ -184,17 +185,17 @@ AcpiUtSetIntegerWidth ( { /* 32-bit case */ - AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerBitWidth = 32; AcpiGbl_IntegerNybbleWidth = 8; - AcpiGbl_IntegerByteWidth = 4; + AcpiGbl_IntegerByteWidth = 4; } else { /* 64-bit case (ACPI 2.0+) */ - AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerBitWidth = 64; AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; + AcpiGbl_IntegerByteWidth = 8; } } @@ -285,9 +286,9 @@ AcpiUtWalkPackageTree ( { /* Get one element of the package */ - ThisIndex = State->Pkg.Index; + ThisIndex = State->Pkg.Index; ThisSourceObj = (ACPI_OPERAND_OBJECT *) - State->Pkg.SourceObject->Package.Elements[ThisIndex]; + State->Pkg.SourceObject->Package.Elements[ThisIndex]; /* * Check for: @@ -298,7 +299,8 @@ AcpiUtWalkPackageTree ( * case below. */ if ((!ThisSourceObj) || - (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != + ACPI_DESC_TYPE_OPERAND) || (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) { Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, @@ -309,7 +311,8 @@ AcpiUtWalkPackageTree ( } State->Pkg.Index++; - while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) + while (State->Pkg.Index >= + State->Pkg.SourceObject->Package.Count) { /* * We've handled all of the objects at this level, This means @@ -344,8 +347,8 @@ AcpiUtWalkPackageTree ( { /* This is a subobject of type package */ - Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, - State, Context); + Status = WalkCallback ( + ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, State, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -356,8 +359,8 @@ AcpiUtWalkPackageTree ( * The callback above returned a new target package object. */ AcpiUtPushGenericState (&StateList, State); - State = AcpiUtCreatePkgState (ThisSourceObj, - State->Pkg.ThisTargetObj, 0); + State = AcpiUtCreatePkgState ( + ThisSourceObj, State->Pkg.ThisTargetObj, 0); if (!State) { /* Free any stacked Update State objects */ @@ -398,7 +401,7 @@ void AcpiUtDisplayInitPathname ( UINT8 Type, ACPI_NAMESPACE_NODE *ObjHandle, - char *Path) + const char *Path) { ACPI_STATUS Status; ACPI_BUFFER Buffer; @@ -417,7 +420,7 @@ AcpiUtDisplayInitPathname ( /* Get the full pathname to the node */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); if (ACPI_FAILURE (Status)) { return; diff --git a/sys/contrib/dev/acpica/components/utilities/utmutex.c b/sys/contrib/dev/acpica/components/utilities/utmutex.c index c7b162b..7f25642 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/components/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,6 +124,24 @@ AcpiUtMutexInitialize ( /* Create the reader/writer lock for namespace access */ Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + +#ifdef ACPI_DEBUGGER + + /* Debugger Support */ + + Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete); +#endif + return_ACPI_STATUS (Status); } @@ -169,6 +187,12 @@ AcpiUtMutexTerminate ( /* Delete the reader/writer lock */ AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock); + +#ifdef ACPI_DEBUGGER + AcpiOsDeleteMutex (AcpiGbl_DbCommandReady); + AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete); +#endif + return_VOID; } @@ -305,11 +329,12 @@ AcpiUtAcquireMutex ( "Thread %u attempting to acquire Mutex [%s]\n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); - Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex, - ACPI_WAIT_FOREVER); + Status = AcpiOsAcquireMutex ( + AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, + "Thread %u acquired Mutex [%s]\n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); AcpiGbl_MutexInfo[MutexId].UseCount++; diff --git a/sys/contrib/dev/acpica/components/utilities/utnonansi.c b/sys/contrib/dev/acpica/components/utilities/utnonansi.c new file mode 100644 index 0000000..ca6bc7a --- /dev/null +++ b/sys/contrib/dev/acpica/components/utilities/utnonansi.c @@ -0,0 +1,667 @@ +/******************************************************************************* + * + * Module Name: utnonansi - Non-ansi C library functions + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utnonansi") + + +/* + * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit + * version of strtoul. + */ + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrlwr (strlwr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert a string to lowercase + * + ******************************************************************************/ + +void +AcpiUtStrlwr ( + char *SrcString) +{ + char *String; + + + ACPI_FUNCTION_ENTRY (); + + + if (!SrcString) + { + return; + } + + /* Walk entire string, lowercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) tolower ((int) *String); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrupr (strupr) + * + * PARAMETERS: SrcString - The source string to convert + * + * RETURN: None + * + * DESCRIPTION: Convert a string to uppercase + * + ******************************************************************************/ + +void +AcpiUtStrupr ( + char *SrcString) +{ + char *String; + + + ACPI_FUNCTION_ENTRY (); + + + if (!SrcString) + { + return; + } + + /* Walk entire string, uppercasing the letters */ + + for (String = SrcString; *String; String++) + { + *String = (char) toupper ((int) *String); + } +} + + +/****************************************************************************** + * + * FUNCTION: AcpiUtStricmp (stricmp) + * + * PARAMETERS: String1 - first string to compare + * String2 - second string to compare + * + * RETURN: int that signifies string relationship. Zero means strings + * are equal. + * + * DESCRIPTION: Case-insensitive string compare. Implementation of the + * non-ANSI stricmp function. + * + ******************************************************************************/ + +int +AcpiUtStricmp ( + char *String1, + char *String2) +{ + int c1; + int c2; + + + do + { + c1 = tolower ((int) *String1); + c2 = tolower ((int) *String2); + + String1++; + String2++; + } + while ((c1 == c2) && (c1)); + + return (c1 - c2); +} + + +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +/******************************************************************************* + * + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * + * PARAMETERS: Adds a "DestSize" parameter to each of the standard string + * functions. This is the size of the Destination buffer. + * + * RETURN: TRUE if the operation would overflow the destination buffer. + * + * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that + * the result of the operation will not overflow the output string + * buffer. + * + * NOTE: These functions are typically only helpful for processing + * user input and command lines. For most ACPICA code, the + * required buffer length is precisely calculated before buffer + * allocation, so the use of these functions is unnecessary. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtSafeStrcpy ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if (strlen (Source) >= DestSize) + { + return (TRUE); + } + + strcpy (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrcat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if ((strlen (Dest) + strlen (Source)) >= DestSize) + { + return (TRUE); + } + + strcat (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrncat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source, + ACPI_SIZE MaxTransferLength) +{ + ACPI_SIZE ActualTransferLength; + + + ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); + + if ((strlen (Dest) + ActualTransferLength) >= DestSize) + { + return (TRUE); + } + + strncat (Dest, Source, MaxTransferLength); + return (FALSE); +} +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoul64 + * + * PARAMETERS: String - Null terminated string + * Base - Radix of the string: 16 or 10 or + * ACPI_ANY_BASE + * MaxIntegerByteWidth - Maximum allowable integer,in bytes: + * 4 or 8 (32 or 64 bits) + * RetInteger - Where the converted integer is + * returned + * + * RETURN: Status and Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. Performs either a + * 32-bit or 64-bit conversion, depending on the input integer + * size (often the current mode of the interpreter). + * + * NOTES: Negative numbers are not supported, as they are not supported + * by ACPI. + * + * AcpiGbl_IntegerByteWidth should be set to the proper width. + * For the core ACPICA code, this width depends on the DSDT + * version. For iASL, the default byte width is always 8 for the + * parser, but error checking is performed later to flag cases + * where a 64-bit constant is defined in a 32-bit DSDT/SSDT. + * + * Does not support Octal strings, not needed at this time. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT32 Base, + UINT32 MaxIntegerByteWidth, + UINT64 *RetInteger) +{ + UINT32 ThisDigit = 0; + UINT64 ReturnValue = 0; + UINT64 Quotient; + UINT64 Dividend; + UINT8 ValidDigits = 0; + UINT8 SignOf0x = 0; + UINT8 Term = 0; + + + ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); + + + switch (Base) + { + case ACPI_ANY_BASE: + case 10: + case 16: + + break; + + default: + + /* Invalid Base */ + + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (!String) + { + goto ErrorExit; + } + + /* Skip over any white space in the buffer */ + + while ((*String) && (isspace ((int) *String) || *String == '\t')) + { + String++; + } + + if (Base == ACPI_ANY_BASE) + { + /* + * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'. + * We need to determine if it is decimal or hexadecimal. + */ + if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x')) + { + SignOf0x = 1; + Base = 16; + + /* Skip over the leading '0x' */ + String += 2; + } + else + { + Base = 10; + } + } + + /* Any string left? Check that '0x' is not followed by white space. */ + + if (!(*String) || isspace ((int) *String) || *String == '\t') + { + if (Base == ACPI_ANY_BASE) + { + goto ErrorExit; + } + else + { + goto AllDone; + } + } + + /* + * Perform a 32-bit or 64-bit conversion, depending upon the input + * byte width + */ + Dividend = (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH) ? + ACPI_UINT32_MAX : ACPI_UINT64_MAX; + + /* Main loop: convert the string to a 32- or 64-bit integer */ + + while (*String) + { + if (isdigit ((int) *String)) + { + /* Convert ASCII 0-9 to Decimal value */ + + ThisDigit = ((UINT8) *String) - '0'; + } + else if (Base == 10) + { + /* Digit is out of range; possible in ToInteger case only */ + + Term = 1; + } + else + { + ThisDigit = (UINT8) toupper ((int) *String); + if (isxdigit ((int) ThisDigit)) + { + /* Convert ASCII Hex char to value */ + + ThisDigit = ThisDigit - 'A' + 10; + } + else + { + Term = 1; + } + } + + if (Term) + { + if (Base == ACPI_ANY_BASE) + { + goto ErrorExit; + } + else + { + break; + } + } + else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) + { + /* Skip zeros */ + String++; + continue; + } + + ValidDigits++; + + if (SignOf0x && ((ValidDigits > 16) || + ((ValidDigits > 8) && (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH)))) + { + /* + * This is ToInteger operation case. + * No restrictions for string-to-integer conversion, + * see ACPI spec. + */ + goto ErrorExit; + } + + /* Divide the digit into the correct position */ + + (void) AcpiUtShortDivide ( + (Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL); + + if (ReturnValue > Quotient) + { + if (Base == ACPI_ANY_BASE) + { + goto ErrorExit; + } + else + { + break; + } + } + + ReturnValue *= Base; + ReturnValue += ThisDigit; + String++; + } + + /* All done, normal exit */ + +AllDone: + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (ReturnValue))); + + *RetInteger = ReturnValue; + return_ACPI_STATUS (AE_OK); + + +ErrorExit: + + /* Base was set/validated above (10 or 16) */ + + if (Base == 10) + { + return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); + } + else + { + return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); + } +} + + +#ifdef _OBSOLETE_FUNCTIONS +/* Removed: 01/2016 */ + +/******************************************************************************* + * + * FUNCTION: strtoul64 + * + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte + * is returned + * Base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. + * + ******************************************************************************/ + +ACPI_STATUS +strtoul64 ( + char *String, + UINT32 Base, + UINT64 *RetInteger) +{ + UINT32 Index; + UINT32 Sign; + UINT64 ReturnValue = 0; + ACPI_STATUS Status = AE_OK; + + + *RetInteger = 0; + + switch (Base) + { + case 0: + case 8: + case 10: + case 16: + + break; + + default: + /* + * The specified Base parameter is not in the domain of + * this function: + */ + return (AE_BAD_PARAMETER); + } + + /* Skip over any white space in the buffer: */ + + while (isspace ((int) *String) || *String == '\t') + { + ++String; + } + + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*String == '-') + { + Sign = ACPI_SIGN_NEGATIVE; + ++String; + } + else if (*String == '+') + { + ++String; + Sign = ACPI_SIGN_POSITIVE; + } + else + { + Sign = ACPI_SIGN_POSITIVE; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (Base == 0) + { + if (*String == '0') + { + if (tolower ((int) *(++String)) == 'x') + { + Base = 16; + ++String; + } + else + { + Base = 8; + } + } + else + { + Base = 10; + } + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (Base == 8 && *String == '0') + { + String++; + } + + if (Base == 16 && + *String == '0' && + tolower ((int) *(++String)) == 'x') + { + String++; + } + + /* Main loop: convert the string to an unsigned long */ + + while (*String) + { + if (isdigit ((int) *String)) + { + Index = ((UINT8) *String) - '0'; + } + else + { + Index = (UINT8) toupper ((int) *String); + if (isupper ((int) Index)) + { + Index = Index - 'A' + 10; + } + else + { + goto ErrorExit; + } + } + + if (Index >= Base) + { + goto ErrorExit; + } + + /* Check to see if value is out of range: */ + + if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / + (UINT64) Base)) + { + goto ErrorExit; + } + else + { + ReturnValue *= Base; + ReturnValue += Index; + } + + ++String; + } + + + /* If a minus sign was present, then "the conversion is negated": */ + + if (Sign == ACPI_SIGN_NEGATIVE) + { + ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; + } + + *RetInteger = ReturnValue; + return (Status); + + +ErrorExit: + switch (Base) + { + case 8: + + Status = AE_BAD_OCTAL_CONSTANT; + break; + + case 10: + + Status = AE_BAD_DECIMAL_CONSTANT; + break; + + case 16: + + Status = AE_BAD_HEX_CONSTANT; + break; + + default: + + /* Base validated above */ + + break; + } + + return (Status); +} +#endif diff --git a/sys/contrib/dev/acpica/components/utilities/utobject.c b/sys/contrib/dev/acpica/components/utilities/utobject.c index 4c80c40..656568a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utobject.c +++ b/sys/contrib/dev/acpica/components/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,7 +107,8 @@ AcpiUtCreateInternalObjectDbg ( /* Allocate the raw object descriptor */ - Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId); + Object = AcpiUtAllocateObjectDescDbg ( + ModuleName, LineNumber, ComponentId); if (!Object) { return_PTR (NULL); @@ -121,8 +122,8 @@ AcpiUtCreateInternalObjectDbg ( /* These types require a secondary object */ - SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, - LineNumber, ComponentId); + SecondObject = AcpiUtAllocateObjectDescDbg ( + ModuleName, LineNumber, ComponentId); if (!SecondObject) { AcpiUtDeleteObjectDesc (Object); @@ -193,7 +194,7 @@ AcpiUtCreatePackageObject ( * terminated. */ PackageElements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) Count + 1) * sizeof (void *)); + ((ACPI_SIZE) Count + 1) * sizeof (void *)); if (!PackageElements) { ACPI_FREE (PackageDesc); @@ -283,6 +284,7 @@ AcpiUtCreateBufferObject ( { ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) BufferSize)); + AcpiUtRemoveReference (BufferDesc); return_PTR (NULL); } @@ -342,6 +344,7 @@ AcpiUtCreateStringObject ( { ACPI_ERROR ((AE_INFO, "Could not allocate size %u", (UINT32) StringSize)); + AcpiUtRemoveReference (StringDesc); return_PTR (NULL); } @@ -398,8 +401,8 @@ AcpiUtValidInternalObject ( default: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not an ACPI operand obj [%s]\n", - Object, AcpiUtGetDescriptorName (Object))); + "%p is not an ACPI operand obj [%s]\n", + Object, AcpiUtGetDescriptorName (Object))); break; } @@ -448,7 +451,7 @@ AcpiUtAllocateObjectDescDbg ( ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); + Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); return_PTR (Object); } @@ -711,12 +714,12 @@ AcpiUtGetPackageObjectSize ( ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject); - Info.Length = 0; + Info.Length = 0; Info.ObjectSpace = 0; Info.NumPackages = 1; - Status = AcpiUtWalkPackageTree (InternalObject, NULL, - AcpiUtGetElementLength, &Info); + Status = AcpiUtWalkPackageTree ( + InternalObject, NULL, AcpiUtGetElementLength, &Info); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -727,8 +730,8 @@ AcpiUtGetPackageObjectSize ( * just add the length of the package objects themselves. * Round up to the next machine word. */ - Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * - (ACPI_SIZE) Info.NumPackages; + Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD ( + sizeof (ACPI_OBJECT)) * (ACPI_SIZE) Info.NumPackages; /* Return the total package length */ @@ -762,7 +765,8 @@ AcpiUtGetObjectSize ( ACPI_FUNCTION_ENTRY (); - if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) && + if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == + ACPI_DESC_TYPE_OPERAND) && (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) { Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); diff --git a/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c index bf6ba86..2a9fa79 100644 --- a/sys/contrib/dev/acpica/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/components/utilities/utosi.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,7 +156,9 @@ AcpiUtInitializeInterfaces ( /* Link the static list of supported interfaces */ - for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++) + for (i = 0; + i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); + i++) { AcpiDefaultSupportedInterfaces[i].Next = &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; @@ -256,7 +258,7 @@ AcpiUtInstallInterface ( return (AE_NO_MEMORY); } - InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1); + InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1); if (!InterfaceInfo->Name) { ACPI_FREE (InterfaceInfo); @@ -265,7 +267,7 @@ AcpiUtInstallInterface ( /* Initialize new info and insert at the head of the global list */ - ACPI_STRCPY (InterfaceInfo->Name, InterfaceName); + strcpy (InterfaceInfo->Name, InterfaceName); InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; @@ -298,10 +300,12 @@ AcpiUtRemoveInterface ( PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { - /* Found: name is in either the static list or was added at runtime */ - + /* + * Found: name is in either the static list + * or was added at runtime + */ if (NextInterface->Flags & ACPI_OSI_DYNAMIC) { /* Interface was added dynamically, remove and free it */ @@ -321,8 +325,8 @@ AcpiUtRemoveInterface ( else { /* - * Interface is in static list. If marked invalid, then it - * does not actually exist. Else, mark it invalid. + * Interface is in static list. If marked invalid, then + * it does not actually exist. Else, mark it invalid. */ if (NextInterface->Flags & ACPI_OSI_INVALID) { @@ -419,7 +423,7 @@ AcpiUtGetInterface ( NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) { - if (!ACPI_STRCMP (InterfaceName, NextInterface->Name)) + if (!strcmp (InterfaceName, NextInterface->Name)) { return (NextInterface); } diff --git a/sys/contrib/dev/acpica/components/utilities/utownerid.c b/sys/contrib/dev/acpica/components/utilities/utownerid.c index 34c0024..0c57dba 100644 --- a/sys/contrib/dev/acpica/components/utilities/utownerid.c +++ b/sys/contrib/dev/acpica/components/utilities/utownerid.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,7 +81,8 @@ AcpiUtAllocateOwnerId ( if (*OwnerId) { - ACPI_ERROR ((AE_INFO, "Owner ID [0x%2.2X] already exists", *OwnerId)); + ACPI_ERROR ((AE_INFO, + "Owner ID [0x%2.2X] already exists", *OwnerId)); return_ACPI_STATUS (AE_ALREADY_EXISTS); } @@ -95,8 +96,8 @@ AcpiUtAllocateOwnerId ( /* * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have - * to be scanned twice. + * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index + * may have to be scanned twice. */ for (i = 0, j = AcpiGbl_LastOwnerIdIndex; i < (ACPI_NUM_OWNERID_MASKS + 1); @@ -152,8 +153,8 @@ AcpiUtAllocateOwnerId ( * they are released when a table is unloaded or a method completes * execution. * - * If this error happens, there may be very deep nesting of invoked control - * methods, or there may be a bug where the IDs are not released. + * If this error happens, there may be very deep nesting of invoked + * control methods, or there may be a bug where the IDs are not released. */ Status = AE_OWNER_ID_LIMIT; ACPI_ERROR ((AE_INFO, diff --git a/sys/contrib/dev/acpica/components/utilities/utpredef.c b/sys/contrib/dev/acpica/components/utilities/utpredef.c index a445f85..496b900 100644 --- a/sys/contrib/dev/acpica/components/utilities/utpredef.c +++ b/sys/contrib/dev/acpica/components/utilities/utpredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -166,7 +166,7 @@ AcpiUtGetExpectedReturnTypes ( if (!ExpectedBtypes) { - ACPI_STRCPY (Buffer, "NONE"); + strcpy (Buffer, "NONE"); return; } @@ -180,7 +180,7 @@ AcpiUtGetExpectedReturnTypes ( if (ExpectedBtypes & ThisRtype) { - ACPI_STRCAT (Buffer, &UtRtypeNames[i][j]); + strcat (Buffer, &UtRtypeNames[i][j]); j = 0; /* Use name separator from now on */ } @@ -254,8 +254,10 @@ AcpiUtMatchResourceName ( const ACPI_PREDEFINED_INFO *ThisName; - /* Quick check for a predefined name, first character must be underscore */ - + /* + * Quick check for a predefined name, first character must + * be underscore + */ if (Name[0] != '_') { return (NULL); diff --git a/sys/contrib/dev/acpica/components/utilities/utprint.c b/sys/contrib/dev/acpica/components/utilities/utprint.c index 62aecf0..910a2b7 100644 --- a/sys/contrib/dev/acpica/components/utilities/utprint.c +++ b/sys/contrib/dev/acpica/components/utilities/utprint.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,12 +88,6 @@ AcpiUtPutNumber ( BOOLEAN Upper); -/* Module globals */ - -static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; -static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; - - /******************************************************************************* * * FUNCTION: AcpiUtBoundStringLength @@ -227,7 +221,7 @@ AcpiUtScanNumber ( UINT64 Number = 0; - while (ACPI_IS_DIGIT (*String)) + while (isdigit ((int) *String)) { Number *= 10; Number += *(String++) - '0'; @@ -390,8 +384,8 @@ AcpiUtFormatNumber ( String = AcpiUtBoundStringOutput (String, End, '0'); if (Base == 16) { - String = AcpiUtBoundStringOutput (String, End, - Upper ? 'X' : 'x'); + String = AcpiUtBoundStringOutput ( + String, End, Upper ? 'X' : 'x'); } } if (!(Type & ACPI_FORMAT_LEFT)) @@ -500,12 +494,13 @@ AcpiUtVsnprintf ( { break; } + } while (1); /* Process width */ Width = -1; - if (ACPI_IS_DIGIT (*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Width = (INT32) Number; @@ -527,7 +522,7 @@ AcpiUtVsnprintf ( if (*Format == '.') { ++Format; - if (ACPI_IS_DIGIT(*Format)) + if (isdigit ((int) *Format)) { Format = AcpiUtScanNumber (Format, &Number); Precision = (INT32) Number; @@ -537,6 +532,7 @@ AcpiUtVsnprintf ( ++Format; Precision = va_arg (Args, int); } + if (Precision < 0) { Precision = 0; @@ -599,11 +595,13 @@ AcpiUtVsnprintf ( Pos = AcpiUtBoundStringOutput (Pos, End, ' '); } } + for (i = 0; i < Length; ++i) { Pos = AcpiUtBoundStringOutput (Pos, End, *s); ++s; } + while (Length < Width--) { Pos = AcpiUtBoundStringOutput (Pos, End, ' '); @@ -642,8 +640,8 @@ AcpiUtVsnprintf ( } p = va_arg (Args, void *); - Pos = AcpiUtFormatNumber (Pos, End, - ACPI_TO_INTEGER (p), 16, Width, Precision, Type); + Pos = AcpiUtFormatNumber ( + Pos, End, ACPI_TO_INTEGER (p), 16, Width, Precision, Type); continue; default: @@ -694,7 +692,7 @@ AcpiUtVsnprintf ( } Pos = AcpiUtFormatNumber (Pos, End, Number, Base, - Width, Precision, Type); + Width, Precision, Type); } if (Size > 0) @@ -773,7 +771,7 @@ AcpiUtFileVprintf ( Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, - sizeof (AcpiGbl_PrintBuffer), Format, Args); + sizeof (AcpiGbl_PrintBuffer), Format, Args); (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c index 65b23f1..72ebf65 100644 --- a/sys/contrib/dev/acpica/components/utilities/utresrc.c +++ b/sys/contrib/dev/acpica/components/utilities/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -489,8 +489,8 @@ AcpiUtWalkAmlResources ( if (ACPI_FAILURE (Status)) { /* - * Exit on failure. Cannot continue because the descriptor length - * may be bogus also. + * Exit on failure. Cannot continue because the descriptor + * length may be bogus also. */ return_ACPI_STATUS (Status); } @@ -503,7 +503,8 @@ AcpiUtWalkAmlResources ( if (UserFunction) { - Status = UserFunction (Aml, Length, Offset, ResourceIndex, Context); + Status = UserFunction ( + Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -625,8 +626,8 @@ AcpiUtValidateResource ( } /* - * Check validity of the resource type, via AcpiGbl_ResourceTypes. Zero - * indicates an invalid resource. + * Check validity of the resource type, via AcpiGbl_ResourceTypes. + * Zero indicates an invalid resource. */ if (!AcpiGbl_ResourceTypes[ResourceIndex]) { @@ -813,7 +814,7 @@ AcpiUtGetResourceLength ( /* Small Resource type -- bits 2:0 of byte 0 contain the length */ ResourceLength = (UINT16) (ACPI_GET8 (Aml) & - ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); } return (ResourceLength); @@ -878,7 +879,7 @@ AcpiUtGetDescriptorLength ( * the header length (depends on if this is a small or large resource) */ return (AcpiUtGetResourceLength (Aml) + - AcpiUtGetResourceHeaderLength (Aml)); + AcpiUtGetResourceHeaderLength (Aml)); } @@ -918,7 +919,7 @@ AcpiUtGetResourceEndTag ( /* Validate the template and get a pointer to the EndTag */ Status = AcpiUtWalkAmlResources (NULL, ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length, NULL, (void **) EndTag); + ObjDesc->Buffer.Length, NULL, (void **) EndTag); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c index 3396319..55778e0 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstate.c +++ b/sys/contrib/dev/acpica/components/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -278,6 +278,7 @@ AcpiUtCreatePkgState ( State->Pkg.DestObject = ExternalObject; State->Pkg.Index= Index; State->Pkg.NumPackages = 1; + return (State); } @@ -317,6 +318,7 @@ AcpiUtCreateControlState ( State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL; State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; + return (State); } @@ -347,5 +349,6 @@ AcpiUtDeleteGenericState ( { (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State); } + return; } diff --git a/sys/contrib/dev/acpica/components/utilities/utstring.c b/sys/contrib/dev/acpica/components/utilities/utstring.c index 4cbf435..3d02b6c 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstring.c +++ b/sys/contrib/dev/acpica/components/utilities/utstring.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,343 +50,6 @@ ACPI_MODULE_NAME ("utstring") -/* - * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit - * version of strtoul. - */ - -#ifdef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiUtStrlwr (strlwr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert string to lowercase - * - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c - * - ******************************************************************************/ - -void -AcpiUtStrlwr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, lowercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) ACPI_TOLOWER (*String); - } - - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiUtStricmp (stricmp) - * - * PARAMETERS: String1 - first string to compare - * String2 - second string to compare - * - * RETURN: int that signifies string relationship. Zero means strings - * are equal. - * - * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare - * strings with no case sensitivity) - * - ******************************************************************************/ - -int -AcpiUtStricmp ( - char *String1, - char *String2) -{ - int c1; - int c2; - - - do - { - c1 = tolower ((int) *String1); - c2 = tolower ((int) *String2); - - String1++; - String2++; - } - while ((c1 == c2) && (c1)); - - return (c1 - c2); -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrupr (strupr) - * - * PARAMETERS: SrcString - The source string to convert - * - * RETURN: None - * - * DESCRIPTION: Convert string to uppercase - * - * NOTE: This is not a POSIX function, so it appears here, not in utclib.c - * - ******************************************************************************/ - -void -AcpiUtStrupr ( - char *SrcString) -{ - char *String; - - - ACPI_FUNCTION_ENTRY (); - - - if (!SrcString) - { - return; - } - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; String++) - { - *String = (char) ACPI_TOUPPER (*String); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtStrtoul64 - * - * PARAMETERS: String - Null terminated string - * Base - Radix of the string: 16 or ACPI_ANY_BASE; - * ACPI_ANY_BASE means 'in behalf of ToInteger' - * RetInteger - Where the converted integer is returned - * - * RETURN: Status and Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. Performs either a - * 32-bit or 64-bit conversion, depending on the current mode - * of the interpreter. - * NOTE: Does not support Octal strings, not needed. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtStrtoul64 ( - char *String, - UINT32 Base, - UINT64 *RetInteger) -{ - UINT32 ThisDigit = 0; - UINT64 ReturnValue = 0; - UINT64 Quotient; - UINT64 Dividend; - UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); - UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); - UINT8 ValidDigits = 0; - UINT8 SignOf0x = 0; - UINT8 Term = 0; - - - ACPI_FUNCTION_TRACE_STR (UtStroul64, String); - - - switch (Base) - { - case ACPI_ANY_BASE: - case 16: - - break; - - default: - - /* Invalid Base */ - - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (!String) - { - goto ErrorExit; - } - - /* Skip over any white space in the buffer */ - - while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t')) - { - String++; - } - - if (ToIntegerOp) - { - /* - * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. - * We need to determine if it is decimal or hexadecimal. - */ - if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x')) - { - SignOf0x = 1; - Base = 16; - - /* Skip over the leading '0x' */ - String += 2; - } - else - { - Base = 10; - } - } - - /* Any string left? Check that '0x' is not followed by white space. */ - - if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t') - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - goto AllDone; - } - } - - /* - * Perform a 32-bit or 64-bit conversion, depending upon the current - * execution mode of the interpreter - */ - Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; - - /* Main loop: convert the string to a 32- or 64-bit integer */ - - while (*String) - { - if (ACPI_IS_DIGIT (*String)) - { - /* Convert ASCII 0-9 to Decimal value */ - - ThisDigit = ((UINT8) *String) - '0'; - } - else if (Base == 10) - { - /* Digit is out of range; possible in ToInteger case only */ - - Term = 1; - } - else - { - ThisDigit = (UINT8) ACPI_TOUPPER (*String); - if (ACPI_IS_XDIGIT ((char) ThisDigit)) - { - /* Convert ASCII Hex char to value */ - - ThisDigit = ThisDigit - 'A' + 10; - } - else - { - Term = 1; - } - } - - if (Term) - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - break; - } - } - else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x) - { - /* Skip zeros */ - String++; - continue; - } - - ValidDigits++; - - if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32))) - { - /* - * This is ToInteger operation case. - * No any restrictions for string-to-integer conversion, - * see ACPI spec. - */ - goto ErrorExit; - } - - /* Divide the digit into the correct position */ - - (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), - Base, &Quotient, NULL); - - if (ReturnValue > Quotient) - { - if (ToIntegerOp) - { - goto ErrorExit; - } - else - { - break; - } - } - - ReturnValue *= Base; - ReturnValue += ThisDigit; - String++; - } - - /* All done, normal exit */ - -AllDone: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ReturnValue))); - - *RetInteger = ReturnValue; - return_ACPI_STATUS (AE_OK); - - -ErrorExit: - /* Base was set/validated above */ - - if (Base == 10) - { - return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT); - } - else - { - return_ACPI_STATUS (AE_BAD_HEX_CONSTANT); - } -} - - /******************************************************************************* * * FUNCTION: AcpiUtPrintString @@ -469,7 +132,7 @@ AcpiUtPrintString ( /* Check for printable character or hex escape */ - if (ACPI_IS_PRINT (String[i])) + if (isprint ((int) String[i])) { /* This is a normal character */ @@ -484,6 +147,7 @@ AcpiUtPrintString ( break; } } + AcpiOsPrintf ("\""); if (i == MaxLength && String[i]) @@ -495,86 +159,6 @@ AcpiUtPrintString ( /******************************************************************************* * - * FUNCTION: AcpiUtValidAcpiChar - * - * PARAMETERS: Char - The character to be examined - * Position - Byte position (0-3) - * - * RETURN: TRUE if the character is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI character. Must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - * We allow a '!' as the last character because of the ASF! table - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidAcpiChar ( - char Character, - UINT32 Position) -{ - - if (!((Character >= 'A' && Character <= 'Z') || - (Character >= '0' && Character <= '9') || - (Character == '_'))) - { - /* Allow a '!' in the last position */ - - if (Character == '!' && Position == 3) - { - return (TRUE); - } - - return (FALSE); - } - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidAcpiName - * - * PARAMETERS: Name - The name to be examined. Does not have to - * be NULL terminated string. - * - * RETURN: TRUE if the name is valid, FALSE otherwise - * - * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidAcpiName ( - char *Name) -{ - UINT32 i; - - - ACPI_FUNCTION_ENTRY (); - - - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (!AcpiUtValidAcpiChar (Name[i], i)) - { - return (FALSE); - } - } - - return (TRUE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtRepairName * * PARAMETERS: Name - The ACPI name to be repaired @@ -607,13 +191,22 @@ AcpiUtRepairName ( ACPI_FUNCTION_NAME (UtRepairName); + /* + * Special case for the root node. This can happen if we get an + * error during the execution of module-level code. + */ + if (ACPI_COMPARE_NAME (Name, "\\___")) + { + return; + } + ACPI_MOVE_NAME (&OriginalName, Name); /* Check each character in the name */ for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (AcpiUtValidAcpiChar (Name[i], i)) + if (AcpiUtValidNameChar (Name[i], i)) { continue; } @@ -682,81 +275,3 @@ UtConvertBackslashes ( } } #endif - -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) -/******************************************************************************* - * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat - * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. - * - * RETURN: TRUE if the operation would overflow the destination buffer. - * - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that - * the result of the operation will not overflow the output string - * buffer. - * - * NOTE: These functions are typically only helpful for processing - * user input and command lines. For most ACPICA code, the - * required buffer length is precisely calculated before buffer - * allocation, so the use of these functions is unnecessary. - * - ******************************************************************************/ - -BOOLEAN -AcpiUtSafeStrcpy ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if (ACPI_STRLEN (Source) >= DestSize) - { - return (TRUE); - } - - ACPI_STRCPY (Dest, Source); - return (FALSE); -} - -BOOLEAN -AcpiUtSafeStrcat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source) -{ - - if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize) - { - return (TRUE); - } - - ACPI_STRCAT (Dest, Source); - return (FALSE); -} - -#ifndef _KERNEL -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; - - - ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source)); - - if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize) - { - return (TRUE); - } - - ACPI_STRNCAT (Dest, Source, MaxTransferLength); - return (FALSE); -} -#endif - -#endif diff --git a/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c index 5f208b5..76e915b 100644 --- a/sys/contrib/dev/acpica/components/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,7 @@ AcpiUtRemoveAllocation ( ACPI_STATUS AcpiUtCreateList ( - char *ListName, + const char *ListName, UINT16 ObjectSize, ACPI_MEMORY_LIST **ReturnCache) { @@ -113,9 +113,9 @@ AcpiUtCreateList ( return (AE_NO_MEMORY); } - ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST)); + memset (Cache, 0, sizeof (ACPI_MEMORY_LIST)); - Cache->ListName = ListName; + Cache->ListName = ListName; Cache->ObjectSize = ObjectSize; *ReturnCache = Cache; @@ -169,8 +169,8 @@ AcpiUtAllocateAndTrack ( return (NULL); } - Status = AcpiUtTrackAllocation (Allocation, Size, - ACPI_MEM_MALLOC, Component, Module, Line); + Status = AcpiUtTrackAllocation ( + Allocation, Size, ACPI_MEM_MALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { AcpiOsFree (Allocation); @@ -180,9 +180,12 @@ AcpiUtAllocateAndTrack ( AcpiGbl_GlobalList->TotalAllocated++; AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + + if (AcpiGbl_GlobalList->CurrentTotalSize > + AcpiGbl_GlobalList->MaxOccupied) { - AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + AcpiGbl_GlobalList->MaxOccupied = + AcpiGbl_GlobalList->CurrentTotalSize; } return ((void *) &Allocation->UserSpace); @@ -224,7 +227,8 @@ AcpiUtAllocateZeroedAndTrack ( Size = 1; } - Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER)); + Allocation = AcpiOsAllocateZeroed ( + Size + sizeof (ACPI_DEBUG_MEM_HEADER)); if (!Allocation) { /* Report allocation error */ @@ -235,7 +239,7 @@ AcpiUtAllocateZeroedAndTrack ( } Status = AcpiUtTrackAllocation (Allocation, Size, - ACPI_MEM_CALLOC, Component, Module, Line); + ACPI_MEM_CALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { AcpiOsFree (Allocation); @@ -245,9 +249,12 @@ AcpiUtAllocateZeroedAndTrack ( AcpiGbl_GlobalList->TotalAllocated++; AcpiGbl_GlobalList->TotalSize += (UINT32) Size; AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size; - if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied) + + if (AcpiGbl_GlobalList->CurrentTotalSize > + AcpiGbl_GlobalList->MaxOccupied) { - AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize; + AcpiGbl_GlobalList->MaxOccupied = + AcpiGbl_GlobalList->CurrentTotalSize; } return ((void *) &Allocation->UserSpace); @@ -292,13 +299,12 @@ AcpiUtFreeAndTrack ( } DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK, - (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); + (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); AcpiGbl_GlobalList->TotalFreed++; AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size; - Status = AcpiUtRemoveAllocation (DebugBlock, - Component, Module, Line); + Status = AcpiUtRemoveAllocation (DebugBlock, Component, Module, Line); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "Could not free memory")); @@ -440,12 +446,12 @@ AcpiUtTrackAllocation ( /* Fill in the instance data */ - Allocation->Size = (UINT32) Size; + Allocation->Size = (UINT32) Size; Allocation->AllocType = AllocType; Allocation->Component = Component; - Allocation->Line = Line; + Allocation->Line = Line; - ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); + strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; if (!Element) @@ -454,7 +460,8 @@ AcpiUtTrackAllocation ( if (MemList->ListHead) { - ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation; + ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = + Allocation; } Allocation->Next = MemList->ListHead; @@ -556,7 +563,7 @@ AcpiUtRemoveAllocation ( /* Mark the segment as deleted */ - ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size); + memset (&Allocation->UserSpace, 0xEA, Allocation->Size); Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return (Status); @@ -587,37 +594,37 @@ AcpiUtDumpAllocationInfo ( /* ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - MemList->CurrentCount, - ROUND_UP_TO_1K (MemList->CurrentSize))); + ("%30s: %4d (%3d Kb)\n", "Current allocations", + MemList->CurrentCount, + ROUND_UP_TO_1K (MemList->CurrentSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - MemList->MaxConcurrentCount, - ROUND_UP_TO_1K (MemList->MaxConcurrentSize))); + ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", + MemList->MaxConcurrentCount, + ROUND_UP_TO_1K (MemList->MaxConcurrentSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - RunningObjectCount, - ROUND_UP_TO_1K (RunningObjectSize))); + ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", + RunningObjectCount, + ROUND_UP_TO_1K (RunningObjectSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - RunningAllocCount, - ROUND_UP_TO_1K (RunningAllocSize))); + ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", + RunningAllocCount, + ROUND_UP_TO_1K (RunningAllocSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - AcpiGbl_CurrentNodeCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); + ("%30s: %4d (%3d Kb)\n", "Current Nodes", + AcpiGbl_CurrentNodeCount, + ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - AcpiGbl_MaxConcurrentNodeCount, - ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * - sizeof (ACPI_NAMESPACE_NODE))))); + ("%30s: %4d (%3d Kb)\n", "Max Nodes", + AcpiGbl_MaxConcurrentNodeCount, + ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * + sizeof (ACPI_NAMESPACE_NODE))))); */ return_VOID; } @@ -667,9 +674,10 @@ AcpiUtDumpAllocations ( while (Element) { if ((Element->Component & Component) && - ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module)))) + ((Module == NULL) || (0 == strcmp (Module, Element->Module)))) { - Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); + Descriptor = ACPI_CAST_PTR ( + ACPI_DESCRIPTOR, &Element->UserSpace); if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR)) { @@ -682,7 +690,8 @@ AcpiUtDumpAllocations ( { /* Ignore allocated objects that are in a cache */ - if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED) + if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != + ACPI_DESC_TYPE_CACHED) { AcpiOsPrintf ("%p Length 0x%04X %9.9s-%u [%s] ", Descriptor, Element->Size, Element->Module, @@ -766,7 +775,7 @@ AcpiUtDumpAllocations ( if (!NumOutstanding) { - ACPI_INFO ((AE_INFO, "No outstanding allocations")); + ACPI_INFO (("No outstanding allocations")); } else { diff --git a/sys/contrib/dev/acpica/components/utilities/utuuid.c b/sys/contrib/dev/acpica/components/utilities/utuuid.c index 435c6c3..281305a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utuuid.c +++ b/sys/contrib/dev/acpica/components/utilities/utuuid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,11 +93,11 @@ AcpiUtConvertStringToUuid ( for (i = 0; i < UUID_BUFFER_LENGTH; i++) { - UuidBuffer[i] = - (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4); + UuidBuffer[i] = (AcpiUtAsciiCharToHex ( + InString[AcpiGbl_MapToUuidOffset[i]]) << 4); - UuidBuffer[i] |= - AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); + UuidBuffer[i] |= AcpiUtAsciiCharToHex ( + InString[AcpiGbl_MapToUuidOffset[i] + 1]); } } #endif diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c index aab7473..02ca632 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxface.c +++ b/sys/contrib/dev/acpica/components/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,24 +73,6 @@ AcpiTerminate ( ACPI_FUNCTION_TRACE (AcpiTerminate); - /* Just exit if subsystem is already shutdown */ - - if (AcpiGbl_Shutdown) - { - ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); - return_ACPI_STATUS (AE_OK); - } - - /* Subsystem appears active, go ahead and shut it down */ - - AcpiGbl_Shutdown = TRUE; - AcpiGbl_StartupFlags = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); - - /* Terminate the AML Debugger if present */ - - ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = TRUE); - /* Shutdown and free all resources */ AcpiUtSubsystemShutdown (); @@ -99,14 +81,6 @@ AcpiTerminate ( AcpiUtMutexTerminate (); - -#ifdef ACPI_DEBUGGER - - /* Shut down the debugger */ - - AcpiDbTerminate (); -#endif - /* Now we can shutdown the OS-dependent layer */ Status = AcpiOsTerminate (); @@ -198,7 +172,6 @@ AcpiGetSystemInfo ( * Populate the return buffer */ InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; - InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ @@ -263,14 +236,12 @@ AcpiGetStatistics ( Stats->SciCount = AcpiSciCount; Stats->GpeCount = AcpiGpeCount; - ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, + memcpy (Stats->FixedEventCount, AcpiFixedEventCount, sizeof (AcpiFixedEventCount)); - /* Other counters */ Stats->MethodCount = AcpiMethodCount; - return_ACPI_STATUS (AE_OK); } @@ -367,7 +338,7 @@ AcpiInstallInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } @@ -432,7 +403,7 @@ AcpiRemoveInterface ( /* Parameter validation */ - if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) + if (!InterfaceName || (strlen (InterfaceName) == 0)) { return (AE_BAD_PARAMETER); } @@ -604,7 +575,7 @@ AcpiDecodePldBuffer ( /* Parameter validation */ - if (!InBuffer || !ReturnBuffer || (Length < 16)) + if (!InBuffer || !ReturnBuffer || (Length < ACPI_PLD_REV1_BUFFER_SIZE)) { return (AE_BAD_PARAMETER); } @@ -656,7 +627,7 @@ AcpiDecodePldBuffer ( PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); - if (Length >= ACPI_PLD_BUFFER_SIZE) + if (Length >= ACPI_PLD_REV2_BUFFER_SIZE) { /* Fifth 32-bit DWord (Revision 2 of _PLD) */ diff --git a/sys/contrib/dev/acpica/components/utilities/utxferror.c b/sys/contrib/dev/acpica/components/utilities/utxferror.c index d39682b..802da6d 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxferror.c +++ b/sys/contrib/dev/acpica/components/utilities/utxferror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,8 +133,10 @@ AcpiException ( } else { - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); + AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", + AcpiFormatException (Status)); } + va_start (ArgList, Format); AcpiOsVprintf (Format, ArgList); ACPI_MSG_SUFFIX; @@ -203,8 +205,6 @@ ACPI_EXPORT_SYMBOL (AcpiWarning) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( - const char *ModuleName, - UINT32 LineNumber, const char *Format, ...) { diff --git a/sys/contrib/dev/acpica/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/components/utilities/utxfinit.c index 36107ca..f7085b4 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,17 +132,6 @@ AcpiInitializeSubsystem ( return_ACPI_STATUS (Status); } - /* If configured, initialize the AML debugger */ - -#ifdef ACPI_DEBUGGER - Status = AcpiDbInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Debugger initialization")); - return_ACPI_STATUS (Status); - } -#endif - return_ACPI_STATUS (AE_OK); } @@ -172,6 +161,13 @@ AcpiEnableSubsystem ( ACPI_FUNCTION_TRACE (AcpiEnableSubsystem); + /* + * The early initialization phase is complete. The namespace is loaded, + * and we can now support address spaces other than Memory, I/O, and + * PCI_Config. + */ + AcpiGbl_EarlyInitialization = FALSE; + #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ @@ -194,33 +190,16 @@ AcpiEnableSubsystem ( * Obtain a permanent mapping for the FACS. This is required for the * Global Lock and the Firmware Waking Vector */ - Status = AcpiTbInitializeFacs (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); - return_ACPI_STATUS (Status); - } - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* - * Install the default OpRegion handlers. These are installed unless - * other handlers have already been installed via the - * InstallAddressSpaceHandler interface. - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) + if (!(Flags & ACPI_NO_FACS_INIT)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Installing default address space handlers\n")); - - Status = AcpiEvInstallRegionHandlers (); + Status = AcpiTbInitializeFacs (); if (ACPI_FAILURE (Status)) { + ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); return_ACPI_STATUS (Status); } } -#if (!ACPI_REDUCED_HARDWARE) /* * Initialize ACPI Event handling (Fixed and General Purpose) * @@ -294,25 +273,6 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); - /* - * Run all _REG methods - * - * Note: Any objects accessed by the _REG methods will be automatically - * initialized, even if they contain executable AML (see the call to - * AcpiNsInitializeObjects below). - */ - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Executing _REG OpRegion methods\n")); - - Status = AcpiEvInitializeOpRegions (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - #ifdef ACPI_EXEC_APP /* * This call implements the "initialization file" option for AcpiExec. @@ -328,36 +288,38 @@ AcpiInitializeObjects ( * outside of any control method is wrapped with a temporary control * method object and placed on a global list. The methods on this list * are executed below. + * + * This case executes the module-level code for all tables only after + * all of the tables have been loaded. It is a legacy option and is + * not compatible with other ACPI implementations. See AcpiNsLoadTable. */ - AcpiNsExecModuleCodeList (); - - /* - * Initialize the objects that remain uninitialized. This runs the - * executable AML that may be part of the declaration of these objects: - * OperationRegions, BufferFields, Buffers, and Packages. - */ - if (!(Flags & ACPI_NO_OBJECT_INIT)) + if (AcpiGbl_GroupModuleLevelCode) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Completing Initialization of ACPI Objects\n")); - - Status = AcpiNsInitializeObjects (); - if (ACPI_FAILURE (Status)) + AcpiNsExecModuleCodeList (); + + /* + * Initialize the objects that remain uninitialized. This + * runs the executable AML that may be part of the + * declaration of these objects: + * OperationRegions, BufferFields, Buffers, and Packages. + */ + if (!(Flags & ACPI_NO_OBJECT_INIT)) { - return_ACPI_STATUS (Status); + Status = AcpiNsInitializeObjects (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } } /* - * Initialize all device objects in the namespace. This runs the device - * _STA and _INI methods. + * Initialize all device/region objects in the namespace. This runs + * the device _STA and _INI methods and region _REG methods. */ - if (!(Flags & ACPI_NO_DEVICE_INIT)) + if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT))) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "[Init] Initializing ACPI Devices\n")); - - Status = AcpiNsInitializeDevices (); + Status = AcpiNsInitializeDevices (Flags); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/components/utilities/utxfmutex.c b/sys/contrib/dev/acpica/components/utilities/utxfmutex.c index 559f4b4..ef5a7bc 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfmutex.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,8 +98,8 @@ AcpiUtGetMutexObject ( MutexNode = Handle; if (Pathname != NULL) { - Status = AcpiGetHandle (Handle, Pathname, - ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); + Status = AcpiGetHandle ( + Handle, Pathname, ACPI_CAST_PTR (ACPI_HANDLE, &MutexNode)); if (ACPI_FAILURE (Status)) { return (Status); |