// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acinterp.h" #include "acevents.h" #define _COMPONENT … ACPI_MODULE_NAME("exmutex") /* Local prototypes */ static void acpi_ex_link_mutex(union acpi_operand_object *obj_desc, struct acpi_thread_state *thread); /******************************************************************************* * * FUNCTION: acpi_ex_unlink_mutex * * PARAMETERS: obj_desc - The mutex to be unlinked * * RETURN: None * * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list * ******************************************************************************/ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) { … } /******************************************************************************* * * FUNCTION: acpi_ex_link_mutex * * PARAMETERS: obj_desc - The mutex to be linked * thread - Current executing thread object * * RETURN: None * * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk * ******************************************************************************/ static void acpi_ex_link_mutex(union acpi_operand_object *obj_desc, struct acpi_thread_state *thread) { … } /******************************************************************************* * * FUNCTION: acpi_ex_acquire_mutex_object * * PARAMETERS: timeout - Timeout in milliseconds * obj_desc - Mutex object * thread_id - Current thread state * * RETURN: Status * * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common * path that supports multiple acquires by the same thread. * * MUTEX: Interpreter must be locked * * NOTE: This interface is called from three places: * 1) From acpi_ex_acquire_mutex, via an AML Acquire() operator * 2) From acpi_ex_acquire_global_lock when an AML Field access requires the * global lock * 3) From the external interface, acpi_acquire_global_lock * ******************************************************************************/ acpi_status acpi_ex_acquire_mutex_object(u16 timeout, union acpi_operand_object *obj_desc, acpi_thread_id thread_id) { … } /******************************************************************************* * * FUNCTION: acpi_ex_acquire_mutex * * PARAMETERS: time_desc - Timeout integer * obj_desc - Mutex object * walk_state - Current method execution state * * RETURN: Status * * DESCRIPTION: Acquire an AML mutex * ******************************************************************************/ acpi_status acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ex_release_mutex_object * * PARAMETERS: obj_desc - The object descriptor for this op * * RETURN: Status * * DESCRIPTION: Release a previously acquired Mutex, low level interface. * Provides a common path that supports multiple releases (after * previous multiple acquires) by the same thread. * * MUTEX: Interpreter must be locked * * NOTE: This interface is called from three places: * 1) From acpi_ex_release_mutex, via an AML Acquire() operator * 2) From acpi_ex_release_global_lock when an AML Field access requires the * global lock * 3) From the external interface, acpi_release_global_lock * ******************************************************************************/ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) { … } /******************************************************************************* * * FUNCTION: acpi_ex_release_mutex * * PARAMETERS: obj_desc - The object descriptor for this op * walk_state - Current method execution state * * RETURN: Status * * DESCRIPTION: Release a previously acquired Mutex. * ******************************************************************************/ acpi_status acpi_ex_release_mutex(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { … } /******************************************************************************* * * FUNCTION: acpi_ex_release_all_mutexes * * PARAMETERS: thread - Current executing thread object * * RETURN: Status * * DESCRIPTION: Release all mutexes held by this thread * * NOTE: This function is called as the thread is exiting the interpreter. * Mutexes are not released when an individual control method is exited, but * only when the parent thread actually exits the interpreter. This allows one * method to acquire a mutex, and a different method to release it, as long as * this is performed underneath a single parent control method. * ******************************************************************************/ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) { … }