public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Bob Moore <robert.moore@intel.com>,
	Lin Ming <ming.m.lin@intel.com>, Len Brown <len.brown@intel.com>
Subject: [PATCH 81/94] ACPICA: Add ACPI_MUTEX_TYPE configuration option
Date: Fri, 09 Jan 2009 04:27:23 -0500	[thread overview]
Message-ID: <1685bd404dc2ecce2fdae6410e85ded2f2c0136d.1231492614.git.len.brown@intel.com> (raw)
In-Reply-To: <1231493256-11678-1-git-send-email-lenb@kernel.org>
In-Reply-To: <c5279dee26c0e8d7c4200993bfc4b540d2469598.1231492606.git.len.brown@intel.com>

From: Bob Moore <robert.moore@intel.com>

Used to specify whether the OSL mutex interfaces should be used,
or binary semaphores instead.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 include/acpi/acpiosxf.h         |   13 +++------
 include/acpi/actypes.h          |   54 ++++++++++++++++++++++++++++----------
 include/acpi/platform/acenv.h   |   35 +++++++++++++++++++++----
 include/acpi/platform/aclinux.h |    1 +
 4 files changed, 75 insertions(+), 28 deletions(-)

diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index b91440a..a62720a 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -121,8 +121,11 @@ acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
 acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
 
 /*
- * 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 acpi_os_create_mutex(acpi_mutex * out_handle);
 
 void acpi_os_delete_mutex(acpi_mutex handle);
@@ -130,13 +133,7 @@ void acpi_os_delete_mutex(acpi_mutex handle);
 acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
 
 void acpi_os_release_mutex(acpi_mutex handle);
-
-/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
-
-#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
 
 /*
  * Memory allocation and mapping
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 20f6f9c..24b2cef 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
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index cbae39c..e62f10d 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -44,13 +44,26 @@
 #ifndef __ACENV_H__
 #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 acpi_library 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
@@ -167,6 +180,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
@@ -175,9 +201,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/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0515e75..3cabf88 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -46,6 +46,7 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
+#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.5.6.6


  parent reply	other threads:[~2009-01-09  9:28 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09  9:26 ACPI & Suspend related patches for 2.6.29 Len Brown
2009-01-09  9:26 ` [PATCH 01/94] ACPI: EC: Add some basic check for ECDT data Len Brown
2009-01-09  9:26   ` [PATCH 02/94] ACPI: EC: fix compilation warning Len Brown
2009-01-09  9:26   ` [PATCH 03/94] /proc/acpi/alarm: handle day-of-month wraparound on readback Len Brown
2009-01-09  9:26   ` [PATCH 04/94] ACPI: video: Fix reversed brightness behavior on ThinkPad SL series Len Brown
2009-01-09  9:26   ` [PATCH 05/94] Hibernate: Call platform_begin before swsusp_shrink_memory Len Brown
2009-01-09  9:26   ` [PATCH 06/94] ACPI hibernate: Add a mechanism to save/restore ACPI NVS memory Len Brown
2009-01-09  9:26   ` [PATCH 07/94] x86 hibernate: Mark ACPI NVS memory region at startup Len Brown
2009-01-09  9:26   ` [PATCH 08/94] ACPI hibernate: Introduce new kernel parameter acpi_sleep=s4_nonvs Len Brown
2009-01-09  9:26   ` [PATCH 09/94] Hibernate: Do not oops on resume if image data are incorrect Len Brown
2009-01-09  9:26   ` [PATCH 10/94] Hibernate: Take overlapping zones into account (rev. 2) Len Brown
2009-01-09  9:26   ` [PATCH 11/94] Hibernate: Replace unnecessary evaluation of pfn_to_page() Len Brown
2009-01-09  9:26   ` [PATCH 12/94] drivers/misc/Makefile, Kconfig: cleanup Len Brown
2009-01-09  9:26   ` [PATCH 13/94] create drivers/platform/x86/ from drivers/misc/ Len Brown
2009-01-09  9:26   ` [PATCH 14/94] ACPI: move wmi, asus_acpi, toshiba_acpi to drivers/platform/x86 Len Brown
2009-01-09  9:26   ` [PATCH 15/94] doc: fix kernel-parameters.txt formatting Len Brown
2009-01-09  9:26   ` [PATCH 16/94] Newly inserted battery might differ from one just removed, so Len Brown
2009-01-09  9:26   ` [PATCH 17/94] ACPI: disable MPS when NO APIC-table found Len Brown
2009-01-09  9:26   ` [PATCH 18/94] eeepc-laptop: use select and not depends on Len Brown
2009-01-09  9:26   ` [PATCH 19/94] ACPICA: Fix several warnings under gcc 4 compiler Len Brown
2009-01-09  9:26   ` [PATCH 20/94] ACPICA: Update FACS waking vector interfaces Len Brown
2009-01-09  9:26   ` [PATCH 21/94] ACPICA: Fix possible memory leak on error in parser Len Brown
2009-01-09  9:26   ` [PATCH 22/94] ACPICA: Optimize execution of AML While loops Len Brown
2009-01-09  9:26   ` [PATCH 23/94] ACPICA: Add a mechanism to escape infinite AML While() loops Len Brown
2009-01-09  9:26   ` [PATCH 24/94] ACPICA: Update debug output for IndexField I/O Len Brown
2009-01-09  9:26   ` [PATCH 25/94] ACPICA: Fix namestring for the SystemCMOS address space Len Brown
2009-01-09  9:26   ` [PATCH 26/94] ACPICA: Emit warning if two FACS or DSDT tables found in the FADT Len Brown
2009-01-09  9:26   ` [PATCH 27/94] ACPICA: Add global pointer for FACS table to simplify FACS access Len Brown
2009-01-09  9:26   ` [PATCH 28/94] ACPICA: Reformat comments, no functional changes Len Brown
2009-01-09  9:26   ` [PATCH 29/94] ACPICA: Add support to externally execute _OSI method Len Brown
2009-01-09  9:26   ` [PATCH 30/94] ACPICA: Remove references to obsolete ACPI_DUMP_APP Len Brown
2009-01-09  9:26   ` [PATCH 31/94] ACPICA: Fix to allow aliases within ASL namepaths Len Brown
2009-01-09  9:26   ` [PATCH 32/94] ACPICA: Allow multiple backslash prefix in namepaths Len Brown
2009-01-09  9:26   ` [PATCH 33/94] ACPICA: Add Buffer->String conversion for predefined methods Len Brown
2009-01-09  9:26   ` [PATCH 34/94] ACPICA: Consolidate method arg count validation code Len Brown
2009-01-09  9:26   ` [PATCH 35/94] ACPICA: Enhance implicit return mechanism Len Brown
2009-01-09  9:26   ` [PATCH 36/94] ACPICA: Update version to 20081031 Len Brown
2009-01-09  9:26   ` [PATCH 37/94] cpuidle: Add decaying history logic to menu idle predictor Len Brown
2009-01-09  9:26   ` [PATCH 38/94] ACPI: Do not modify SCI_EN directly Len Brown
2009-01-09  9:26   ` [PATCH 39/94] ACPI: PCI: use conventional PCI address format Len Brown
2009-01-09  9:26   ` [PATCH 40/94] ACPI: PCI: remove unnecessary null pointer checks Len Brown
2009-01-09  9:26   ` [PATCH 41/94] ACPI: PCI: simplify buffer management for evaluating _PRT Len Brown
2009-01-09  9:26   ` [PATCH 42/94] ACPI: PCI: ignore _PRT function information Len Brown
2009-01-09  9:26   ` [PATCH 43/94] ACPI: PCI: fix GSI/IRQ naming confusion Len Brown
2009-01-09  9:26   ` [PATCH 44/94] ACPI: PCI: move struct acpi_prt_entry declaration out of public header file Len Brown
2009-01-09  9:26   ` [PATCH 45/94] ACPI: PCI: add a helper to convert _PRT INTx pin number to name Len Brown
2009-01-09  9:26   ` [PATCH 46/94] ACPI: PCI: always use the PCI INTx pin values, not the _PRT ones Len Brown
2009-01-09  9:26   ` [PATCH 47/94] ACPI: PCI: use 1-based encoding for _PRT quirks Len Brown
2009-01-09  9:26   ` [PATCH 48/94] ACPI: PCI: lookup _PRT entry by PCI dev and pin, not segment/bus/dev/pin Len Brown
2009-01-09  9:26   ` [PATCH 49/94] ACPI: PCI: tweak _PRT lookup debug Len Brown
2009-01-09  9:26   ` [PATCH 50/94] ACPI: PCI: remove callback from acpi_pci_irq_lookup & acpi_pci_irq_derive Len Brown
2009-01-09  9:26   ` [PATCH 51/94] ACPI: PCI: use positive logic to simplify code Len Brown
2009-01-09  9:26   ` [PATCH 52/94] ACPI: PCI: follow typical PCI INTx swizzling pattern Len Brown
2009-01-09  9:26   ` [PATCH 53/94] ACPI: PCI: combine lookup and derive Len Brown
2009-01-09  9:26   ` [PATCH 54/94] ACPI: PCI: simplify list of _PRT entries Len Brown
2009-01-09  9:26   ` [PATCH 55/94] ACPI: PCI: simplify struct acpi_prt_entry Len Brown
2009-01-09  9:26   ` [PATCH 56/94] ACPI: PCI: expand acpi_pci_allocate_irq() and acpi_pci_free_irq() inline Len Brown
2009-01-09  9:26   ` [PATCH 57/94] ACPI: PCI: whitespace and useless initialization cleanup Len Brown
2009-01-09  9:27   ` [PATCH 58/94] ACPI: PCI: add HP copyright Len Brown
2009-01-09  9:27   ` [PATCH 59/94] ACPI: simplify buffer management for acpi_pci_bind() etc Len Brown
2009-01-09  9:27   ` [PATCH 60/94] ACPI: ec.c, pci_link.c, video_detec.c: static Len Brown
2009-01-09  9:27   ` [PATCH 61/94] video: always update the brightness when poking "brightness" Len Brown
2009-01-09  9:27   ` [PATCH 62/94] ACPI: osl.c: replace return_ACPI_STATUS with return Len Brown
2009-01-09  9:27   ` [PATCH 63/94] ACPI: ec.c: call acpi_get_name to get node name Len Brown
2009-01-09  9:27   ` [PATCH 64/94] ACPI: proc.c: remove ACPI_FUNCTION_TRACE Len Brown
2009-01-09  9:27   ` [PATCH 65/94] ACPI: wakeup.c: " Len Brown
2009-01-09  9:27   ` [PATCH 66/94] ACPICA: New: acpi_get_gpe_device interface Len Brown
2009-01-09  9:27   ` [PATCH 67/94] ACPICA: New: Public GPE group enable/disable interfaces Len Brown
2009-01-09  9:27   ` [PATCH 68/94] ACPI: main.c: use new public " Len Brown
2009-01-09  9:27   ` [PATCH 69/94] ACPI: sony-laptop.c: call acpi_get_object_info to get node info Len Brown
2009-01-09  9:27   ` [PATCH 70/94] ACPI: power.c: call acpi_get_name to get node name Len Brown
2009-01-09  9:27   ` [PATCH 71/94] ACPI: panasonic-laptop.c: remove ACPI_FUNCTION_TRACE Len Brown
2009-01-09  9:27   ` [PATCH 72/94] ACPI: io_acpi_init.c: call acpi_get_name to get node fullname Len Brown
2009-01-09  9:27   ` [PATCH 73/94] ACPI: io_common.c: call acpi_get_table to avoid using ACPI_SIG_DSDT Len Brown
2009-01-09  9:27   ` [PATCH 74/94] ACPICA: New: acpi_read and acpi_write public interfaces Len Brown
2009-01-09  9:27   ` [PATCH 75/94] ACPICA: Move all public H/W interfaces to new hwxface Len Brown
2009-01-09  9:27   ` [PATCH 76/94] ACPICA: New: acpi_reset interface - write to reset register Len Brown
2009-01-09  9:27   ` [PATCH 77/94] ACPI: reboot.c: use new acpi_reset interface Len Brown
2009-01-09  9:27   ` [PATCH 78/94] ACPI: remove private acpica headers from driver files Len Brown
2009-01-09  9:27   ` [PATCH 80/94] ACPICA: Fixes for various ACPI data tables Len Brown
2009-01-09  9:27   ` Len Brown [this message]
2009-01-09  9:27   ` [PATCH 82/94] ACPICA: FADT parsing changes and fixes Len Brown
2009-01-09  9:27   ` [PATCH 83/94] ACPICA: FADT: set acpi_gbl_use_default_register_widths to TRUE by default Len Brown
2009-01-09  9:27   ` [PATCH 84/94] ACPICA: FADT: Update error msgs for consistency Len Brown
2009-01-09  9:27   ` [PATCH 85/94] ACPICA: Update version to 20081204 Len Brown
2009-01-09  9:27   ` [PATCH 86/94] ACPICA: delete acdisasm.h Len Brown
2009-01-09  9:27   ` [PATCH 87/94] ACPICA: delete utcache.c Len Brown
2009-01-09  9:27   ` [PATCH 88/94] fujitsu-laptop: Add BL power, LED control and radio state information Len Brown
2009-01-09  9:27   ` [PATCH 89/94] fujitsu-laptop: Simplify SBLL/SBL2 backlight handling Len Brown
2009-01-09  9:27   ` [PATCH 90/94] ACPI: Avoid array address overflow when _CST MWAIT hint bits are set Len Brown
2009-01-09  9:27   ` [PATCH 91/94] ACPI : Use RSDT instead of XSDT by adding boot option of "acpi=rsdt" Len Brown
2009-01-09  9:27   ` [PATCH 92/94] ACPI: fix build warning Len Brown
2009-01-09  9:27   ` [PATCH 93/94] ACPICA: create acpica/ directory Len Brown
2009-01-09  9:27   ` [PATCH 94/94] ACPICA: hide private headers Len Brown
2009-01-09 12:06 ` ACPI & Suspend related patches for 2.6.29 Rafael J. Wysocki
2009-01-09 20:04   ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1685bd404dc2ecce2fdae6410e85ded2f2c0136d.1231492614.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox