Lines Matching +full:lock +full:- +full:status
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
4 * Module Name: evglock - Global Lock support
6 * Copyright (C) 2000 - 2023, Intel Corp.
27 * RETURN: Status
29 * DESCRIPTION: Install a handler for the global lock release event
35 acpi_status status; in acpi_ev_init_global_lock_handler() local
39 /* If Hardware Reduced flag is set, there is no global lock */ in acpi_ev_init_global_lock_handler()
45 /* Attempt installation of the global lock handler */ in acpi_ev_init_global_lock_handler()
47 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, in acpi_ev_init_global_lock_handler()
52 * If the global lock does not exist on this platform, the attempt to in acpi_ev_init_global_lock_handler()
54 * Map to AE_OK, but mark global lock as not present. Any attempt to in acpi_ev_init_global_lock_handler()
55 * actually use the global lock will be flagged with an error. in acpi_ev_init_global_lock_handler()
58 if (status == AE_NO_HARDWARE_RESPONSE) { in acpi_ev_init_global_lock_handler()
60 "No response from Global Lock hardware, disabling lock")); in acpi_ev_init_global_lock_handler()
65 status = acpi_os_create_lock(&acpi_gbl_global_lock_pending_lock); in acpi_ev_init_global_lock_handler()
66 if (ACPI_FAILURE(status)) { in acpi_ev_init_global_lock_handler()
67 return_ACPI_STATUS(status); in acpi_ev_init_global_lock_handler()
72 return_ACPI_STATUS(status); in acpi_ev_init_global_lock_handler()
81 * RETURN: Status
83 * DESCRIPTION: Remove the handler for the Global Lock
89 acpi_status status; in acpi_ev_remove_global_lock_handler() local
94 status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL, in acpi_ev_remove_global_lock_handler()
98 return_ACPI_STATUS(status); in acpi_ev_remove_global_lock_handler()
105 * PARAMETERS: context - From thread interface, not used
109 * DESCRIPTION: Invoked directly from the SCI handler when a global lock
111 * request for the lock, signal the waiting thread.
117 acpi_status status; in acpi_ev_global_lock_handler() local
123 * If a request for the global lock is not actually pending, in acpi_ev_global_lock_handler()
124 * we are done. This handles "spurious" global lock interrupts in acpi_ev_global_lock_handler()
132 * Send a unit to the global lock semaphore. The actual acquisition in acpi_ev_global_lock_handler()
133 * of the global lock will be performed by the waiting thread. in acpi_ev_global_lock_handler()
135 status = acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore, 1); in acpi_ev_global_lock_handler()
136 if (ACPI_FAILURE(status)) { in acpi_ev_global_lock_handler()
137 ACPI_ERROR((AE_INFO, "Could not signal Global Lock semaphore")); in acpi_ev_global_lock_handler()
152 * PARAMETERS: timeout - Max time to wait for the lock, in millisec.
154 * RETURN: Status
156 * DESCRIPTION: Attempt to gain ownership of the Global Lock.
161 * Global Lock, and the OS would hold the lock until the last thread had
163 * lock, especially in the case where there is a tight handshake between the
165 * allows only one thread to acquire the HW Global Lock at a time, and makes
166 * the global lock appear as a standard mutex on the OS side.
173 acpi_status status; in acpi_ev_acquire_global_lock() local
182 status = in acpi_ev_acquire_global_lock()
183 acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex->mutex. in acpi_ev_acquire_global_lock()
185 if (ACPI_FAILURE(status)) { in acpi_ev_acquire_global_lock()
186 return_ACPI_STATUS(status); in acpi_ev_acquire_global_lock()
190 * Update the global lock handle and check for wraparound. The handle is in acpi_ev_acquire_global_lock()
191 * only used for the external global lock interfaces, but it is updated in acpi_ev_acquire_global_lock()
193 * lock via both the AML and the acpi_acquire_global_lock interfaces. The in acpi_ev_acquire_global_lock()
203 * Make sure that a global lock actually exists. If not, just in acpi_ev_acquire_global_lock()
204 * treat the lock as a standard mutex. in acpi_ev_acquire_global_lock()
215 /* Attempt to acquire the actual hardware lock */ in acpi_ev_acquire_global_lock()
221 "Acquired hardware Global Lock\n")); in acpi_ev_acquire_global_lock()
226 * Did not get the lock. The pending bit was set above, and in acpi_ev_acquire_global_lock()
227 * we must now wait until we receive the global lock in acpi_ev_acquire_global_lock()
234 "Waiting for hardware Global Lock\n")); in acpi_ev_acquire_global_lock()
237 * Wait for handshake with the global lock interrupt handler. in acpi_ev_acquire_global_lock()
240 status = in acpi_ev_acquire_global_lock()
246 } while (ACPI_SUCCESS(status)); in acpi_ev_acquire_global_lock()
251 return_ACPI_STATUS(status); in acpi_ev_acquire_global_lock()
260 * RETURN: Status
262 * DESCRIPTION: Releases ownership of the Global Lock.
269 acpi_status status = AE_OK; in acpi_ev_release_global_lock() local
273 /* Lock must be already acquired */ in acpi_ev_release_global_lock()
277 "Cannot release the ACPI Global Lock, it has not been acquired")); in acpi_ev_release_global_lock()
283 /* Allow any thread to release the lock */ in acpi_ev_release_global_lock()
292 status = in acpi_ev_release_global_lock()
299 "Released hardware Global Lock\n")); in acpi_ev_release_global_lock()
306 acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); in acpi_ev_release_global_lock()
307 return_ACPI_STATUS(status); in acpi_ev_release_global_lock()