Misc fixes for recent global lock code update.

Fixes as a result of running full validation test suite.
This commit is contained in:
rmoore1 2007-03-20 18:41:35 +00:00
parent b38a7694f4
commit 913524af42
5 changed files with 39 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 1.164 $
* $Revision: 1.165 $
*
*****************************************************************************/
@ -961,7 +961,7 @@ AcpiReleaseGlobalLock (
ACPI_STATUS Status;
if (Handle != AcpiGbl_GlobalLockHandle)
if (!Handle || (Handle != AcpiGbl_GlobalLockHandle))
{
return (AE_NOT_ACQUIRED);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.130 $
* $Revision: 1.131 $
*
*****************************************************************************/
@ -206,7 +206,7 @@ AcpiExReadDataFromField (
Status = AcpiExAccessRegion (ObjDesc, 0,
ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
ACPI_READ | (ObjDesc->Field.Attribute << 16));
AcpiExReleaseGlobalLock ();
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
goto Exit;
}
@ -263,7 +263,7 @@ AcpiExReadDataFromField (
/* Read from the field */
Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length);
AcpiExReleaseGlobalLock ();
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
Exit:
@ -381,7 +381,7 @@ AcpiExWriteDataToField (
Status = AcpiExAccessRegion (ObjDesc, 0,
(ACPI_INTEGER *) Buffer,
ACPI_WRITE | (ObjDesc->Field.Attribute << 16));
AcpiExReleaseGlobalLock ();
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
*ResultDesc = BufferDesc;
return_ACPI_STATUS (Status);
@ -460,7 +460,7 @@ AcpiExWriteDataToField (
/* Write to the field */
Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length);
AcpiExReleaseGlobalLock ();
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Free temporary buffer if we used one */

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 1.39 $
* $Revision: 1.40 $
*
*****************************************************************************/
@ -250,6 +250,11 @@ AcpiExAcquireMutexObject (
ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Support for multiple acquires by the owning thread */
if (ObjDesc->Mutex.ThreadId == ThreadId)
@ -396,6 +401,11 @@ AcpiExReleaseMutexObject (
ACPI_FUNCTION_TRACE (ExReleaseMutexObject);
if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
return (AE_NOT_ACQUIRED);
}
/* Match multiple Acquires with multiple Releases */
ObjDesc->Mutex.AcquisitionDepth--;
@ -501,16 +511,20 @@ AcpiExReleaseMutex (
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], incorrect SyncLevel",
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
Status = AcpiExReleaseMutexObject (ObjDesc);
/* Restore the original SyncLevel */
if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
/* Restore the original SyncLevel */
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 1.128 $
* $Revision: 1.129 $
*
*****************************************************************************/
@ -390,7 +390,8 @@ AcpiExAcquireGlobalLock (
*
* FUNCTION: AcpiExReleaseGlobalLock
*
* PARAMETERS: None
* PARAMETERS: FieldFlags - Flags with Lock rule:
* AlwaysLock or NeverLock
*
* RETURN: None
*
@ -400,7 +401,7 @@ AcpiExAcquireGlobalLock (
void
AcpiExReleaseGlobalLock (
void)
UINT32 FieldFlags)
{
ACPI_STATUS Status;
@ -408,6 +409,13 @@ AcpiExReleaseGlobalLock (
ACPI_FUNCTION_TRACE (ExReleaseGlobalLock);
/* Only use the lock if the AlwaysLock bit is set */
if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
{
return_VOID;
}
/* Release the global lock */
Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 1.170 $
* $Revision: 1.171 $
*
*****************************************************************************/
@ -701,7 +701,7 @@ AcpiExAcquireGlobalLock (
void
AcpiExReleaseGlobalLock (
void);
UINT32 Rule);
void
AcpiExEisaIdToString (