summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/io/acpica/utilities/utmutex.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-07-26 15:05:29 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-07-26 15:05:29 +0000
commitd103e8b98085dbb5f7707242723b9d3ce74f2723 (patch)
tree263af7aa964a6c36a7cd561cd80268d6cbba5d5d /usr/src/uts/intel/io/acpica/utilities/utmutex.c
parent9b221abb819d37d8c917941b8348a6c0e49c74b1 (diff)
downloadillumos-joyent-d103e8b98085dbb5f7707242723b9d3ce74f2723.tar.gz
OS-5536 update to ACPI version 6.x
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/uts/intel/io/acpica/utilities/utmutex.c')
-rw-r--r--usr/src/uts/intel/io/acpica/utilities/utmutex.c63
1 files changed, 47 insertions, 16 deletions
diff --git a/usr/src/uts/intel/io/acpica/utilities/utmutex.c b/usr/src/uts/intel/io/acpica/utilities/utmutex.c
index f1cdb01804..83b1cee0d7 100644
--- a/usr/src/uts/intel/io/acpica/utilities/utmutex.c
+++ b/usr/src/uts/intel/io/acpica/utilities/utmutex.c
@@ -5,7 +5,7 @@
******************************************************************************/
/*
- * Copyright (C) 2000 - 2012, Intel Corp.
+ * Copyright (C) 2000 - 2016, 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 "acpi.h"
#include "accommon.h"
@@ -96,7 +93,7 @@ AcpiUtMutexInitialize (
}
}
- /* Create the spinlocks for use at interrupt level */
+ /* Create the spinlocks for use at interrupt level or for speed */
Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
if (ACPI_FAILURE (Status))
@@ -110,7 +107,14 @@ AcpiUtMutexInitialize (
return_ACPI_STATUS (Status);
}
+ Status = AcpiOsCreateLock (&AcpiGbl_ReferenceCountLock);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Mutex for _OSI support */
+
Status = AcpiOsCreateMutex (&AcpiGbl_OsiMutex);
if (ACPI_FAILURE (Status))
{
@@ -120,6 +124,24 @@ AcpiUtMutexInitialize (
/* Create the reader/writer lock for namespace access */
Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+#ifdef ACPI_DEBUGGER
+
+ /* Debugger Support */
+
+ Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
+#endif
+
return_ACPI_STATUS (Status);
}
@@ -160,10 +182,17 @@ AcpiUtMutexTerminate (
AcpiOsDeleteLock (AcpiGbl_GpeLock);
AcpiOsDeleteLock (AcpiGbl_HardwareLock);
+ AcpiOsDeleteLock (AcpiGbl_ReferenceCountLock);
/* Delete the reader/writer lock */
AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
+
+#ifdef ACPI_DEBUGGER
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+#endif
+
return_VOID;
}
@@ -225,6 +254,8 @@ AcpiUtDeleteMutex (
AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ return_VOID;
}
@@ -264,9 +295,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++)
@@ -298,11 +329,12 @@ AcpiUtAcquireMutex (
"Thread %u attempting to acquire Mutex [%s]\n",
(UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
- Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex,
- ACPI_WAIT_FOREVER);
+ Status = AcpiOsAcquireMutex (
+ AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %u acquired Mutex [%s]\n",
(UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId)));
AcpiGbl_MutexInfo[MutexId].UseCount++;
@@ -337,6 +369,7 @@ AcpiUtReleaseMutex (
{
ACPI_FUNCTION_NAME (UtReleaseMutex);
+
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
(UINT32) AcpiOsGetThreadId (), AcpiUtGetMutexName (MutexId)));
@@ -362,9 +395,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 +426,3 @@ AcpiUtReleaseMutex (
AcpiOsReleaseMutex (AcpiGbl_MutexInfo[MutexId].Mutex);
return (AE_OK);
}
-
-