diff options
author | Bob Moore <robert.moore@intel.com> | 2008-04-10 11:06:37 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-22 14:29:21 -0400 |
commit | ba886cd4ac957608777fbc8d137f6b9f0450e775 (patch) | |
tree | d7dabaa586af41c293977443ee20df6b6b13d171 /drivers/acpi/events/evxface.c | |
parent | f654ecbfacb47d20e8cac087bbada1b947db846b (diff) |
ACPICA: Update for mutiple global lock acquisitions by same thread
Allows AcpiAcquireGlobalLock external interface to be called
multiple times by the
same thread. Allows use of AML fields that require the global
lock while the running AML is already holding the global lock.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/events/evxface.c')
-rw-r--r-- | drivers/acpi/events/evxface.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 6d866a01f5f4..dbf34a5fc1e0 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -758,6 +758,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) | |||
758 | * | 758 | * |
759 | * DESCRIPTION: Acquire the ACPI Global Lock | 759 | * DESCRIPTION: Acquire the ACPI Global Lock |
760 | * | 760 | * |
761 | * Note: Allows callers with the same thread ID to acquire the global lock | ||
762 | * multiple times. In other words, externally, the behavior of the global lock | ||
763 | * is identical to an AML mutex. On the first acquire, a new handle is | ||
764 | * returned. On any subsequent calls to acquire by the same thread, the same | ||
765 | * handle is returned. | ||
766 | * | ||
761 | ******************************************************************************/ | 767 | ******************************************************************************/ |
762 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | 768 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
763 | { | 769 | { |
@@ -770,14 +776,26 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
770 | /* Must lock interpreter to prevent race conditions */ | 776 | /* Must lock interpreter to prevent race conditions */ |
771 | 777 | ||
772 | acpi_ex_enter_interpreter(); | 778 | acpi_ex_enter_interpreter(); |
773 | status = acpi_ev_acquire_global_lock(timeout); | 779 | |
774 | acpi_ex_exit_interpreter(); | 780 | status = acpi_ex_acquire_mutex_object(timeout, |
781 | acpi_gbl_global_lock_mutex, | ||
782 | acpi_os_get_thread_id()); | ||
775 | 783 | ||
776 | if (ACPI_SUCCESS(status)) { | 784 | if (ACPI_SUCCESS(status)) { |
777 | acpi_gbl_global_lock_handle++; | 785 | /* |
786 | * If this was the first acquisition of the Global Lock by this thread, | ||
787 | * create a new handle. Otherwise, return the existing handle. | ||
788 | */ | ||
789 | if (acpi_gbl_global_lock_mutex->mutex.acquisition_depth == 1) { | ||
790 | acpi_gbl_global_lock_handle++; | ||
791 | } | ||
792 | |||
793 | /* Return the global lock handle */ | ||
794 | |||
778 | *handle = acpi_gbl_global_lock_handle; | 795 | *handle = acpi_gbl_global_lock_handle; |
779 | } | 796 | } |
780 | 797 | ||
798 | acpi_ex_exit_interpreter(); | ||
781 | return (status); | 799 | return (status); |
782 | } | 800 | } |
783 | 801 | ||
@@ -802,7 +820,7 @@ acpi_status acpi_release_global_lock(u32 handle) | |||
802 | return (AE_NOT_ACQUIRED); | 820 | return (AE_NOT_ACQUIRED); |
803 | } | 821 | } |
804 | 822 | ||
805 | status = acpi_ev_release_global_lock(); | 823 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
806 | return (status); | 824 | return (status); |
807 | } | 825 | } |
808 | 826 | ||