summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/utilities
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-10-23 23:49:17 +0000
committerjkim <jkim@FreeBSD.org>2012-10-23 23:49:17 +0000
commit3cd17672a6995202a6cf5fcbe3bdcb92b585d312 (patch)
treec76815c27a7a82ff262a7eafa3ab31e3365416e4 /sys/contrib/dev/acpica/components/utilities
parent1824541d84ee1badda929686d3129e80c95632c6 (diff)
downloadFreeBSD-src-3cd17672a6995202a6cf5fcbe3bdcb92b585d312.zip
FreeBSD-src-3cd17672a6995202a6cf5fcbe3bdcb92b585d312.tar.gz
Merge ACPICA 20121018.
Diffstat (limited to 'sys/contrib/dev/acpica/components/utilities')
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utalloc.c1
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utcache.c8
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utcopy.c2
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdebug.c42
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdelete.c2
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utids.c106
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utinit.c2
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utlock.c1
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmath.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmisc.c23
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utmutex.c17
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utobject.c10
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utresrc.c2
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utstate.c4
-rw-r--r--sys/contrib/dev/acpica/components/utilities/uttrack.c113
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxface.c6
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utxferror.c2
17 files changed, 223 insertions, 122 deletions
diff --git a/sys/contrib/dev/acpica/components/utilities/utalloc.c b/sys/contrib/dev/acpica/components/utilities/utalloc.c
index 5e41bbd..0ea15af 100644
--- a/sys/contrib/dev/acpica/components/utilities/utalloc.c
+++ b/sys/contrib/dev/acpica/components/utilities/utalloc.c
@@ -413,4 +413,3 @@ AcpiUtAllocateZeroed (
return (Allocation);
}
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utcache.c b/sys/contrib/dev/acpica/components/utilities/utcache.c
index b8efa68..e21cb48 100644
--- a/sys/contrib/dev/acpica/components/utilities/utcache.c
+++ b/sys/contrib/dev/acpica/components/utilities/utcache.c
@@ -205,7 +205,7 @@ AcpiOsDeleteCache (
*
* RETURN: None
*
- * DESCRIPTION: Release an object to the specified cache. If cache is full,
+ * DESCRIPTION: Release an object to the specified cache. If cache is full,
* the object is deleted.
*
******************************************************************************/
@@ -269,9 +269,9 @@ AcpiOsReleaseObject (
*
* PARAMETERS: Cache - Handle to cache object
*
- * RETURN: the acquired object. NULL on error
+ * RETURN: the acquired object. NULL on error
*
- * DESCRIPTION: Get an object from the specified cache. If cache is empty,
+ * DESCRIPTION: Get an object from the specified cache. If cache is empty,
* the object is allocated.
*
******************************************************************************/
@@ -357,5 +357,3 @@ AcpiOsAcquireObject (
return (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 f145c57..dd8de9e 100644
--- a/sys/contrib/dev/acpica/components/utilities/utcopy.c
+++ b/sys/contrib/dev/acpica/components/utilities/utcopy.c
@@ -1074,5 +1074,3 @@ AcpiUtCopyIobjectToIobject (
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 ade7dfe..5834c0f 100644
--- a/sys/contrib/dev/acpica/components/utilities/utdebug.c
+++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c
@@ -250,7 +250,7 @@ ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
*
* RETURN: None
*
- * DESCRIPTION: Print message with no headers. Has same interface as
+ * DESCRIPTION: Print message with no headers. Has same interface as
* DebugPrint so that the same macros can be used.
*
******************************************************************************/
@@ -293,7 +293,7 @@ ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
*
* RETURN: None
*
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
******************************************************************************/
@@ -329,7 +329,7 @@ ACPI_EXPORT_SYMBOL (AcpiUtTrace)
*
* RETURN: None
*
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
******************************************************************************/
@@ -342,6 +342,7 @@ AcpiUtTracePtr (
UINT32 ComponentId,
void *Pointer)
{
+
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
@@ -363,7 +364,7 @@ AcpiUtTracePtr (
*
* RETURN: None
*
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
******************************************************************************/
@@ -398,7 +399,7 @@ AcpiUtTraceStr (
*
* RETURN: None
*
- * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
******************************************************************************/
@@ -432,7 +433,7 @@ AcpiUtTraceU32 (
*
* RETURN: None
*
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
******************************************************************************/
@@ -467,8 +468,8 @@ ACPI_EXPORT_SYMBOL (AcpiUtExit)
*
* RETURN: None
*
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in DebugLevel. Prints exit status also.
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit status also.
*
******************************************************************************/
@@ -514,8 +515,8 @@ ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
*
* RETURN: None
*
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in DebugLevel. Prints exit value also.
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit value also.
*
******************************************************************************/
@@ -551,8 +552,8 @@ ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
*
* RETURN: None
*
- * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
- * set in DebugLevel. Prints exit value also.
+ * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
+ * set in DebugLevel. Prints exit value also.
*
******************************************************************************/
@@ -582,7 +583,7 @@ AcpiUtPtrExit (
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display
- * ComponentID - Caller's component ID
+ * Offset - Beginning buffer offset (display only)
*
* RETURN: None
*
@@ -591,10 +592,11 @@ AcpiUtPtrExit (
******************************************************************************/
void
-AcpiUtDumpBuffer2 (
+AcpiUtDumpBuffer (
UINT8 *Buffer,
UINT32 Count,
- UINT32 Display)
+ UINT32 Display,
+ UINT32 BaseOffset)
{
UINT32 i = 0;
UINT32 j;
@@ -619,7 +621,7 @@ AcpiUtDumpBuffer2 (
{
/* Print current offset */
- AcpiOsPrintf ("%6.4X: ", i);
+ AcpiOsPrintf ("%6.4X: ", (BaseOffset + i));
/* Print 16 hex chars */
@@ -706,7 +708,7 @@ AcpiUtDumpBuffer2 (
/*******************************************************************************
*
- * FUNCTION: AcpiUtDumpBuffer
+ * FUNCTION: AcpiUtDebugDumpBuffer
*
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
@@ -720,7 +722,7 @@ AcpiUtDumpBuffer2 (
******************************************************************************/
void
-AcpiUtDumpBuffer (
+AcpiUtDebugDumpBuffer (
UINT8 *Buffer,
UINT32 Count,
UINT32 Display,
@@ -735,7 +737,5 @@ AcpiUtDumpBuffer (
return;
}
- AcpiUtDumpBuffer2 (Buffer, Count, Display);
+ AcpiUtDumpBuffer (Buffer, Count, Display, 0);
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utdelete.c b/sys/contrib/dev/acpica/components/utilities/utdelete.c
index 9b3b7d3..4a5e6ecf 100644
--- a/sys/contrib/dev/acpica/components/utilities/utdelete.c
+++ b/sys/contrib/dev/acpica/components/utilities/utdelete.c
@@ -773,5 +773,3 @@ AcpiUtRemoveReference (
(void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
return_VOID;
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utids.c b/sys/contrib/dev/acpica/components/utilities/utids.c
index 5d5c8d3..17ad5ed 100644
--- a/sys/contrib/dev/acpica/components/utilities/utids.c
+++ b/sys/contrib/dev/acpica/components/utilities/utids.c
@@ -73,10 +73,10 @@
ACPI_STATUS
AcpiUtExecute_HID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID **ReturnId)
+ ACPI_PNP_DEVICE_ID **ReturnId)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_DEVICE_ID *Hid;
+ ACPI_PNP_DEVICE_ID *Hid;
UINT32 Length;
ACPI_STATUS Status;
@@ -104,16 +104,16 @@ AcpiUtExecute_HID (
/* Allocate a buffer for the HID */
- Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length);
+ Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length);
if (!Hid)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
- /* Area for the string starts after DEVICE_ID struct */
+ /* Area for the string starts after PNP_DEVICE_ID struct */
- Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_DEVICE_ID));
+ Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_PNP_DEVICE_ID));
/* Convert EISAID to a string or simply copy existing string */
@@ -141,6 +141,77 @@ Cleanup:
/*******************************************************************************
*
+ * FUNCTION: AcpiUtExecute_SUB
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * ReturnId - Where the _SUB is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _SUB control method that returns the subsystem
+ * ID of the device. The _SUB value is always a string containing
+ * either a valid PNP or ACPI ID.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_SUB (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_PNP_DEVICE_ID **ReturnId)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_PNP_DEVICE_ID *Sub;
+ UINT32 Length;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (UtExecute_SUB);
+
+
+ Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__SUB,
+ ACPI_BTYPE_STRING, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the size of the String to be returned, includes null terminator */
+
+ Length = ObjDesc->String.Length + 1;
+
+ /* Allocate a buffer for the SUB */
+
+ Sub = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length);
+ if (!Sub)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Area for the string starts after PNP_DEVICE_ID struct */
+
+ Sub->String = ACPI_ADD_PTR (char, Sub, sizeof (ACPI_PNP_DEVICE_ID));
+
+ /* Simply copy existing string */
+
+ ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer);
+ Sub->Length = Length;
+ *ReturnId = Sub;
+
+
+Cleanup:
+
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtExecute_UID
*
* PARAMETERS: DeviceNode - Node for the device
@@ -160,10 +231,10 @@ Cleanup:
ACPI_STATUS
AcpiUtExecute_UID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID **ReturnId)
+ ACPI_PNP_DEVICE_ID **ReturnId)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_DEVICE_ID *Uid;
+ ACPI_PNP_DEVICE_ID *Uid;
UINT32 Length;
ACPI_STATUS Status;
@@ -191,16 +262,16 @@ AcpiUtExecute_UID (
/* Allocate a buffer for the UID */
- Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length);
+ Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length);
if (!Uid)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
- /* Area for the string starts after DEVICE_ID struct */
+ /* Area for the string starts after PNP_DEVICE_ID struct */
- Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_DEVICE_ID));
+ Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_PNP_DEVICE_ID));
/* Convert an Integer to string, or just copy an existing string */
@@ -252,11 +323,11 @@ Cleanup:
ACPI_STATUS
AcpiUtExecute_CID (
ACPI_NAMESPACE_NODE *DeviceNode,
- ACPI_DEVICE_ID_LIST **ReturnCidList)
+ ACPI_PNP_DEVICE_ID_LIST **ReturnCidList)
{
ACPI_OPERAND_OBJECT **CidObjects;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_DEVICE_ID_LIST *CidList;
+ ACPI_PNP_DEVICE_ID_LIST *CidList;
char *NextIdString;
UINT32 StringAreaSize;
UINT32 Length;
@@ -320,11 +391,11 @@ AcpiUtExecute_CID (
/*
* Now that we know the length of the CIDs, allocate return buffer:
* 1) Size of the base structure +
- * 2) Size of the CID DEVICE_ID array +
+ * 2) Size of the CID PNP_DEVICE_ID array +
* 3) Size of the actual CID strings
*/
- CidListSize = sizeof (ACPI_DEVICE_ID_LIST) +
- ((Count - 1) * sizeof (ACPI_DEVICE_ID)) +
+ CidListSize = sizeof (ACPI_PNP_DEVICE_ID_LIST) +
+ ((Count - 1) * sizeof (ACPI_PNP_DEVICE_ID)) +
StringAreaSize;
CidList = ACPI_ALLOCATE_ZEROED (CidListSize);
@@ -334,10 +405,10 @@ AcpiUtExecute_CID (
goto Cleanup;
}
- /* Area for CID strings starts after the CID DEVICE_ID array */
+ /* Area for CID strings starts after the CID PNP_DEVICE_ID array */
NextIdString = ACPI_CAST_PTR (char, CidList->Ids) +
- ((ACPI_SIZE) Count * sizeof (ACPI_DEVICE_ID));
+ ((ACPI_SIZE) Count * sizeof (ACPI_PNP_DEVICE_ID));
/* Copy/convert the CIDs to the return buffer */
@@ -377,4 +448,3 @@ Cleanup:
AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c
index 6694ec7..7b53c9a 100644
--- a/sys/contrib/dev/acpica/components/utilities/utinit.c
+++ b/sys/contrib/dev/acpica/components/utilities/utinit.c
@@ -188,5 +188,3 @@ AcpiUtSubsystemShutdown (
(void) AcpiUtDeleteCaches ();
return_VOID;
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utlock.c b/sys/contrib/dev/acpica/components/utilities/utlock.c
index 4ab3346..40fc8f8 100644
--- a/sys/contrib/dev/acpica/components/utilities/utlock.c
+++ b/sys/contrib/dev/acpica/components/utilities/utlock.c
@@ -202,4 +202,3 @@ AcpiUtReleaseWriteLock (
AcpiOsReleaseMutex (Lock->WriterMutex);
}
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utmath.c b/sys/contrib/dev/acpica/components/utilities/utmath.c
index b373923..ec51855 100644
--- a/sys/contrib/dev/acpica/components/utilities/utmath.c
+++ b/sys/contrib/dev/acpica/components/utilities/utmath.c
@@ -90,7 +90,7 @@ typedef union uint64_overlay
* RETURN: Status (Checks for divide-by-zero)
*
* DESCRIPTION: Perform a short (maximum 64 bits divided by 32 bits)
- * divide and modulo. The result is a 64-bit quotient and a
+ * divide and modulo. The result is a 64-bit quotient and a
* 32-bit remainder.
*
******************************************************************************/
@@ -375,5 +375,3 @@ AcpiUtDivide (
}
#endif
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c
index 78cdbcd..70fdb50 100644
--- a/sys/contrib/dev/acpica/components/utilities/utmisc.c
+++ b/sys/contrib/dev/acpica/components/utilities/utmisc.c
@@ -281,7 +281,7 @@ Exit:
* control method or unloading a table. Either way, we would
* ignore any error anyway.
*
- * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
+ * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
*
******************************************************************************/
@@ -612,8 +612,8 @@ AcpiUtDwordByteSwap (
* RETURN: None
*
* DESCRIPTION: Set the global integer bit width based upon the revision
- * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
- * For Revision 2 and above, Integers are 64 bits. Yes, this
+ * of the DSDT. For Revision 1 and 0, Integers are 32 bits.
+ * For Revision 2 and above, Integers are 64 bits. Yes, this
* makes a difference.
*
******************************************************************************/
@@ -768,7 +768,7 @@ AcpiUtValidAcpiChar (
*
* RETURN: TRUE if the name is valid, FALSE otherwise
*
- * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
+ * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
* 1) Upper case alpha
* 2) numeric
* 3) underscore
@@ -825,11 +825,14 @@ AcpiUtRepairName (
{
UINT32 i;
BOOLEAN FoundBadChar = FALSE;
+ UINT32 OriginalName;
ACPI_FUNCTION_NAME (UtRepairName);
+ ACPI_MOVE_NAME (&OriginalName, Name);
+
/* Check each character in the name */
for (i = 0; i < ACPI_NAME_SIZE; i++)
@@ -855,12 +858,14 @@ AcpiUtRepairName (
if (!AcpiGbl_EnableInterpreterSlack)
{
ACPI_WARNING ((AE_INFO,
- "Found bad character(s) in name, repaired: [%4.4s]\n", Name));
+ "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
+ OriginalName, Name));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found bad character(s) in name, repaired: [%4.4s]\n", Name));
+ "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
+ OriginalName, Name));
}
}
}
@@ -1167,10 +1172,10 @@ AcpiUtWalkPackageTree (
/*
* Check for:
- * 1) An uninitialized package element. It is completely
+ * 1) An uninitialized package element. It is completely
* legal to declare a package and leave it uninitialized
* 2) Not an internal object - can be a namespace node instead
- * 3) Any type other than a package. Packages are handled in else
+ * 3) Any type other than a package. Packages are handled in else
* case below.
*/
if ((!ThisSourceObj) ||
@@ -1189,7 +1194,7 @@ AcpiUtWalkPackageTree (
{
/*
* We've handled all of the objects at this level, This means
- * that we have just completed a package. That package may
+ * that we have just completed a package. That package may
* have contained one or more packages itself.
*
* Delete this state and pop the previous state (package).
diff --git a/sys/contrib/dev/acpica/components/utilities/utmutex.c b/sys/contrib/dev/acpica/components/utilities/utmutex.c
index 2991c2e..14b9aa7 100644
--- a/sys/contrib/dev/acpica/components/utilities/utmutex.c
+++ b/sys/contrib/dev/acpica/components/utilities/utmutex.c
@@ -225,6 +225,8 @@ AcpiUtDeleteMutex (
AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ return_VOID;
}
@@ -264,9 +266,9 @@ AcpiUtAcquireMutex (
/*
* Mutex debug code, for internal debugging only.
*
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than or equal to this one. If so, the thread has violated
- * the mutex ordering rule. This indicates a coding error somewhere in
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than or equal to this one. If so, the thread has violated
+ * the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = MutexId; i < ACPI_NUM_MUTEX; i++)
@@ -337,6 +339,7 @@ AcpiUtReleaseMutex (
{
ACPI_FUNCTION_NAME (UtReleaseMutex);
+
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
(UINT32) AcpiOsGetThreadId (), AcpiUtGetMutexName (MutexId)));
@@ -362,9 +365,9 @@ AcpiUtReleaseMutex (
/*
* Mutex debug code, for internal debugging only.
*
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than this one. If so, the thread has violated the mutex
- * ordering rule. This indicates a coding error somewhere in
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than this one. If so, the thread has violated the mutex
+ * ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
for (i = MutexId; i < ACPI_NUM_MUTEX; i++)
@@ -393,5 +396,3 @@ AcpiUtReleaseMutex (
AcpiOsReleaseMutex (AcpiGbl_MutexInfo[MutexId].Mutex);
return (AE_OK);
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utobject.c b/sys/contrib/dev/acpica/components/utilities/utobject.c
index 09ff6cf..d4d211a 100644
--- a/sys/contrib/dev/acpica/components/utilities/utobject.c
+++ b/sys/contrib/dev/acpica/components/utilities/utobject.c
@@ -86,7 +86,7 @@ AcpiUtGetElementLength (
*
* NOTE: We always allocate the worst-case object descriptor because
* these objects are cached, and we want them to be
- * one-size-satisifies-any-request. This in itself may not be
+ * one-size-satisifies-any-request. This in itself may not be
* the most memory efficient, but the efficiency of the object
* cache should more than make up for this!
*
@@ -415,9 +415,9 @@ AcpiUtValidInternalObject (
* LineNumber - Caller's line number (for error output)
* ComponentId - Caller's component ID (for error output)
*
- * RETURN: Pointer to newly allocated object descriptor. Null on error
+ * RETURN: Pointer to newly allocated object descriptor. Null on error
*
- * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
+ * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
* error conditions.
*
******************************************************************************/
@@ -620,7 +620,7 @@ AcpiUtGetSimpleObjectSize (
/*
* Account for the space required by the object rounded up to the next
- * multiple of the machine word size. This keeps each object aligned
+ * multiple of the machine word size. This keeps each object aligned
* on a machine word boundary. (preventing alignment faults on some
* machines.)
*/
@@ -783,5 +783,3 @@ AcpiUtGetObjectSize (
return (Status);
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c
index a7c8fcc..a97863f 100644
--- a/sys/contrib/dev/acpica/components/utilities/utresrc.c
+++ b/sys/contrib/dev/acpica/components/utilities/utresrc.c
@@ -919,5 +919,3 @@ AcpiUtGetResourceEndTag (
return_ACPI_STATUS (Status);
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utstate.c b/sys/contrib/dev/acpica/components/utilities/utstate.c
index 2a99fe8..9bf74c4 100644
--- a/sys/contrib/dev/acpica/components/utilities/utstate.c
+++ b/sys/contrib/dev/acpica/components/utilities/utstate.c
@@ -163,7 +163,7 @@ AcpiUtPopGenericState (
*
* RETURN: The new state object. NULL on failure.
*
- * DESCRIPTION: Create a generic state object. Attempt to obtain one from
+ * DESCRIPTION: Create a generic state object. Attempt to obtain one from
* the global state cache; If none available, create a new one.
*
******************************************************************************/
@@ -394,5 +394,3 @@ AcpiUtDeleteGenericState (
}
return_VOID;
}
-
-
diff --git a/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c
index d8f6852..d7a38ab 100644
--- a/sys/contrib/dev/acpica/components/utilities/uttrack.c
+++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c
@@ -45,9 +45,9 @@
* These procedures are used for tracking memory leaks in the subsystem, and
* they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
*
- * Each memory allocation is tracked via a doubly linked list. Each
+ * Each memory allocation is tracked via a doubly linked list. Each
* element contains the caller's component, module name, function name, and
- * line number. AcpiUtAllocate and AcpiUtAllocateZeroed call
+ * line number. AcpiUtAllocate and AcpiUtAllocateZeroed call
* AcpiUtTrackAllocation to add an element to the list; deletion
* occurs in the body of AcpiUtFree.
*/
@@ -62,11 +62,12 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("uttrack")
+
/* Local prototypes */
static ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
- void *Allocation);
+ ACPI_DEBUG_MEM_BLOCK *Allocation);
static ACPI_STATUS
AcpiUtTrackAllocation (
@@ -296,29 +297,52 @@ AcpiUtFreeAndTrack (
*
* PARAMETERS: Allocation - Address of allocated memory
*
- * RETURN: A list element if found; NULL otherwise.
+ * RETURN: Three cases:
+ * 1) List is empty, NULL is returned.
+ * 2) Element was found. Returns Allocation parameter.
+ * 3) Element was not found. Returns position where it should be
+ * inserted into the list.
*
* DESCRIPTION: Searches for an element in the global allocation tracking list.
+ * If the element is not found, returns the location within the
+ * list where the element should be inserted.
+ *
+ * Note: The list is ordered by larger-to-smaller addresses.
+ *
+ * This global list is used to detect memory leaks in ACPICA as
+ * well as other issues such as an attempt to release the same
+ * internal object more than once. Although expensive as far
+ * as cpu time, this list is much more helpful for finding these
+ * types of issues than using memory leak detectors outside of
+ * the ACPICA code.
*
******************************************************************************/
static ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
- void *Allocation)
+ ACPI_DEBUG_MEM_BLOCK *Allocation)
{
ACPI_DEBUG_MEM_BLOCK *Element;
- ACPI_FUNCTION_ENTRY ();
-
-
Element = AcpiGbl_GlobalList->ListHead;
+ if (!Element)
+ {
+ return (NULL);
+ }
- /* Search for the address. */
-
- while (Element)
+ /*
+ * Search for the address.
+ *
+ * Note: List is ordered by larger-to-smaller addresses, on the
+ * assumption that a new allocation usually has a larger address
+ * than previous allocations.
+ */
+ while (Element > Allocation)
{
- if (Element == Allocation)
+ /* Check for end-of-list */
+
+ if (!Element->Next)
{
return (Element);
}
@@ -326,7 +350,12 @@ AcpiUtFindAllocation (
Element = Element->Next;
}
- return (NULL);
+ if (Element == Allocation)
+ {
+ return (Element);
+ }
+
+ return (Element->Previous);
}
@@ -341,7 +370,7 @@ AcpiUtFindAllocation (
* Module - Source file name of caller
* Line - Line number of caller
*
- * RETURN: None.
+ * RETURN: Status
*
* DESCRIPTION: Inserts an element into the global allocation tracking list.
*
@@ -377,23 +406,19 @@ AcpiUtTrackAllocation (
}
/*
- * Search list for this address to make sure it is not already on the list.
- * This will catch several kinds of problems.
+ * Search the global list for this address to make sure it is not
+ * already present. This will catch several kinds of problems.
*/
Element = AcpiUtFindAllocation (Allocation);
- if (Element)
+ if (Element == Allocation)
{
ACPI_ERROR ((AE_INFO,
- "UtTrackAllocation: Allocation already present in list! (%p)",
+ "UtTrackAllocation: Allocation (%p) already present in global list!",
Allocation));
-
- ACPI_ERROR ((AE_INFO, "Element %p Address %p",
- Element, Allocation));
-
goto UnlockAndExit;
}
- /* Fill in the instance data. */
+ /* Fill in the instance data */
Allocation->Size = (UINT32) Size;
Allocation->AllocType = AllocType;
@@ -403,17 +428,34 @@ AcpiUtTrackAllocation (
ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
- /* Insert at list head */
-
- if (MemList->ListHead)
+ if (!Element)
{
- ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
+ /* Insert at list head */
+
+ if (MemList->ListHead)
+ {
+ ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
+ }
+
+ Allocation->Next = MemList->ListHead;
+ Allocation->Previous = NULL;
+
+ MemList->ListHead = Allocation;
}
+ else
+ {
+ /* Insert after element */
- Allocation->Next = MemList->ListHead;
- Allocation->Previous = NULL;
+ Allocation->Next = Element->Next;
+ Allocation->Previous = Element;
- MemList->ListHead = Allocation;
+ if (Element->Next)
+ {
+ (Element->Next)->Previous = Allocation;
+ }
+
+ Element->Next = Allocation;
+ }
UnlockAndExit:
@@ -431,7 +473,7 @@ UnlockAndExit:
* Module - Source file name of caller
* Line - Line number of caller
*
- * RETURN:
+ * RETURN: Status
*
* DESCRIPTION: Deletes an element from the global allocation tracking list.
*
@@ -505,7 +547,7 @@ AcpiUtRemoveAllocation (
*
* FUNCTION: AcpiUtDumpAllocationInfo
*
- * PARAMETERS:
+ * PARAMETERS: None
*
* RETURN: None
*
@@ -566,7 +608,7 @@ AcpiUtDumpAllocationInfo (
* FUNCTION: AcpiUtDumpAllocations
*
* PARAMETERS: Component - Component(s) to dump info for.
- * Module - Module to dump info for. NULL means all.
+ * Module - Module to dump info for. NULL means all.
*
* RETURN: None
*
@@ -590,7 +632,7 @@ AcpiUtDumpAllocations (
if (AcpiGbl_DisableMemTracking)
{
- return;
+ return_VOID;
}
/*
@@ -598,7 +640,7 @@ AcpiUtDumpAllocations (
*/
if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
{
- return;
+ return_VOID;
}
Element = AcpiGbl_GlobalList->ListHead;
@@ -708,4 +750,3 @@ AcpiUtDumpAllocations (
}
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
-
diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c
index f1efa31..4abe72e 100644
--- a/sys/contrib/dev/acpica/components/utilities/utxface.c
+++ b/sys/contrib/dev/acpica/components/utilities/utxface.c
@@ -160,7 +160,7 @@ ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus)
* RETURN: Status - the status of the call
*
* DESCRIPTION: This function is called to get information about the current
- * state of the ACPI subsystem. It will return system information
+ * state of the ACPI subsystem. It will return system information
* in the OutBuffer.
*
* If the function fails an appropriate status will be returned
@@ -310,7 +310,7 @@ AcpiInstallInitializationHandler (
}
AcpiGbl_InitHandler = Handler;
- return AE_OK;
+ return (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler)
@@ -334,10 +334,12 @@ AcpiPurgeCachedObjects (
{
ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects);
+
(void) AcpiOsPurgeCache (AcpiGbl_StateCache);
(void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
(void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache);
(void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
+
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/components/utilities/utxferror.c b/sys/contrib/dev/acpica/components/utilities/utxferror.c
index 3604a9b..e106c9b 100644
--- a/sys/contrib/dev/acpica/components/utilities/utxferror.c
+++ b/sys/contrib/dev/acpica/components/utilities/utxferror.c
@@ -477,7 +477,7 @@ AcpiUtNamespaceError (
/* There is a non-ascii character in the name */
ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
- AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName);
+ AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName);
}
else
{
OpenPOWER on IntegriCloud