diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index d3fb8074e..4b9d3c33c 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -233,8 +233,11 @@ AcpiOsSignalSemaphore ( /* - * Mutex primitives + * Mutex primitives. May be configured to use semaphores instead via + * ACPI_MUTEX_TYPE (see platform/acenv.h) */ +#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) + ACPI_STATUS AcpiOsCreateMutex ( ACPI_MUTEX *OutHandle); @@ -251,13 +254,7 @@ AcpiOsAcquireMutex ( void AcpiOsReleaseMutex ( ACPI_MUTEX Handle); - -/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */ - -#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) -#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) -#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) -#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) +#endif /* diff --git a/source/include/actypes.h b/source/include/actypes.h index 3cd6e1e3e..d02555709 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -282,27 +282,19 @@ typedef UINT32 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. * ******************************************************************************/ - /* Value returned by AcpiOsGetThreadId */ #ifndef ACPI_THREAD_ID #define ACPI_THREAD_ID ACPI_SIZE #endif -/* Object returned from AcpiOsCreateLock */ - -#ifndef ACPI_SPINLOCK -#define ACPI_SPINLOCK void * -#endif - /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ #ifndef ACPI_CPU_FLAGS @@ -319,6 +311,45 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; #endif #endif +/* + * Synchronization objects - Mutexes, Semaphores, and SpinLocks + */ +#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 AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) +#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) +#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) +#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (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 @@ -444,12 +475,6 @@ typedef struct uint32_struct } UINT32_STRUCT; -/* 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 diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 3121a7bbf..31c8cd9f2 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -117,13 +117,27 @@ #define __ACENV_H__ -/* +/* Types for ACPI_MUTEX_TYPE */ + +#define ACPI_BINARY_SEMAPHORE 0 +#define ACPI_OSL_MUTEX 1 + +/* Types for DEBUGGER_THREADING */ + +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + + +/****************************************************************************** + * * Configuration for ACPI tools and utilities - */ + * + *****************************************************************************/ + #ifdef ACPI_LIBRARY /* * Note: The non-debug version of the AcpiLibrary does not contain any - * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG + * debug support, for minimal size. The debug version uses ACPI_FULL_DEBUG */ #define ACPI_USE_LOCAL_CACHE #endif @@ -245,6 +259,19 @@ /*! [End] no source code translation !*/ +/****************************************************************************** + * + * Miscellaneous configuration + * + *****************************************************************************/ + +/* + * Are mutexes supported by the host? default is no, use binary semaphores. + */ +#ifndef ACPI_MUTEX_TYPE +#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE +#endif + /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application @@ -253,9 +280,6 @@ * By default the model is single threaded if ACPI_APPLICATION is set, * multi-threaded if ACPI_APPLICATION is not set. */ -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - #ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index 2c30239d9..201955d7c 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -118,6 +118,7 @@ #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_DO_WHILE_0 +#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX #ifdef __KERNEL__