summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/utilities')
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utaddress.c18
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utalloc.c145
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utbuffer.c139
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utcache.c16
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utcopy.c17
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdebug.c68
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdecode.c114
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdelete.c20
-rw-r--r--sys/contrib/dev/acpica/components/utilities/uterror.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/uteval.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utexcep.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utfileio.c361
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utglobal.c193
-rw-r--r--sys/contrib/dev/acpica/components/utilities/uthex.c111
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utids.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utinit.c161
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utlock.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmath.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmisc.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmutex.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utobject.c6
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utosi.c33
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utownerid.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utpredef.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utprint.c811
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utresrc.c13
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utstate.c5
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utstring.c85
-rw-r--r--sys/contrib/dev/acpica/components/utilities/uttrack.c36
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utuuid.c101
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxface.c11
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxferror.c8
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxfinit.c36
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxfmutex.c4
34 files changed, 2097 insertions, 460 deletions
diff --git a/sys/contrib/dev/acpica/components/utilities/utaddress.c b/sys/contrib/dev/acpica/components/utilities/utaddress.c
index da8b046..02d6110 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTADDRESS_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -248,10 +246,11 @@ AcpiUtCheckAddressRange (
while (RangeInfo)
{
/*
- * Check if the requested Address/Length overlaps this AddressRange.
- * Four cases to consider:
+ * Check if the requested address/length overlaps this
+ * address range. There are four cases to consider:
*
- * 1) Input address/length is contained completely in the address range
+ * 1) Input address/length is contained completely in the
+ * address range
* 2) Input address/length overlaps range at the range start
* 3) Input address/length overlaps range at the range end
* 4) Input address/length completely encompasses the range
@@ -267,10 +266,13 @@ AcpiUtCheckAddressRange (
Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode);
ACPI_WARNING ((AE_INFO,
- "0x%p-0x%p %s conflicts with Region %s %d",
+ "%s range 0x%p-0x%p conflicts with OpRegion 0x%p-0x%p (%s)",
+ AcpiUtGetRegionName (SpaceId),
ACPI_CAST_PTR (void, Address),
ACPI_CAST_PTR (void, EndAddress),
- AcpiUtGetRegionName (SpaceId), Pathname, OverlapCount));
+ ACPI_CAST_PTR (void, RangeInfo->StartAddress),
+ ACPI_CAST_PTR (void, RangeInfo->EndAddress),
+ Pathname));
ACPI_FREE (Pathname);
}
}
diff --git a/sys/contrib/dev/acpica/components/utilities/utalloc.c b/sys/contrib/dev/acpica/components/utilities/utalloc.c
index 0bdb2ff..99fb15a1 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTALLOC_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acdebug.h>
@@ -51,6 +49,45 @@
ACPI_MODULE_NAME ("utalloc")
+#if !defined (USE_NATIVE_ALLOCATE_ZEROED)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsAllocateZeroed
+ *
+ * PARAMETERS: Size - Size of the allocation
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
+ * This is the default implementation. Can be overridden via the
+ * USE_NATIVE_ALLOCATE_ZEROED flag.
+ *
+ ******************************************************************************/
+
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Allocation = AcpiOsAllocate (Size);
+ if (Allocation)
+ {
+ /* Clear the memory block */
+
+ ACPI_MEMSET (Allocation, 0, Size);
+ }
+
+ return (Allocation);
+}
+
+#endif /* !USE_NATIVE_ALLOCATE_ZEROED */
+
+
/*******************************************************************************
*
* FUNCTION: AcpiUtCreateCaches
@@ -285,9 +322,13 @@ AcpiUtInitializeBuffer (
return (AE_BUFFER_OVERFLOW);
case ACPI_ALLOCATE_BUFFER:
-
- /* Allocate a new buffer */
-
+ /*
+ * Allocate a new buffer. We directectly call AcpiOsAllocate here to
+ * purposefully bypass the (optionally enabled) internal allocation
+ * tracking mechanism since we only want to track internal
+ * allocations. Note: The caller should use AcpiOsFree to free this
+ * buffer created via ACPI_ALLOCATE_BUFFER.
+ */
Buffer->Pointer = AcpiOsAllocate (RequiredLength);
break;
@@ -321,95 +362,3 @@ AcpiUtInitializeBuffer (
ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
return (AE_OK);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocate (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- ACPI_WARNING ((Module, Line,
- "Attempt to allocate zero bytes, allocating 1 byte"));
- Size = 1;
- }
-
- Allocation = AcpiOsAllocate (Size);
- if (!Allocation)
- {
- /* Report allocation error */
-
- ACPI_WARNING ((Module, Line,
- "Could not allocate size %u", (UINT32) Size));
-
- return_PTR (NULL);
- }
-
- return_PTR (Allocation);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocateZeroed
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateZeroed (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Allocation = AcpiUtAllocate (Size, Component, Module, Line);
- if (Allocation)
- {
- /* Clear the memory block */
-
- ACPI_MEMSET (Allocation, 0, Size);
- }
-
- return (Allocation);
-}
diff --git a/sys/contrib/dev/acpica/components/utilities/utbuffer.c b/sys/contrib/dev/acpica/components/utilities/utbuffer.c
index 508a940..862ac6b 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTBUFFER_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -218,3 +216,138 @@ AcpiUtDebugDumpBuffer (
AcpiUtDumpBuffer (Buffer, Count, Display, 0);
}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpBufferToFile
+ *
+ * PARAMETERS: File - File descriptor
+ * Buffer - Buffer to dump
+ * Count - Amount to dump, in bytes
+ * Display - BYTE, WORD, DWORD, or QWORD display:
+ * DB_BYTE_DISPLAY
+ * DB_WORD_DISPLAY
+ * DB_DWORD_DISPLAY
+ * DB_QWORD_DISPLAY
+ * BaseOffset - Beginning buffer offset (display only)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii to a file.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpBufferToFile (
+ ACPI_FILE File,
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 BaseOffset)
+{
+ UINT32 i = 0;
+ UINT32 j;
+ UINT32 Temp32;
+ UINT8 BufChar;
+
+
+ if (!Buffer)
+ {
+ AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n");
+ return;
+ }
+
+ if ((Count < 4) || (Count & 0x01))
+ {
+ Display = DB_BYTE_DISPLAY;
+ }
+
+ /* Nasty little dump buffer routine! */
+
+ while (i < Count)
+ {
+ /* Print current offset */
+
+ AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i));
+
+ /* Print 16 hex chars */
+
+ for (j = 0; j < 16;)
+ {
+ if (i + j >= Count)
+ {
+ /* Dump fill spaces */
+
+ AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " ");
+ j += Display;
+ continue;
+ }
+
+ switch (Display)
+ {
+ case DB_BYTE_DISPLAY:
+ default: /* Default is BYTE display */
+
+ AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]);
+ break;
+
+ case DB_WORD_DISPLAY:
+
+ ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
+ AcpiUtFilePrintf (File, "%04X ", Temp32);
+ break;
+
+ case DB_DWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
+ AcpiUtFilePrintf (File, "%08X ", Temp32);
+ break;
+
+ case DB_QWORD_DISPLAY:
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
+ AcpiUtFilePrintf (File, "%08X", Temp32);
+
+ ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
+ AcpiUtFilePrintf (File, "%08X ", Temp32);
+ break;
+ }
+
+ j += Display;
+ }
+
+ /*
+ * Print the ASCII equivalent characters but watch out for the bad
+ * unprintable ones (printable chars are 0x20 through 0x7E)
+ */
+ AcpiUtFilePrintf (File, " ");
+ for (j = 0; j < 16; j++)
+ {
+ if (i + j >= Count)
+ {
+ AcpiUtFilePrintf (File, "\n");
+ return;
+ }
+
+ BufChar = Buffer[(ACPI_SIZE) i + j];
+ if (ACPI_IS_PRINT (BufChar))
+ {
+ AcpiUtFilePrintf (File, "%c", BufChar);
+ }
+ else
+ {
+ AcpiUtFilePrintf (File, ".");
+ }
+ }
+
+ /* Done with that line. */
+
+ AcpiUtFilePrintf (File, "\n");
+ i += 16;
+ }
+
+ return;
+}
+#endif
diff --git a/sys/contrib/dev/acpica/components/utilities/utcache.c b/sys/contrib/dev/acpica/components/utilities/utcache.c
index 2aa3e5b..aa0161c 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTCACHE_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -286,13 +284,13 @@ AcpiOsAcquireObject (
if (!Cache)
{
- return (NULL);
+ return_PTR (NULL);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
- return (NULL);
+ return_PTR (NULL);
}
ACPI_MEM_TRACKING (Cache->Requests++);
@@ -315,7 +313,7 @@ AcpiOsAcquireObject (
Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
- return (NULL);
+ return_PTR (NULL);
}
/* Clear (zero) the previously used Object */
@@ -340,16 +338,16 @@ AcpiOsAcquireObject (
Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
{
- return (NULL);
+ return_PTR (NULL);
}
Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
if (!Object)
{
- return (NULL);
+ return_PTR (NULL);
}
}
- return (Object);
+ return_PTR (Object);
}
#endif /* ACPI_USE_LOCAL_CACHE */
diff --git a/sys/contrib/dev/acpica/components/utilities/utcopy.c b/sys/contrib/dev/acpica/components/utilities/utcopy.c
index dacbc5c..8a94ea6 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTCOPY_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -564,10 +562,10 @@ AcpiUtCopyEsimpleToIsimple (
case ACPI_TYPE_LOCAL_REFERENCE:
- /* TBD: should validate incoming handle */
+ /* An incoming reference is defined to be a namespace node */
- InternalObject->Reference.Class = ACPI_REFCLASS_NAME;
- InternalObject->Reference.Node = ExternalObject->Reference.Handle;
+ InternalObject->Reference.Class = ACPI_REFCLASS_REFOF;
+ InternalObject->Reference.Object = ExternalObject->Reference.Handle;
break;
default:
@@ -1063,5 +1061,12 @@ AcpiUtCopyIobjectToIobject (
Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
}
+ /* Delete the allocated object if copy failed */
+
+ if (ACPI_FAILURE (Status))
+ {
+ 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 93c0361..544450d 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTDEBUG_C__
+#define EXPORT_ACPI_INTERFACES
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -210,6 +210,7 @@ AcpiDebugPrint (
}
AcpiGbl_PrevThreadId = ThreadId;
+ AcpiGbl_NestingLevel = 0;
}
/*
@@ -218,13 +219,22 @@ AcpiDebugPrint (
*/
AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
+#ifdef ACPI_APPLICATION
+ /*
+ * For AcpiExec/iASL only, emit the thread ID and nesting level.
+ * Note: nesting level is really only useful during a single-thread
+ * execution. Otherwise, multiple threads will keep resetting the
+ * level.
+ */
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
}
- AcpiOsPrintf ("[%02ld] %-22.22s: ",
- AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName));
+ AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel);
+#endif
+
+ AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
va_start (args, Format);
AcpiOsVprintf (Format, args);
@@ -474,7 +484,10 @@ AcpiUtExit (
"%s\n", AcpiGbl_FnExitStr);
}
- AcpiGbl_NestingLevel--;
+ if (AcpiGbl_NestingLevel)
+ {
+ AcpiGbl_NestingLevel--;
+ }
}
ACPI_EXPORT_SYMBOL (AcpiUtExit)
@@ -526,7 +539,10 @@ AcpiUtStatusExit (
}
}
- AcpiGbl_NestingLevel--;
+ if (AcpiGbl_NestingLevel)
+ {
+ AcpiGbl_NestingLevel--;
+ }
}
ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
@@ -568,7 +584,10 @@ AcpiUtValueExit (
ACPI_FORMAT_UINT64 (Value));
}
- AcpiGbl_NestingLevel--;
+ if (AcpiGbl_NestingLevel)
+ {
+ AcpiGbl_NestingLevel--;
+ }
}
ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
@@ -609,7 +628,40 @@ AcpiUtPtrExit (
"%s %p\n", AcpiGbl_FnExitStr, Ptr);
}
- AcpiGbl_NestingLevel--;
+ if (AcpiGbl_NestingLevel)
+ {
+ AcpiGbl_NestingLevel--;
+ }
+}
+
+#endif
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLogError
+ *
+ * PARAMETERS: Format - Printf format field
+ * ... - Optional printf arguments
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print error message to the console, used by applications.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiLogError (
+ const char *Format,
+ ...)
+{
+ va_list Args;
+
+ va_start (Args, Format);
+ (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args);
+ va_end (Args);
}
+ACPI_EXPORT_SYMBOL (AcpiLogError)
#endif
diff --git a/sys/contrib/dev/acpica/components/utilities/utdecode.c b/sys/contrib/dev/acpica/components/utilities/utdecode.c
index 3075479..c1887ee 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTDECODE_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -93,38 +91,6 @@ const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
/*******************************************************************************
*
- * FUNCTION: AcpiUtHexToAsciiChar
- *
- * PARAMETERS: Integer - Contains the hex digit
- * Position - bit position of the digit within the
- * integer (multiple of 4)
- *
- * RETURN: The converted Ascii character
- *
- * DESCRIPTION: Convert a hex digit to an Ascii character
- *
- ******************************************************************************/
-
-/* Hex to ASCII conversion table */
-
-static const char AcpiGbl_HexToAscii[] =
-{
- '0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'
-};
-
-char
-AcpiUtHexToAsciiChar (
- UINT64 Integer,
- UINT32 Position)
-{
-
- return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiUtGetRegionName
*
* PARAMETERS: Space ID - ID for the region
@@ -527,7 +493,7 @@ AcpiUtGetMutexName (
/* Names for Notify() values, used for debug output */
-static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
+static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] =
{
/* 00 */ "Bus Check",
/* 01 */ "Device Check",
@@ -539,32 +505,88 @@ static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
/* 07 */ "Power Fault",
/* 08 */ "Capabilities Check",
/* 09 */ "Device PLD Check",
- /* 10 */ "Reserved",
- /* 11 */ "System Locality Update",
- /* 12 */ "Shutdown Request"
+ /* 0A */ "Reserved",
+ /* 0B */ "System Locality Update",
+ /* 0C */ "Shutdown Request",
+ /* 0D */ "System Resource Affinity Update"
+};
+
+static const char *AcpiGbl_DeviceNotify[4] =
+{
+ /* 80 */ "Status Change",
+ /* 81 */ "Information Change",
+ /* 82 */ "Device-Specific Change",
+ /* 83 */ "Device-Specific Change"
};
+static const char *AcpiGbl_ProcessorNotify[4] =
+{
+ /* 80 */ "Performance Capability Change",
+ /* 81 */ "C-State Change",
+ /* 82 */ "Throttling Capability Change",
+ /* 83 */ "Device-Specific Change"
+};
+
+static const char *AcpiGbl_ThermalNotify[4] =
+{
+ /* 80 */ "Thermal Status Change",
+ /* 81 */ "Thermal Trip Point Change",
+ /* 82 */ "Thermal Device List Change",
+ /* 83 */ "Thermal Relationship Change"
+};
+
+
const char *
AcpiUtGetNotifyName (
- UINT32 NotifyValue)
+ UINT32 NotifyValue,
+ ACPI_OBJECT_TYPE Type)
{
+ /* 00 - 0D are common to all object types */
+
if (NotifyValue <= ACPI_NOTIFY_MAX)
{
- return (AcpiGbl_NotifyValueNames[NotifyValue]);
+ return (AcpiGbl_GenericNotify[NotifyValue]);
}
- else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
+
+ /* 0D - 7F are reserved */
+
+ if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
return ("Reserved");
}
- else if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
+
+ /* 80 - 83 are per-object-type */
+
+ if (NotifyValue <= 0x83)
{
- return ("Device Specific");
+ switch (Type)
+ {
+ case ACPI_TYPE_ANY:
+ case ACPI_TYPE_DEVICE:
+ return (AcpiGbl_DeviceNotify [NotifyValue - 0x80]);
+
+ case ACPI_TYPE_PROCESSOR:
+ return (AcpiGbl_ProcessorNotify [NotifyValue - 0x80]);
+
+ case ACPI_TYPE_THERMAL:
+ return (AcpiGbl_ThermalNotify [NotifyValue - 0x80]);
+
+ default:
+ return ("Target object type does not support notifies");
+ }
}
- else
+
+ /* 84 - BF are device-specific */
+
+ if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
{
- return ("Hardware Specific");
+ return ("Device-Specific");
}
+
+ /* C0 and above are hardware-specific */
+
+ return ("Hardware-Specific");
}
#endif
diff --git a/sys/contrib/dev/acpica/components/utilities/utdelete.c b/sys/contrib/dev/acpica/components/utilities/utdelete.c
index 6f1f89b..bc9ab70 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTDELETE_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acinterp.h>
@@ -86,6 +84,7 @@ AcpiUtDeleteInternalObj (
ACPI_OPERAND_OBJECT *HandlerDesc;
ACPI_OPERAND_OBJECT *SecondDesc;
ACPI_OPERAND_OBJECT *NextDesc;
+ ACPI_OPERAND_OBJECT *StartDesc;
ACPI_OPERAND_OBJECT **LastObjPtr;
@@ -250,9 +249,10 @@ AcpiUtDeleteInternalObj (
if (HandlerDesc)
{
NextDesc = HandlerDesc->AddressSpace.RegionList;
+ StartDesc = NextDesc;
LastObjPtr = &HandlerDesc->AddressSpace.RegionList;
- /* Remove the region object from the handler's list */
+ /* Remove the region object from the handler list */
while (NextDesc)
{
@@ -262,10 +262,20 @@ AcpiUtDeleteInternalObj (
break;
}
- /* Walk the linked list of handler */
+ /* Walk the linked list of handlers */
LastObjPtr = &NextDesc->Region.Next;
NextDesc = NextDesc->Region.Next;
+
+ /* Prevent infinite loop if list is corrupted */
+
+ if (NextDesc == StartDesc)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Circular region list in address handler object %p",
+ HandlerDesc));
+ return_VOID;
+ }
}
if (HandlerDesc->AddressSpace.HandlerFlags &
diff --git a/sys/contrib/dev/acpica/components/utilities/uterror.c b/sys/contrib/dev/acpica/components/utilities/uterror.c
index b7aef18..35e9ce6 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTERROR_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/uteval.c b/sys/contrib/dev/acpica/components/utilities/uteval.c
index ba4d6ee..b9d63b4 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTEVAL_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utexcep.c b/sys/contrib/dev/acpica/components/utilities/utexcep.c
index d69dbf0..2a38cff 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTEXCEP_C__
+#define EXPORT_ACPI_INTERFACES
#define ACPI_DEFINE_EXCEPTION_TABLE
#include <contrib/dev/acpica/include/acpi.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utfileio.c b/sys/contrib/dev/acpica/components/utilities/utfileio.c
new file mode 100644
index 0000000..bef66f6
--- /dev/null
+++ b/sys/contrib/dev/acpica/components/utilities/utfileio.c
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ *
+ * 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
+ Status = FlCheckForAscii (fp, NULL, FALSE);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf ("File appears to be ASCII only, must be binary\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, "Loading Acpi table from file %10s - Length %.8u (%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 6233a4a..1dfd3e1 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTGLOBAL_C__
+#define EXPORT_ACPI_INTERFACES
#define DEFINE_ACPI_GLOBALS
#include <contrib/dev/acpica/include/acpi.h>
@@ -57,37 +57,7 @@
*
******************************************************************************/
-/*
- * We want the debug switches statically initialized so they
- * are already set when the debugger is entered.
- */
-
-/* Debug switch - level and trace mask */
-
-#ifdef ACPI_DEBUG_OUTPUT
-UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
-#else
-UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
-#endif
-
-/* Debug switch - layer (component) mask */
-
-UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
-UINT32 AcpiGbl_NestingLevel = 0;
-
-/* Debugger globals */
-
-BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
-BOOLEAN AcpiGbl_AbortMethod = FALSE;
-BOOLEAN AcpiGbl_MethodExecuting = FALSE;
-
-/* System flags */
-
-UINT32 AcpiGbl_StartupFlags = 0;
-
-/* System starts uninitialized */
-
-BOOLEAN AcpiGbl_Shutdown = TRUE;
+/* Various state name strings */
const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
{
@@ -202,163 +172,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
};
#endif /* !ACPI_REDUCED_HARDWARE */
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtInitGlobals
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
- * initialization should be initialized here. This allows for
- * a warm restart.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtInitGlobals (
- void)
-{
- ACPI_STATUS Status;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE (UtInitGlobals);
-
-
- /* Create all memory caches */
-
- Status = AcpiUtCreateCaches ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Address Range lists */
-
- for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
- {
- AcpiGbl_AddressRangeList[i] = NULL;
- }
-
- /* Mutex locked flags */
-
- for (i = 0; i < ACPI_NUM_MUTEX; i++)
- {
- AcpiGbl_MutexInfo[i].Mutex = NULL;
- AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_MutexInfo[i].UseCount = 0;
- }
-
- for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
- {
- AcpiGbl_OwnerIdMask[i] = 0;
- }
-
- /* Last OwnerID is never valid */
-
- AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
-
- /* Event counters */
-
- AcpiMethodCount = 0;
- AcpiSciCount = 0;
- AcpiGpeCount = 0;
-
- for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
- {
- AcpiFixedEventCount[i] = 0;
- }
-
-#if (!ACPI_REDUCED_HARDWARE)
-
- /* GPE/SCI support */
-
- AcpiGbl_AllGpesInitialized = FALSE;
- AcpiGbl_GpeXruptListHead = NULL;
- AcpiGbl_GpeFadtBlocks[0] = NULL;
- AcpiGbl_GpeFadtBlocks[1] = NULL;
- AcpiCurrentGpeCount = 0;
-
- AcpiGbl_GlobalEventHandler = NULL;
- AcpiGbl_SciHandlerList = NULL;
-
-#endif /* !ACPI_REDUCED_HARDWARE */
-
- /* Global handlers */
-
- AcpiGbl_GlobalNotify[0].Handler = NULL;
- AcpiGbl_GlobalNotify[1].Handler = NULL;
- AcpiGbl_ExceptionHandler = NULL;
- AcpiGbl_InitHandler = NULL;
- AcpiGbl_TableHandler = NULL;
- AcpiGbl_InterfaceHandler = NULL;
-
- /* Global Lock support */
-
- AcpiGbl_GlobalLockSemaphore = NULL;
- AcpiGbl_GlobalLockMutex = NULL;
- AcpiGbl_GlobalLockAcquired = FALSE;
- AcpiGbl_GlobalLockHandle = 0;
- AcpiGbl_GlobalLockPresent = FALSE;
-
- /* Miscellaneous variables */
-
- AcpiGbl_DSDT = NULL;
- AcpiGbl_CmSingleStep = FALSE;
- AcpiGbl_DbTerminateThreads = FALSE;
- AcpiGbl_Shutdown = FALSE;
- AcpiGbl_NsLookupCount = 0;
- AcpiGbl_PsFindCount = 0;
- AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_LastOwnerIdIndex = 0;
- AcpiGbl_NextOwnerIdOffset = 0;
- AcpiGbl_TraceMethodName = 0;
- AcpiGbl_TraceDbgLevel = 0;
- AcpiGbl_TraceDbgLayer = 0;
- AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
- AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
- AcpiGbl_OsiMutex = NULL;
- AcpiGbl_RegMethodsExecuted = FALSE;
-
- /* Hardware oriented */
-
- AcpiGbl_EventsInitialized = FALSE;
- AcpiGbl_SystemAwakeAndRunning = TRUE;
-
- /* Namespace */
-
- AcpiGbl_ModuleCodeList = NULL;
- AcpiGbl_RootNode = NULL;
- AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
- AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
- AcpiGbl_RootNodeStruct.Parent = NULL;
- AcpiGbl_RootNodeStruct.Child = NULL;
- AcpiGbl_RootNodeStruct.Peer = NULL;
- AcpiGbl_RootNodeStruct.Object = NULL;
-
-
-#ifdef ACPI_DISASSEMBLER
- AcpiGbl_ExternalList = NULL;
- AcpiGbl_NumExternalMethods = 0;
- AcpiGbl_ResolvedExternalMethods = 0;
-#endif
-
-#ifdef ACPI_DEBUG_OUTPUT
- AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
-#endif
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiGbl_DisplayFinalMemStats = FALSE;
- AcpiGbl_DisableMemTracking = FALSE;
-#endif
-
- return_ACPI_STATUS (AE_OK);
-}
-
/* 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
new file mode 100644
index 0000000..3486008
--- /dev/null
+++ b/sys/contrib/dev/acpica/components/utilities/uthex.c
@@ -0,0 +1,111 @@
+/******************************************************************************
+ *
+ * Module Name: uthex -- Hex/ASCII support functions
+ *
+ *****************************************************************************/
+
+/*
+ * 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>
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("uthex")
+
+
+/* Hex to ASCII conversion table */
+
+static char AcpiGbl_HexToAscii[] =
+{
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtHexToAsciiChar
+ *
+ * PARAMETERS: Integer - Contains the hex digit
+ * Position - bit position of the digit within the
+ * integer (multiple of 4)
+ *
+ * RETURN: The converted Ascii character
+ *
+ * DESCRIPTION: Convert a hex digit to an Ascii character
+ *
+ ******************************************************************************/
+
+char
+AcpiUtHexToAsciiChar (
+ UINT64 Integer,
+ UINT32 Position)
+{
+
+ return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtHexCharToValue
+ *
+ * PARAMETERS: AsciiChar - Hex character in Ascii
+ *
+ * RETURN: The binary value of the ascii/hex character
+ *
+ * DESCRIPTION: Perform ascii-to-hex translation
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiUtAsciiCharToHex (
+ int HexChar)
+{
+
+ if (HexChar <= 0x39)
+ {
+ return ((UINT8) (HexChar - 0x30));
+ }
+
+ if (HexChar <= 0x46)
+ {
+ return ((UINT8) (HexChar - 0x37));
+ }
+
+ return ((UINT8) (HexChar - 0x57));
+}
diff --git a/sys/contrib/dev/acpica/components/utilities/utids.c b/sys/contrib/dev/acpica/components/utilities/utids.c
index b001767..7d31429 100644
--- a/sys/contrib/dev/acpica/components/utilities/utids.c
+++ b/sys/contrib/dev/acpica/components/utilities/utids.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTIDS_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acinterp.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c
index 760d789..fd7fba2 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTINIT_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -116,6 +113,162 @@ AcpiUtFreeGpeLists (
#endif /* !ACPI_REDUCED_HARDWARE */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtInitGlobals
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
+ * initialization should be initialized here. This allows for
+ * a warm restart.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtInitGlobals (
+ void)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE (UtInitGlobals);
+
+
+ /* Create all memory caches */
+
+ Status = AcpiUtCreateCaches ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Address Range lists */
+
+ for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
+ {
+ AcpiGbl_AddressRangeList[i] = NULL;
+ }
+
+ /* Mutex locked flags */
+
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
+ {
+ AcpiGbl_MutexInfo[i].Mutex = NULL;
+ AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].UseCount = 0;
+ }
+
+ for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
+ {
+ AcpiGbl_OwnerIdMask[i] = 0;
+ }
+
+ /* Last OwnerID is never valid */
+
+ AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
+
+ /* Event counters */
+
+ AcpiMethodCount = 0;
+ AcpiSciCount = 0;
+ AcpiGpeCount = 0;
+
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ AcpiFixedEventCount[i] = 0;
+ }
+
+#if (!ACPI_REDUCED_HARDWARE)
+
+ /* GPE/SCI support */
+
+ AcpiGbl_AllGpesInitialized = FALSE;
+ AcpiGbl_GpeXruptListHead = NULL;
+ AcpiGbl_GpeFadtBlocks[0] = NULL;
+ AcpiGbl_GpeFadtBlocks[1] = NULL;
+ AcpiCurrentGpeCount = 0;
+
+ AcpiGbl_GlobalEventHandler = NULL;
+ AcpiGbl_SciHandlerList = NULL;
+
+#endif /* !ACPI_REDUCED_HARDWARE */
+
+ /* Global handlers */
+
+ AcpiGbl_GlobalNotify[0].Handler = NULL;
+ AcpiGbl_GlobalNotify[1].Handler = NULL;
+ AcpiGbl_ExceptionHandler = NULL;
+ AcpiGbl_InitHandler = NULL;
+ AcpiGbl_TableHandler = NULL;
+ AcpiGbl_InterfaceHandler = NULL;
+
+ /* Global Lock support */
+
+ AcpiGbl_GlobalLockSemaphore = NULL;
+ AcpiGbl_GlobalLockMutex = NULL;
+ AcpiGbl_GlobalLockAcquired = FALSE;
+ AcpiGbl_GlobalLockHandle = 0;
+ AcpiGbl_GlobalLockPresent = FALSE;
+
+ /* Miscellaneous variables */
+
+ AcpiGbl_DSDT = NULL;
+ AcpiGbl_CmSingleStep = FALSE;
+ AcpiGbl_Shutdown = FALSE;
+ AcpiGbl_NsLookupCount = 0;
+ AcpiGbl_PsFindCount = 0;
+ 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;
+
+ /* Hardware oriented */
+
+ AcpiGbl_EventsInitialized = FALSE;
+ AcpiGbl_SystemAwakeAndRunning = TRUE;
+
+ /* Namespace */
+
+ AcpiGbl_ModuleCodeList = NULL;
+ AcpiGbl_RootNode = NULL;
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Parent = NULL;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+
+
+#ifdef ACPI_DISASSEMBLER
+ AcpiGbl_ExternalList = NULL;
+ AcpiGbl_NumExternalMethods = 0;
+ AcpiGbl_ResolvedExternalMethods = 0;
+#endif
+
+#ifdef ACPI_DEBUG_OUTPUT
+ AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);
+#endif
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiGbl_DisplayFinalMemStats = FALSE;
+ AcpiGbl_DisableMemTracking = FALSE;
+#endif
+
+ ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE);
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiUtTerminate
diff --git a/sys/contrib/dev/acpica/components/utilities/utlock.c b/sys/contrib/dev/acpica/components/utilities/utlock.c
index da933c2..3903e99 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTLOCK_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utmath.c b/sys/contrib/dev/acpica/components/utilities/utmath.c
index b535ffc..ce11f39 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTMATH_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c
index 6ff6b2a..d5d81ca 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTMISC_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utmutex.c b/sys/contrib/dev/acpica/components/utilities/utmutex.c
index 260f2b5..c7b162b 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTMUTEX_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utobject.c b/sys/contrib/dev/acpica/components/utilities/utobject.c
index 46c3514..4c80c40 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTOBJECT_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -400,7 +398,7 @@ AcpiUtValidInternalObject (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "%p is not not an ACPI operand obj [%s]\n",
+ "%p is not an ACPI operand obj [%s]\n",
Object, AcpiUtGetDescriptorName (Object)));
break;
}
diff --git a/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c
index 9cf5765..6b225ca 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTOSI_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -50,6 +48,34 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utosi")
+
+/******************************************************************************
+ *
+ * ACPICA policy for new _OSI strings:
+ *
+ * It is the stated policy of ACPICA that new _OSI strings will be integrated
+ * into this module as soon as possible after they are defined. It is strongly
+ * recommended that all ACPICA hosts mirror this policy and integrate any
+ * changes to this module as soon as possible. There are several historical
+ * reasons behind this policy:
+ *
+ * 1) New BIOSs tend to test only the case where the host responds TRUE to
+ * the latest version of Windows, which would respond to the latest/newest
+ * _OSI string. Not responding TRUE to the latest version of Windows will
+ * risk executing untested code paths throughout the DSDT and SSDTs.
+ *
+ * 2) If a new _OSI string is recognized only after a significant delay, this
+ * has the potential to cause problems on existing working machines because
+ * of the possibility that a new and different path through the ASL code
+ * will be executed.
+ *
+ * 3) New _OSI strings are tending to come out about once per year. A delay
+ * in recognizing a new string for a significant amount of time risks the
+ * release of another string which only compounds the initial problem.
+ *
+ *****************************************************************************/
+
+
/*
* Strings supported by the _OSI predefined control method (which is
* implemented internally within this module.)
@@ -78,6 +104,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
{"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
{"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
{"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
+ {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
/* Feature Group Strings */
diff --git a/sys/contrib/dev/acpica/components/utilities/utownerid.c b/sys/contrib/dev/acpica/components/utilities/utownerid.c
index 74f4d83..34c0024 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTOWNERID_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utpredef.c b/sys/contrib/dev/acpica/components/utilities/utpredef.c
index 8864120..a445f85 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTPREDEF_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acpredef.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utprint.c b/sys/contrib/dev/acpica/components/utilities/utprint.c
new file mode 100644
index 0000000..d870ad4
--- /dev/null
+++ b/sys/contrib/dev/acpica/components/utilities/utprint.c
@@ -0,0 +1,811 @@
+/******************************************************************************
+ *
+ * Module Name: utprint - Formatted printing 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>
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utprint")
+
+
+#define ACPI_FORMAT_SIGN 0x01
+#define ACPI_FORMAT_SIGN_PLUS 0x02
+#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04
+#define ACPI_FORMAT_ZERO 0x08
+#define ACPI_FORMAT_LEFT 0x10
+#define ACPI_FORMAT_UPPER 0x20
+#define ACPI_FORMAT_PREFIX 0x40
+
+
+/* Local prototypes */
+
+static ACPI_SIZE
+AcpiUtBoundStringLength (
+ const char *String,
+ ACPI_SIZE Count);
+
+static char *
+AcpiUtBoundStringOutput (
+ char *String,
+ const char *End,
+ char c);
+
+static char *
+AcpiUtFormatNumber (
+ char *String,
+ char *End,
+ UINT64 Number,
+ UINT8 Base,
+ INT32 Width,
+ INT32 Precision,
+ UINT8 Type);
+
+static char *
+AcpiUtPutNumber (
+ char *String,
+ UINT64 Number,
+ UINT8 Base,
+ BOOLEAN Upper);
+
+
+/* Module globals */
+
+static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef";
+static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF";
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtBoundStringLength
+ *
+ * PARAMETERS: String - String with boundary
+ * Count - Boundary of the string
+ *
+ * RETURN: Length of the string. Less than or equal to Count.
+ *
+ * DESCRIPTION: Calculate the length of a string with boundary.
+ *
+ ******************************************************************************/
+
+static ACPI_SIZE
+AcpiUtBoundStringLength (
+ const char *String,
+ ACPI_SIZE Count)
+{
+ UINT32 Length = 0;
+
+
+ while (*String && Count)
+ {
+ Length++;
+ String++;
+ Count--;
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtBoundStringOutput
+ *
+ * PARAMETERS: String - String with boundary
+ * End - Boundary of the string
+ * c - Character to be output to the string
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Output a character into a string with boundary check.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtBoundStringOutput (
+ char *String,
+ const char *End,
+ char c)
+{
+
+ if (String < End)
+ {
+ *String = c;
+ }
+
+ ++String;
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPutNumber
+ *
+ * PARAMETERS: String - Buffer to hold reverse-ordered string
+ * Number - Integer to be converted
+ * Base - Base of the integer
+ * Upper - Whether or not using upper cased digits
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Convert an integer into a string, note that, the string holds a
+ * reversed ordered number without the trailing zero.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtPutNumber (
+ char *String,
+ UINT64 Number,
+ UINT8 Base,
+ BOOLEAN Upper)
+{
+ const char *Digits;
+ UINT64 DigitIndex;
+ char *Pos;
+
+
+ Pos = String;
+ Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits;
+
+ if (Number == 0)
+ {
+ *(Pos++) = '0';
+ }
+ else
+ {
+ while (Number)
+ {
+ (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex);
+ *(Pos++) = Digits[DigitIndex];
+ }
+ }
+
+ /* *(Pos++) = '0'; */
+ return (Pos);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtScanNumber
+ *
+ * PARAMETERS: String - String buffer
+ * NumberPtr - Where the number is returned
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Scan a string for a decimal integer.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtScanNumber (
+ const char *String,
+ UINT64 *NumberPtr)
+{
+ UINT64 Number = 0;
+
+
+ while (ACPI_IS_DIGIT (*String))
+ {
+ Number *= 10;
+ Number += *(String++) - '0';
+ }
+
+ *NumberPtr = Number;
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPrintNumber
+ *
+ * PARAMETERS: String - String buffer
+ * Number - The number to be converted
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Print a decimal integer into a string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtPrintNumber (
+ char *String,
+ UINT64 Number)
+{
+ char AsciiString[20];
+ const char *Pos1;
+ char *Pos2;
+
+
+ Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE);
+ Pos2 = String;
+
+ while (Pos1 != AsciiString)
+ {
+ *(Pos2++) = *(--Pos1);
+ }
+
+ *Pos2 = 0;
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFormatNumber
+ *
+ * PARAMETERS: String - String buffer with boundary
+ * End - Boundary of the string
+ * Number - The number to be converted
+ * Base - Base of the integer
+ * Width - Field width
+ * Precision - Precision of the integer
+ * Type - Special printing flags
+ *
+ * RETURN: Updated position for next valid character
+ *
+ * DESCRIPTION: Print an integer into a string with any base and any precision.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiUtFormatNumber (
+ char *String,
+ char *End,
+ UINT64 Number,
+ UINT8 Base,
+ INT32 Width,
+ INT32 Precision,
+ UINT8 Type)
+{
+ char *Pos;
+ char Sign;
+ char Zero;
+ BOOLEAN NeedPrefix;
+ BOOLEAN Upper;
+ INT32 i;
+ char ReversedString[66];
+
+
+ /* Parameter validation */
+
+ if (Base < 2 || Base > 16)
+ {
+ return (NULL);
+ }
+
+ if (Type & ACPI_FORMAT_LEFT)
+ {
+ Type &= ~ACPI_FORMAT_ZERO;
+ }
+
+ NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE;
+ Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE;
+ Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' ';
+
+ /* Calculate size according to sign and prefix */
+
+ Sign = '\0';
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ if ((INT64) Number < 0)
+ {
+ Sign = '-';
+ Number = - (INT64) Number;
+ Width--;
+ }
+ else if (Type & ACPI_FORMAT_SIGN_PLUS)
+ {
+ Sign = '+';
+ Width--;
+ }
+ else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE)
+ {
+ Sign = ' ';
+ Width--;
+ }
+ }
+ if (NeedPrefix)
+ {
+ Width--;
+ if (Base == 16)
+ {
+ Width--;
+ }
+ }
+
+ /* Generate full string in reverse order */
+
+ Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper);
+ i = ACPI_PTR_DIFF (Pos, ReversedString);
+
+ /* Printing 100 using %2d gives "100", not "00" */
+
+ if (i > Precision)
+ {
+ Precision = i;
+ }
+
+ Width -= Precision;
+
+ /* Output the string */
+
+ if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT)))
+ {
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, ' ');
+ }
+ }
+ if (Sign)
+ {
+ String = AcpiUtBoundStringOutput (String, End, Sign);
+ }
+ if (NeedPrefix)
+ {
+ String = AcpiUtBoundStringOutput (String, End, '0');
+ if (Base == 16)
+ {
+ String = AcpiUtBoundStringOutput (String, End,
+ Upper ? 'X' : 'x');
+ }
+ }
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, Zero);
+ }
+ }
+
+ while (i <= --Precision)
+ {
+ String = AcpiUtBoundStringOutput (String, End, '0');
+ }
+ while (--i >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End,
+ ReversedString[i]);
+ }
+ while (--Width >= 0)
+ {
+ String = AcpiUtBoundStringOutput (String, End, ' ');
+ }
+
+ return (String);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtVsnprintf
+ *
+ * PARAMETERS: String - String with boundary
+ * Size - Boundary of the string
+ * Format - Standard printf format
+ * Args - Argument list
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to a string using argument list pointer.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtVsnprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ va_list Args)
+{
+ UINT8 Base = 10;
+ UINT8 Type = 0;
+ INT32 Width = -1;
+ INT32 Precision = -1;
+ char Qualifier = 0;
+ UINT64 Number;
+ char *Pos;
+ char *End;
+ char c;
+ const char *s;
+ const void *p;
+ INT32 Length;
+ int i;
+
+
+ Pos = String;
+ End = String + Size;
+
+ for (; *Format; ++Format)
+ {
+ if (*Format != '%')
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *Format);
+ continue;
+ }
+
+ /* Process sign */
+
+ do
+ {
+ ++Format;
+ if (*Format == '#')
+ {
+ Type |= ACPI_FORMAT_PREFIX;
+ }
+ else if (*Format == '0')
+ {
+ Type |= ACPI_FORMAT_ZERO;
+ }
+ else if (*Format == '+')
+ {
+ Type |= ACPI_FORMAT_SIGN_PLUS;
+ }
+ else if (*Format == ' ')
+ {
+ Type |= ACPI_FORMAT_SIGN_PLUS_SPACE;
+ }
+ else if (*Format == '-')
+ {
+ Type |= ACPI_FORMAT_LEFT;
+ }
+ else
+ {
+ break;
+ }
+ } while (1);
+
+ /* Process width */
+
+ Width = -1;
+ if (ACPI_IS_DIGIT (*Format))
+ {
+ Format = AcpiUtScanNumber (Format, &Number);
+ Width = (INT32) Number;
+ }
+ else if (*Format == '*')
+ {
+ ++Format;
+ Width = va_arg (Args, int);
+ if (Width < 0)
+ {
+ Width = -Width;
+ Type |= ACPI_FORMAT_LEFT;
+ }
+ }
+
+ /* Process precision */
+
+ Precision = -1;
+ if (*Format == '.')
+ {
+ ++Format;
+ if (ACPI_IS_DIGIT(*Format))
+ {
+ Format = AcpiUtScanNumber (Format, &Number);
+ Precision = (INT32) Number;
+ }
+ else if (*Format == '*')
+ {
+ ++Format;
+ Precision = va_arg (Args, int);
+ }
+ if (Precision < 0)
+ {
+ Precision = 0;
+ }
+ }
+
+ /* Process qualifier */
+
+ Qualifier = -1;
+ if (*Format == 'h' || *Format == 'l' || *Format == 'L')
+ {
+ Qualifier = *Format;
+ ++Format;
+
+ if (Qualifier == 'l' && *Format == 'l')
+ {
+ Qualifier = 'L';
+ ++Format;
+ }
+ }
+
+ switch (*Format)
+ {
+ case '%':
+
+ Pos = AcpiUtBoundStringOutput (Pos, End, '%');
+ continue;
+
+ case 'c':
+
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (--Width > 0)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ }
+
+ c = (char) va_arg (Args, int);
+ Pos = AcpiUtBoundStringOutput (Pos, End, c);
+
+ while (--Width > 0)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ continue;
+
+ case 's':
+
+ s = va_arg (Args, char *);
+ if (!s)
+ {
+ s = "<NULL>";
+ }
+ Length = AcpiUtBoundStringLength (s, Precision);
+ if (!(Type & ACPI_FORMAT_LEFT))
+ {
+ while (Length < Width--)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ }
+ for (i = 0; i < Length; ++i)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *s);
+ ++s;
+ }
+ while (Length < Width--)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, ' ');
+ }
+ continue;
+
+ case 'o':
+
+ Base = 8;
+ break;
+
+ case 'X':
+
+ Type |= ACPI_FORMAT_UPPER;
+
+ case 'x':
+
+ Base = 16;
+ break;
+
+ case 'd':
+ case 'i':
+
+ Type |= ACPI_FORMAT_SIGN;
+
+ case 'u':
+
+ break;
+
+ case 'p':
+
+ if (Width == -1)
+ {
+ Width = 2 * sizeof (void *);
+ Type |= ACPI_FORMAT_ZERO;
+ }
+
+ p = va_arg (Args, void *);
+ Pos = AcpiUtFormatNumber (Pos, End,
+ ACPI_TO_INTEGER (p), 16, Width, Precision, Type);
+ continue;
+
+ default:
+
+ Pos = AcpiUtBoundStringOutput (Pos, End, '%');
+ if (*Format)
+ {
+ Pos = AcpiUtBoundStringOutput (Pos, End, *Format);
+ }
+ else
+ {
+ --Format;
+ }
+ continue;
+ }
+
+ if (Qualifier == 'L')
+ {
+ Number = va_arg (Args, UINT64);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT64) Number;
+ }
+ }
+ else if (Qualifier == 'l')
+ {
+ Number = va_arg (Args, unsigned long);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT32) Number;
+ }
+ }
+ else if (Qualifier == 'h')
+ {
+ Number = (UINT16) va_arg (Args, int);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (INT16) Number;
+ }
+ }
+ else
+ {
+ Number = va_arg (Args, unsigned int);
+ if (Type & ACPI_FORMAT_SIGN)
+ {
+ Number = (signed int) Number;
+ }
+ }
+
+ Pos = AcpiUtFormatNumber (Pos, End, Number, Base,
+ Width, Precision, Type);
+ }
+
+ if (Size > 0)
+ {
+ if (Pos < End)
+ {
+ *Pos = '\0';
+ }
+ else
+ {
+ End[-1] = '\0';
+ }
+ }
+
+ return (ACPI_PTR_DIFF (Pos, String));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSnprintf
+ *
+ * PARAMETERS: String - String with boundary
+ * Size - Boundary of the string
+ * Format, ... - Standard printf format
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to a string.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtSnprintf (
+ char *String,
+ ACPI_SIZE Size,
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = AcpiUtVsnprintf (String, Size, Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+
+
+#ifdef ACPI_APPLICATION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFileVprintf
+ *
+ * PARAMETERS: File - File descriptor
+ * Format - Standard printf format
+ * Args - Argument list
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to a file using argument list pointer.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtFileVprintf (
+ ACPI_FILE File,
+ const char *Format,
+ va_list Args)
+{
+ ACPI_CPU_FLAGS Flags;
+ int Length;
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock);
+ Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer,
+ sizeof (AcpiGbl_PrintBuffer), Format, Args);
+
+ (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1);
+ AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags);
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFilePrintf
+ *
+ * PARAMETERS: File - File descriptor
+ * Format, ... - Standard printf format
+ *
+ * RETURN: Number of bytes actually written.
+ *
+ * DESCRIPTION: Formatted output to a file.
+ *
+ ******************************************************************************/
+
+int
+AcpiUtFilePrintf (
+ ACPI_FILE File,
+ const char *Format,
+ ...)
+{
+ va_list Args;
+ int Length;
+
+
+ va_start (Args, Format);
+ Length = AcpiUtFileVprintf (File, Format, Args);
+ va_end (Args);
+
+ return (Length);
+}
+#endif
diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c
index 3a47a0c..65b23f1 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTRESRC_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acresrc.h>
@@ -53,7 +50,7 @@
ACPI_MODULE_NAME ("utresrc")
-#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
+#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
/*
* Strings used to decode resource descriptors.
@@ -100,7 +97,9 @@ const char *AcpiGbl_IoDecode[] =
const char *AcpiGbl_LlDecode[] =
{
"ActiveHigh",
- "ActiveLow"
+ "ActiveLow",
+ "ActiveBoth",
+ "Reserved"
};
const char *AcpiGbl_MaxDecode[] =
@@ -299,7 +298,7 @@ const char *AcpiGbl_BpbDecode[] =
const char *AcpiGbl_SbDecode[] =
{
- "StopBitsNone",
+ "StopBitsZero",
"StopBitsOne",
"StopBitsOnePlusHalf",
"StopBitsTwo"
diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c
index e0e5cce..d90d694 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTSTATE_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
diff --git a/sys/contrib/dev/acpica/components/utilities/utstring.c b/sys/contrib/dev/acpica/components/utilities/utstring.c
index 79b5452..4cbf435 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,9 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTSTRING_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
@@ -420,7 +417,7 @@ AcpiUtPrintString (
}
AcpiOsPrintf ("\"");
- for (i = 0; String[i] && (i < MaxLength); i++)
+ for (i = 0; (i < MaxLength) && String[i]; i++)
{
/* Escape sequences */
@@ -685,3 +682,81 @@ 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 5c381f0..5f208b5 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,8 +52,6 @@
* occurs in the body of AcpiUtFree.
*/
-#define __UTTRACK_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -151,10 +149,23 @@ AcpiUtAllocateAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
+ /* Report allocation error */
+
+ ACPI_WARNING ((Module, Line,
+ "Could not allocate size %u", (UINT32) Size));
+
return (NULL);
}
@@ -204,8 +215,16 @@ AcpiUtAllocateZeroedAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
/* Report allocation error */
@@ -286,7 +305,8 @@ AcpiUtFreeAndTrack (
}
AcpiOsFree (DebugBlock);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n",
+ Allocation, DebugBlock));
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/components/utilities/utuuid.c b/sys/contrib/dev/acpica/components/utilities/utuuid.c
new file mode 100644
index 0000000..8b3cb99
--- /dev/null
+++ b/sys/contrib/dev/acpica/components/utilities/utuuid.c
@@ -0,0 +1,101 @@
+/******************************************************************************
+ *
+ * Module Name: utuuid -- UUID support functions
+ *
+ *****************************************************************************/
+
+/*
+ * 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>
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("utuuid")
+
+
+/*
+ * UUID support functions.
+ *
+ * This table is used to convert an input UUID ascii string to a 16 byte
+ * buffer and the reverse. The table maps a UUID buffer index 0-15 to
+ * the index within the 36-byte UUID string where the associated 2-byte
+ * hex value can be found.
+ *
+ * 36-byte UUID strings are of the form:
+ * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
+ * Where aa-pp are one byte hex numbers, made up of two hex digits
+ *
+ * Note: This table is basically the inverse of the string-to-offset table
+ * found in the ACPI spec in the description of the ToUUID macro.
+ */
+const UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH] =
+{
+ 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtConvertStringToUuid
+ *
+ * PARAMETERS: InString - 36-byte formatted UUID string
+ * UuidBuffer - Where the 16-byte UUID buffer is returned
+ *
+ * RETURN: None. Output data is returned in the UuidBuffer
+ *
+ * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer
+ *
+ ******************************************************************************/
+
+void
+AcpiUtConvertStringToUuid (
+ char *InString,
+ UINT8 *UuidBuffer)
+{
+ UINT32 i;
+
+
+ for (i = 0; i < UUID_BUFFER_LENGTH; i++)
+ {
+ UuidBuffer[i] =
+ (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4);
+
+ UuidBuffer[i] |=
+ AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]);
+ }
+}
diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c
index b6003e6..aab7473 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -114,7 +113,7 @@ AcpiTerminate (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiTerminate)
+ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate)
#ifndef ACPI_ASL_COMPILER
@@ -621,7 +620,9 @@ AcpiDecodePldBuffer (
ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]);
PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword);
PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword);
- PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword);
+ PldInfo->Red = ACPI_PLD_GET_RED (&Dword);
+ PldInfo->Green = ACPI_PLD_GET_GREEN (&Dword);
+ PldInfo->Blue = ACPI_PLD_GET_BLUE (&Dword);
/* Second 32-bit DWord */
diff --git a/sys/contrib/dev/acpica/components/utilities/utxferror.c b/sys/contrib/dev/acpica/components/utilities/utxferror.c
index 8f11b29..89fc516 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTXFERROR_C__
+#define EXPORT_ACPI_INTERFACES
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -55,6 +55,8 @@
* tools/applications.
*/
+#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
+
/*******************************************************************************
*
* FUNCTION: AcpiError
@@ -294,3 +296,5 @@ AcpiBiosWarning (
}
ACPI_EXPORT_SYMBOL (AcpiBiosWarning)
+
+#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/sys/contrib/dev/acpica/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/components/utilities/utxfinit.c
index c828a71..36107ca 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
-#define __UTXFINIT_C__
+#define EXPORT_ACPI_INTERFACES
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@@ -54,6 +53,11 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utxfinit")
+/* For AcpiExec only */
+void
+AeDoObjectOverrides (
+ void);
+
/*******************************************************************************
*
@@ -130,11 +134,19 @@ AcpiInitializeSubsystem (
/* If configured, initialize the AML debugger */
- ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
- return_ACPI_STATUS (Status);
+#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);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem)
/*******************************************************************************
@@ -256,7 +268,7 @@ AcpiEnableSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
/*******************************************************************************
@@ -301,6 +313,14 @@ AcpiInitializeObjects (
}
}
+#ifdef ACPI_EXEC_APP
+ /*
+ * This call implements the "initialization file" option for AcpiExec.
+ * This is the precise point that we want to perform the overrides.
+ */
+ AeDoObjectOverrides ();
+#endif
+
/*
* Execute any module-level code that was detected during the table load
* phase. Although illegal since ACPI 2.0, there are many machines that
@@ -355,4 +375,4 @@ AcpiInitializeObjects (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects)
diff --git a/sys/contrib/dev/acpica/components/utilities/utxfmutex.c b/sys/contrib/dev/acpica/components/utilities/utxfmutex.c
index ae5a345..559f4b4 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 - 2013, Intel Corp.
+ * Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#define __UTXFMUTEX_C__
-
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
OpenPOWER on IntegriCloud