From 1685bd404dc2ecce2fdae6410e85ded2f2c0136d Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Wed, 31 Dec 2008 03:03:29 +0800 Subject: ACPICA: Add ACPI_MUTEX_TYPE configuration option Used to specify whether the OSL mutex interfaces should be used, or binary semaphores instead. Signed-off-by: Bob Moore Signed-off-by: Lin Ming Signed-off-by: Len Brown --- include/acpi/actypes.h | 54 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 14 deletions(-) (limited to 'include/acpi/actypes.h') diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 20f6f9c5f21..24b2cef5a13 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -204,11 +204,10 @@ typedef u32 acpi_physical_address; /******************************************************************************* * - * OS-dependent and compiler-dependent types + * OS-dependent types * * If the defaults below are not appropriate for the host system, they can - * be defined in the compiler-specific or OS-specific header, and this will - * take precedence. + * be defined in the OS-specific header, and this will take precedence. * ******************************************************************************/ @@ -218,12 +217,6 @@ typedef u32 acpi_physical_address; #define acpi_thread_id acpi_size #endif -/* Object returned from acpi_os_create_lock */ - -#ifndef acpi_spinlock -#define acpi_spinlock void * -#endif - /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ #ifndef acpi_cpu_flags @@ -240,6 +233,44 @@ typedef u32 acpi_physical_address; #endif #endif +/* + * Synchronization objects - Mutexes, Semaphores, and spin_locks + */ +#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) +/* + * These macros are used if the host OS does not support a mutex object. + * Map the OSL Mutex interfaces to binary semaphores. + */ +#define acpi_mutex acpi_semaphore +#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle) +#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle) +#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time) +#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1) +#endif + +/* Configurable types for synchronization objects */ + +#ifndef acpi_spinlock +#define acpi_spinlock void * +#endif + +#ifndef acpi_semaphore +#define acpi_semaphore void * +#endif + +#ifndef acpi_mutex +#define acpi_mutex void * +#endif + +/******************************************************************************* + * + * Compiler-dependent types + * + * If the defaults below are not appropriate for the host compiler, they can + * be defined in the compiler-specific header, and this will take precedence. + * + ******************************************************************************/ + /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ #ifndef acpi_uintptr_t @@ -353,11 +384,6 @@ struct uint32_struct { u32 hi; }; -/* Synchronization objects */ - -#define acpi_mutex void * -#define acpi_semaphore void * - /* * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI * version 2, integers are 64 bits. Note that this pertains to the ACPI integer -- cgit v1.2.3