acpi_status acpi_ev_release_global_lock(void) { u8 pending = FALSE; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(ev_release_global_lock); /* Lock must be already acquired */ if (!acpi_gbl_global_lock_acquired) { ACPI_WARNING((AE_INFO, "Cannot release the ACPI Global Lock, it has not been acquired")); return_ACPI_STATUS(AE_NOT_ACQUIRED); } acpi_ev_global_lock_acquired--; if (acpi_ev_global_lock_acquired > 0) { return AE_OK; } if (acpi_gbl_global_lock_present) { /* Allow any thread to release the lock */ ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); /* * If the pending bit was set, we must write GBL_RLS to the control * register */ if (pending) { status = acpi_write_bit_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Released hardware Global Lock\n")); } acpi_gbl_global_lock_acquired = FALSE; /* Release the local GL mutex */ acpi_ev_global_lock_thread_id = 0; acpi_ev_global_lock_acquired = 0; acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); return_ACPI_STATUS(status); }
ACPI_STATUS AcpiEvReleaseGlobalLock ( void) { BOOLEAN Pending = FALSE; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); /* Lock must be already acquired */ if (!AcpiGbl_GlobalLockAcquired) { ACPI_WARNING ((AE_INFO, "Cannot release the ACPI Global Lock, it has not been acquired")); return_ACPI_STATUS (AE_NOT_ACQUIRED); } if (AcpiGbl_GlobalLockPresent) { /* Allow any thread to release the lock */ ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); /* * If the pending bit was set, we must write GBL_RLS to the control * register */ if (Pending) { Status = AcpiWriteBitRegister ( ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); } AcpiGbl_GlobalLockAcquired = FALSE; /* Release the local GL mutex */ AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); return_ACPI_STATUS (Status); }
acpi_status acpi_ev_release_global_lock ( void) { u8 pending = FALSE; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE ("ev_release_global_lock"); if (!acpi_gbl_global_lock_thread_count) { ACPI_REPORT_WARNING(( "Cannot release HW Global Lock, it has not been acquired\n")); return_ACPI_STATUS (AE_NOT_ACQUIRED); } /* One fewer thread has the global lock */ acpi_gbl_global_lock_thread_count--; if (acpi_gbl_global_lock_thread_count) { /* There are still some threads holding the lock, cannot release */ return_ACPI_STATUS (AE_OK); } /* * No more threads holding lock, we can do the actual hardware * release */ ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending); acpi_gbl_global_lock_acquired = FALSE; /* * If the pending bit was set, we must write GBL_RLS to the control * register */ if (pending) { status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); } return_ACPI_STATUS (status); }
acpi_status acpi_ev_release_global_lock(void) { u8 pending = FALSE; acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(ev_release_global_lock); if (!acpi_gbl_global_lock_acquired) { ACPI_WARNING((AE_INFO, "Cannot release the ACPI Global Lock, it has not been acquired")); return_ACPI_STATUS(AE_NOT_ACQUIRED); } if (acpi_gbl_global_lock_present) { ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); if (pending) { status = acpi_write_bit_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Released hardware Global Lock\n")); } acpi_gbl_global_lock_acquired = FALSE; acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); return_ACPI_STATUS(status); }