All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ACPICA: Fix some mis-ordered inclusions.
       [not found] <cover.1385110130.git.lv.zheng@intel.com>
@ 2014-04-08  7:55   ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:55 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch fixes some mis-ordered inclusions for Linux resident ACPICA.
There is no real issue in the Linux kernel, but this can help to cleanup
the inclusions so that:
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>
2. Using ACPICA defined types in <asm/acpi.h> is possible.

Lv Zheng (4):
  ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered
    inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of
    <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.
  ACPICA: Remove deprecated _LINUX definitions for ACPICA.

 arch/ia64/include/asm/acenv.h     |   56 +++++++++++++++++
 arch/ia64/include/asm/acpi.h      |   50 ---------------
 arch/x86/include/asm/acenv.h      |   49 +++++++++++++++
 arch/x86/include/asm/acpi.h       |   45 --------------
 include/acpi/platform/aclinux.h   |  104 ++++---------------------------
 include/acpi/platform/aclinuxxf.h |  122 +++++++++++++++++++++++++++++++++++++
 include/linux/acpi.h              |    4 --
 7 files changed, 239 insertions(+), 191 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/platform/aclinuxxf.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH 0/4] ACPICA: Fix some mis-ordered inclusions.
@ 2014-04-08  7:55   ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:55 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch fixes some mis-ordered inclusions for Linux resident ACPICA.
There is no real issue in the Linux kernel, but this can help to cleanup
the inclusions so that:
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>
2. Using ACPICA defined types in <asm/acpi.h> is possible.

Lv Zheng (4):
  ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered
    inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of
    <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.
  ACPICA: Remove deprecated _LINUX definitions for ACPICA.

 arch/ia64/include/asm/acenv.h     |   56 +++++++++++++++++
 arch/ia64/include/asm/acpi.h      |   50 ---------------
 arch/x86/include/asm/acenv.h      |   49 +++++++++++++++
 arch/x86/include/asm/acpi.h       |   45 --------------
 include/acpi/platform/aclinux.h   |  104 ++++---------------------------
 include/acpi/platform/aclinuxxf.h |  122 +++++++++++++++++++++++++++++++++++++
 include/linux/acpi.h              |    4 --
 7 files changed, 239 insertions(+), 191 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/platform/aclinuxxf.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-08  7:55   ` Lv Zheng
@ 2014-04-08  7:56     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:56 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/platform/aclinuxxf.h> to fix this issue by
splitting conditions and declarations (most of them are inline functions)
into 2 header files so that the wrong inclusion of <acpi/actypes.h> can be
removed from <acpi/platform/aclinux.h>.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h   |  101 ++++--------------------------
 include/acpi/platform/aclinuxxf.h |  122 +++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 90 deletions(-)
 create mode 100644 include/acpi/platform/aclinuxxf.h

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f242909..e3ac5a5 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -130,73 +130,6 @@
 
 #ifdef __KERNEL__
 
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
 #ifndef CONFIG_PREEMPT
 
 /*
@@ -212,27 +145,18 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 #endif
 
 /*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
+ * Overrides for in-kernel ACPICA
  */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define USE_NATIVE_ALLOCATE_ZEROED
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
 
 /*
@@ -253,11 +177,8 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
 
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
 #endif				/* __KERNEL__ */
 
+#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
+
 #endif				/* __ACLINUX_H__ */
diff --git a/include/acpi/platform/aclinuxxf.h b/include/acpi/platform/aclinuxxf.h
new file mode 100644
index 0000000..0b54085
--- /dev/null
+++ b/include/acpi/platform/aclinuxxf.h
@@ -0,0 +1,122 @@
+/******************************************************************************
+ *
+ * Name: aclinuxxf.h - Extra OS specific defines, etc. for Linux
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLINUXXF_H__
+#define __ACLINUXXF_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * Memory allocation/deallocation
+ */
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id) (unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
+
+#endif				/* __KERNEL__ */
+
+#endif				/* __ACLINUX_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
@ 2014-04-08  7:56     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:56 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/platform/aclinuxxf.h> to fix this issue by
splitting conditions and declarations (most of them are inline functions)
into 2 header files so that the wrong inclusion of <acpi/actypes.h> can be
removed from <acpi/platform/aclinux.h>.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h   |  101 ++++--------------------------
 include/acpi/platform/aclinuxxf.h |  122 +++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 90 deletions(-)
 create mode 100644 include/acpi/platform/aclinuxxf.h

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f242909..e3ac5a5 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -130,73 +130,6 @@
 
 #ifdef __KERNEL__
 
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
 #ifndef CONFIG_PREEMPT
 
 /*
@@ -212,27 +145,18 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 #endif
 
 /*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
+ * Overrides for in-kernel ACPICA
  */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define USE_NATIVE_ALLOCATE_ZEROED
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
 
 /*
@@ -253,11 +177,8 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
 
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
 #endif				/* __KERNEL__ */
 
+#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
+
 #endif				/* __ACLINUX_H__ */
diff --git a/include/acpi/platform/aclinuxxf.h b/include/acpi/platform/aclinuxxf.h
new file mode 100644
index 0000000..0b54085
--- /dev/null
+++ b/include/acpi/platform/aclinuxxf.h
@@ -0,0 +1,122 @@
+/******************************************************************************
+ *
+ * Name: aclinuxxf.h - Extra OS specific defines, etc. for Linux
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLINUXXF_H__
+#define __ACLINUXXF_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * Memory allocation/deallocation
+ */
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id) (unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
+
+#endif				/* __KERNEL__ */
+
+#endif				/* __ACLINUX_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-08  7:55   ` Lv Zheng
  (?)
@ 2014-04-08  7:56     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:56 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e3ac5a5..a12e9e0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
@ 2014-04-08  7:56     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:56 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e3ac5a5..a12e9e0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/pla
@ 2014-04-08  7:56     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:56 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e3ac5a5..a12e9e0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
  2014-04-08  7:55   ` Lv Zheng
  (?)
@ 2014-04-08  7:57     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a12e9e0..943c167 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
@ 2014-04-08  7:57     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a12e9e0..943c167 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.
@ 2014-04-08  7:57     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a12e9e0..943c167 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 4/4] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-08  7:55   ` Lv Zheng
@ 2014-04-08  7:57     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are _LINUX defined so that when Linux kernel is compiled using broken
compilers that having not __linux__ defined can still include
<acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.

This behavior is deprecated as all drivers/acpi/acpica files are compiled
without including <linux/acpi.h>, thus without _LINUX defined.  As there is
no issues encountered when we compile ACPICA code without _LINUX defined,
it is OK to remove _LINUX from <linux/acpi.h> now.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/acpi.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd..9c559f7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -31,10 +31,6 @@
 
 #ifdef	CONFIG_ACPI
 
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH 4/4] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
@ 2014-04-08  7:57     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-08  7:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are _LINUX defined so that when Linux kernel is compiled using broken
compilers that having not __linux__ defined can still include
<acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.

This behavior is deprecated as all drivers/acpi/acpica files are compiled
without including <linux/acpi.h>, thus without _LINUX defined.  As there is
no issues encountered when we compile ACPICA code without _LINUX defined,
it is OK to remove _LINUX from <linux/acpi.h> now.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/acpi.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd..9c559f7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -31,10 +31,6 @@
 
 #ifdef	CONFIG_ACPI
 
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-08  7:56     ` Lv Zheng
  (?)
@ 2014-04-21 20:58     ` Rafael J. Wysocki
  2014-04-22  2:01         ` Zheng, Lv
  -1 siblings, 1 reply; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-21 20:58 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi

On Tuesday, April 08, 2014 03:56:44 PM Lv Zheng wrote:
> From ACPICA's perspective, <acpi/actypes.h> should be included after
> inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
> <acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
> included <acpi/actypes.h> to find ACPICA types for inline functions.
> 
> This causes the following problem:
> 1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
>    Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
>    consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
>    Which finally leads to the issue that we have to keep many useless macro
>    definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
>    Such conditions include:
>      COMPILER_DEPENDENT_UINT64
>      COMPILER_DEPENDENT_INT64
>      ACPI_INLINE
>      ACPI_SYSTEM_XFACE
>      ACPI_EXTERNAL_XFACE
>      ACPI_INTERNAL_XFACE
>      ACPI_INTERNAL_VAR_XFACE
>      ACPI_MUTEX_TYPE
>      DEBUGGER_THREADING
>      ACPI_ACQUIRE_GLOBAL_LOCK
>      ACPI_RELEASE_GLOBAL_LOCK
>      ACPI_FLUSH_CPU_CACHE
>    They have default implementations in <include/acpi/platform/acenv.h>
>    while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
>    Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
>    ACPI_x_XFACE definitions from asm/acpi.h:
>       CC      init/main.o
>     In file included from include/acpi/platform/aclinux.h:293:0,
>                      from include/acpi/platform/acenv.h:149,
>                      from include/acpi/acpi.h:56,
>                      from include/linux/acpi.h:41,
>                      from init/main.c:27:
>     include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
>     include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
>     In file included from include/acpi/platform/aclinux.h:293:0,
>                      from include/acpi/platform/acenv.h:149,
>                      from include/acpi/acpi.h:56,
>                      from include/linux/acpi.h:41,
>                      from init/main.c:27:
>     include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
>     include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
>     In file included from include/acpi/acpi.h:63:0,
>                      from include/linux/acpi.h:41,
>                      from init/main.c:27:
>     include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
>     include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
>     include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'
> 
> This patch introduces <acpi/platform/aclinuxxf.h> to fix this issue by
> splitting conditions and declarations (most of them are inline functions)
> into 2 header files so that the wrong inclusion of <acpi/actypes.h> can be
> removed from <acpi/platform/aclinux.h>.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
>  include/acpi/platform/aclinux.h   |  101 ++++--------------------------
>  include/acpi/platform/aclinuxxf.h |  122 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 133 insertions(+), 90 deletions(-)
>  create mode 100644 include/acpi/platform/aclinuxxf.h
> 
> diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> index f242909..e3ac5a5 100644
> --- a/include/acpi/platform/aclinux.h
> +++ b/include/acpi/platform/aclinux.h
> @@ -130,73 +130,6 @@
>  
>  #ifdef __KERNEL__
>  
> -/*
> - * FIXME: Inclusion of actypes.h
> - * Linux kernel need this before defining inline OSL interfaces as
> - * actypes.h need to be included to find ACPICA type definitions.
> - * Since from ACPICA's perspective, the actypes.h should be included after
> - * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
> - */
> -#include <acpi/actypes.h>
> -
> -/*
> - * Overrides for in-kernel ACPICA
> - */
> -acpi_status __init acpi_os_initialize(void);
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
> -
> -acpi_status acpi_os_terminate(void);
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
> -
> -/*
> - * Memory allocation/deallocation
> - */
> -
> -/*
> - * The irqs_disabled() check is for resume from RAM.
> - * Interrupts are off during resume, just like they are for boot.
> - * However, boot has  (system_state != SYSTEM_RUNNING)
> - * to quiet __might_sleep() in kmalloc() and resume does not.
> - */
> -static inline void *acpi_os_allocate(acpi_size size)
> -{
> -	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
> -}
> -
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
> -
> -/* Use native linux version of acpi_os_allocate_zeroed */
> -
> -static inline void *acpi_os_allocate_zeroed(acpi_size size)
> -{
> -	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
> -}
> -
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
> -#define USE_NATIVE_ALLOCATE_ZEROED
> -
> -static inline void acpi_os_free(void *memory)
> -{
> -	kfree(memory);
> -}
> -
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
> -
> -static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
> -{
> -	return kmem_cache_zalloc(cache,
> -				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
> -}
> -
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
> -
> -static inline acpi_thread_id acpi_os_get_thread_id(void)
> -{
> -	return (acpi_thread_id) (unsigned long)current;
> -}
> -
> -#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
> -
>  #ifndef CONFIG_PREEMPT
>  
>  /*
> @@ -212,27 +145,18 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
>  #endif
>  
>  /*
> - * When lockdep is enabled, the spin_lock_init() macro stringifies it's
> - * argument and uses that as a name for the lock in debugging.
> - * By executing spin_lock_init() in a macro the key changes from "lock" for
> - * all locks to the name of the argument of acpi_os_create_lock(), which
> - * prevents lockdep from reporting false positives for ACPICA locks.
> + * Overrides for in-kernel ACPICA
>   */
> -#define acpi_os_create_lock(__handle) \
> -	({ \
> -		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
> -		if (lock) { \
> -			*(__handle) = lock; \
> -			spin_lock_init(*(__handle)); \
> -		} \
> -		lock ? AE_OK : AE_NO_MEMORY; \
> -	})
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
> +#define USE_NATIVE_ALLOCATE_ZEROED
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
> -
> -void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
> -
> -void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
>  
>  /*
> @@ -253,11 +177,8 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
>  
> -/*
> - * OSL interfaces added by Linux
> - */
> -void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
> -
>  #endif				/* __KERNEL__ */
>  
> +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>

This is not good.

We don't do things like this in the kernel, because they are confusing and hard
to debug if necessary, so please find a different way to make this work.

And the name aclinuxxf.h is not one of my favourite.

Thanks!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-21 20:58     ` Rafael J. Wysocki
@ 2014-04-22  2:01         ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-22  2:01 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

Hi,

<skip>

> > +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
> 
> This is not good.
> 
> We don't do things like this in the kernel, because they are confusing and hard
> to debug if necessary, so please find a different way to make this work.

I use this extra header file to collect:
1. static inline OSL functions
2. divergences of prototypes that haven't been back ported to ACPICA.
This file is useful for ACPICA release automation.

There are the following concerns that lead to the use of this solution:
1. for this extra header file itself
    A. The new header file is OSPM specific, thus it needn't be upstreamed to ACPICA;
    B. Since it needn't be upstreamed to ACPICA, ACPICA needn't determine the name of this extra header;
    C. It has to be the last file included by <acpi/acpi.h>.
2. for the file that includes this extra header file
    A. Currently there is no OSPM specific code in <acpi/acpi.h>.
Thus I use a macro so that there is still no OSPM specific code in <acpi/acpi.h> and the name of the extra header can be determined by OSPM.

If you want another solution, is the following acceptable?
1. In <acpi/platform/aclinux.h>
    #define ACPI_INCLUDE_EXTRA_NATIVE_HEADER	1
2. In <acpi/acpi.h> <- this is an ACPICA header file, 
    #ifdef ACPI_INCLUDE_EXTRA_NATIVE_HEADER
    #include <acpi/platform/acextra.h>
    #endif
Note that in this solution, the name of the extra header file will be determined by ACPICA.

> And the name aclinuxxf.h is not one of my favourite.

Since this file needn't be upstreamed into ACPICA, could you help to determine it if the acextra.h was still not acceptable?

Thanks and best regards
-Lv

> 
> Thanks!
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
@ 2014-04-22  2:01         ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-22  2:01 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1940 bytes --]

Hi,

<skip>

> > +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
> 
> This is not good.
> 
> We don't do things like this in the kernel, because they are confusing and hard
> to debug if necessary, so please find a different way to make this work.

I use this extra header file to collect:
1. static inline OSL functions
2. divergences of prototypes that haven't been back ported to ACPICA.
This file is useful for ACPICA release automation.

There are the following concerns that lead to the use of this solution:
1. for this extra header file itself
    A. The new header file is OSPM specific, thus it needn't be upstreamed to ACPICA;
    B. Since it needn't be upstreamed to ACPICA, ACPICA needn't determine the name of this extra header;
    C. It has to be the last file included by <acpi/acpi.h>.
2. for the file that includes this extra header file
    A. Currently there is no OSPM specific code in <acpi/acpi.h>.
Thus I use a macro so that there is still no OSPM specific code in <acpi/acpi.h> and the name of the extra header can be determined by OSPM.

If you want another solution, is the following acceptable?
1. In <acpi/platform/aclinux.h>
    #define ACPI_INCLUDE_EXTRA_NATIVE_HEADER	1
2. In <acpi/acpi.h> <- this is an ACPICA header file, 
    #ifdef ACPI_INCLUDE_EXTRA_NATIVE_HEADER
    #include <acpi/platform/acextra.h>
    #endif
Note that in this solution, the name of the extra header file will be determined by ACPICA.

> And the name aclinuxxf.h is not one of my favourite.

Since this file needn't be upstreamed into ACPICA, could you help to determine it if the acextra.h was still not acceptable?

Thanks and best regards
-Lv

> 
> Thanks!
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-22  2:01         ` Zheng, Lv
  (?)
@ 2014-04-22 11:16         ` Rafael J. Wysocki
  2014-04-23  1:06             ` Zheng, Lv
  -1 siblings, 1 reply; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-22 11:16 UTC (permalink / raw)
  To: Zheng, Lv
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

On Tuesday, April 22, 2014 02:01:57 AM Zheng, Lv wrote:
> Hi,
> 
> <skip>
> 
> > > +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
> > 
> > This is not good.
> > 
> > We don't do things like this in the kernel, because they are confusing and hard
> > to debug if necessary, so please find a different way to make this work.
> 
> I use this extra header file to collect:

I was not talking about the new header, which is basically OK, but about the
#define above, which is just too confusing to live.

Please use header file paths directly with #include.

> 1. static inline OSL functions
> 2. divergences of prototypes that haven't been back ported to ACPICA.
> This file is useful for ACPICA release automation.
> 
> There are the following concerns that lead to the use of this solution:
> 1. for this extra header file itself
>     A. The new header file is OSPM specific, thus it needn't be upstreamed to ACPICA;
>     B. Since it needn't be upstreamed to ACPICA, ACPICA needn't determine the name of this extra header;
>     C. It has to be the last file included by <acpi/acpi.h>.
> 2. for the file that includes this extra header file
>     A. Currently there is no OSPM specific code in <acpi/acpi.h>.
> Thus I use a macro so that there is still no OSPM specific code in <acpi/acpi.h> and the name of the extra header can be determined by OSPM.
> 
> If you want another solution, is the following acceptable?
> 1. In <acpi/platform/aclinux.h>
>     #define ACPI_INCLUDE_EXTRA_NATIVE_HEADER	1
> 2. In <acpi/acpi.h> <- this is an ACPICA header file, 
>     #ifdef ACPI_INCLUDE_EXTRA_NATIVE_HEADER
>     #include <acpi/platform/acextra.h>
>     #endif
> Note that in this solution, the name of the extra header file will be determined by ACPICA.

I think I see what you're trying to do now.  And I see that this ACPI_NATIVE_INTERFACE_HEADER
thing is already there in the Linus' tree which is not good at all.

I probably would create an extra ACPICA header, something like <acpios_opt.h>,
that would be empty for all hosts except for Linux and that would contain the
stuff you want to put into acextra.h in Linux.

That would be clean enough I suppose?

Rafael

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-22 11:16         ` Rafael J. Wysocki
@ 2014-04-23  1:06             ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-23  1:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Tuesday, April 22, 2014 7:16 PM
> 
> On Tuesday, April 22, 2014 02:01:57 AM Zheng, Lv wrote:
> > Hi,
> >
> > <skip>
> >
> > > > +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
> > >
> > > This is not good.
> > >
> > > We don't do things like this in the kernel, because they are confusing and hard
> > > to debug if necessary, so please find a different way to make this work.
> >
> > I use this extra header file to collect:
> 
> I was not talking about the new header, which is basically OK, but about the
> #define above, which is just too confusing to live.
> 
> Please use header file paths directly with #include.

OK.

> 
> > 1. static inline OSL functions
> > 2. divergences of prototypes that haven't been back ported to ACPICA.
> > This file is useful for ACPICA release automation.
> >
> > There are the following concerns that lead to the use of this solution:
> > 1. for this extra header file itself
> >     A. The new header file is OSPM specific, thus it needn't be upstreamed to ACPICA;
> >     B. Since it needn't be upstreamed to ACPICA, ACPICA needn't determine the name of this extra header;
> >     C. It has to be the last file included by <acpi/acpi.h>.
> > 2. for the file that includes this extra header file
> >     A. Currently there is no OSPM specific code in <acpi/acpi.h>.
> > Thus I use a macro so that there is still no OSPM specific code in <acpi/acpi.h> and the name of the extra header can be determined
> by OSPM.
> >
> > If you want another solution, is the following acceptable?
> > 1. In <acpi/platform/aclinux.h>
> >     #define ACPI_INCLUDE_EXTRA_NATIVE_HEADER	1
> > 2. In <acpi/acpi.h> <- this is an ACPICA header file,
> >     #ifdef ACPI_INCLUDE_EXTRA_NATIVE_HEADER
> >     #include <acpi/platform/acextra.h>
> >     #endif
> > Note that in this solution, the name of the extra header file will be determined by ACPICA.
> 
> I think I see what you're trying to do now.  And I see that this ACPI_NATIVE_INTERFACE_HEADER
> thing is already there in the Linus' tree which is not good at all.
> 
> I probably would create an extra ACPICA header, something like <acpios_opt.h>,
> that would be empty for all hosts except for Linux and that would contain the
> stuff you want to put into acextra.h in Linux.
> 
> That would be clean enough I suppose?

Yes, it is clear.
Thanks for the helping.
I'll update this patch and re-send this series.

Best regards
-Lv

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
@ 2014-04-23  1:06             ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-23  1:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2651 bytes --]

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Tuesday, April 22, 2014 7:16 PM
> 
> On Tuesday, April 22, 2014 02:01:57 AM Zheng, Lv wrote:
> > Hi,
> >
> > <skip>
> >
> > > > +#define ACPI_NATIVE_INTERFACE_HEADER	<acpi/platform/aclinuxxf.h>
> > >
> > > This is not good.
> > >
> > > We don't do things like this in the kernel, because they are confusing and hard
> > > to debug if necessary, so please find a different way to make this work.
> >
> > I use this extra header file to collect:
> 
> I was not talking about the new header, which is basically OK, but about the
> #define above, which is just too confusing to live.
> 
> Please use header file paths directly with #include.

OK.

> 
> > 1. static inline OSL functions
> > 2. divergences of prototypes that haven't been back ported to ACPICA.
> > This file is useful for ACPICA release automation.
> >
> > There are the following concerns that lead to the use of this solution:
> > 1. for this extra header file itself
> >     A. The new header file is OSPM specific, thus it needn't be upstreamed to ACPICA;
> >     B. Since it needn't be upstreamed to ACPICA, ACPICA needn't determine the name of this extra header;
> >     C. It has to be the last file included by <acpi/acpi.h>.
> > 2. for the file that includes this extra header file
> >     A. Currently there is no OSPM specific code in <acpi/acpi.h>.
> > Thus I use a macro so that there is still no OSPM specific code in <acpi/acpi.h> and the name of the extra header can be determined
> by OSPM.
> >
> > If you want another solution, is the following acceptable?
> > 1. In <acpi/platform/aclinux.h>
> >     #define ACPI_INCLUDE_EXTRA_NATIVE_HEADER	1
> > 2. In <acpi/acpi.h> <- this is an ACPICA header file,
> >     #ifdef ACPI_INCLUDE_EXTRA_NATIVE_HEADER
> >     #include <acpi/platform/acextra.h>
> >     #endif
> > Note that in this solution, the name of the extra header file will be determined by ACPICA.
> 
> I think I see what you're trying to do now.  And I see that this ACPI_NATIVE_INTERFACE_HEADER
> thing is already there in the Linus' tree which is not good at all.
> 
> I probably would create an extra ACPICA header, something like <acpios_opt.h>,
> that would be empty for all hosts except for Linux and that would contain the
> stuff you want to put into acextra.h in Linux.
> 
> That would be clean enough I suppose?

Yes, it is clear.
Thanks for the helping.
I'll update this patch and re-send this series.

Best regards
-Lv
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v2 0/5] ACPICA: Fix some mis-ordered inclusions.
  2014-04-08  7:55   ` Lv Zheng
@ 2014-04-23  6:53     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch fixes some mis-ordered inclusions for Linux resident ACPICA.

There is no real issue in the Linux kernel, but this can help to cleanup
the code so that (benefits):
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>.
2. Lift a burden off the ACPICA release automation - copying default ACPICA
   environment setting to all <asm/acpi.h> file each time a new environment
   is introduced just in order to avoid build errors.
3. The wrong <acpi/actypes.h> inclusion can be removed from
   <acpi/platform/aclinux.h>.
4. Using ACPICA defined types in <asm/acpi.h> is possible.
5. Using "static inline" to define ACPICA OSL functions is still possible
   and won't cause build errors any longer.
6. All non back ported prototypes are collected in a single file.

The patch set has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + default + COFNIG_ACPI=n
3. x86_64 + default + COFNIG_ACPI=y
4. x86_64 + default + COFNIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All drivers/acpi configurations
   All platform drivers
   All ACPI drivers
   4 DRM drivers that implement ACPI opregion
   All buses with ACPI bindings
   All cpufreq configurations
   All xen configurations
   All ACPI tabln drivers

Lv Zheng (5):
  ACPICA: OSL: Add direct inclusion of extra header.
  ACPICA: Add <acpi/acpi_opt.h> to remove mis-ordered inclusion of
    <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of
    <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.
  ACPICA: Remove deprecated _LINUX definitions for ACPICA.

 arch/ia64/include/asm/acenv.h   |   56 +++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 -------------------
 arch/x86/include/asm/acenv.h    |   49 ++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -----------------
 include/acpi/acpi.h             |    4 +-
 include/acpi/acpi_opt.h         |   90 +++++++++++++++++++++++++++++++++
 include/acpi/platform/aclinux.h |  104 +++++----------------------------------
 include/linux/acpi.h            |    4 --
 8 files changed, 209 insertions(+), 193 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/acpi_opt.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v2 0/5] ACPICA: Fix some mis-ordered inclusions.
@ 2014-04-23  6:53     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch fixes some mis-ordered inclusions for Linux resident ACPICA.

There is no real issue in the Linux kernel, but this can help to cleanup
the code so that (benefits):
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>.
2. Lift a burden off the ACPICA release automation - copying default ACPICA
   environment setting to all <asm/acpi.h> file each time a new environment
   is introduced just in order to avoid build errors.
3. The wrong <acpi/actypes.h> inclusion can be removed from
   <acpi/platform/aclinux.h>.
4. Using ACPICA defined types in <asm/acpi.h> is possible.
5. Using "static inline" to define ACPICA OSL functions is still possible
   and won't cause build errors any longer.
6. All non back ported prototypes are collected in a single file.

The patch set has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + default + COFNIG_ACPI=n
3. x86_64 + default + COFNIG_ACPI=y
4. x86_64 + default + COFNIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All drivers/acpi configurations
   All platform drivers
   All ACPI drivers
   4 DRM drivers that implement ACPI opregion
   All buses with ACPI bindings
   All cpufreq configurations
   All xen configurations
   All ACPI tabln drivers

Lv Zheng (5):
  ACPICA: OSL: Add direct inclusion of extra header.
  ACPICA: Add <acpi/acpi_opt.h> to remove mis-ordered inclusion of
    <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of
    <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.
  ACPICA: Remove deprecated _LINUX definitions for ACPICA.

 arch/ia64/include/asm/acenv.h   |   56 +++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 -------------------
 arch/x86/include/asm/acenv.h    |   49 ++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -----------------
 include/acpi/acpi.h             |    4 +-
 include/acpi/acpi_opt.h         |   90 +++++++++++++++++++++++++++++++++
 include/acpi/platform/aclinux.h |  104 +++++----------------------------------
 include/linux/acpi.h            |    4 --
 8 files changed, 209 insertions(+), 193 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/acpi_opt.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header.
  2014-04-23  6:53     ` Lv Zheng
@ 2014-04-23  6:53       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This is a linuxized result of an ACPICA commit to upgrade the extra
header mechanism.

This patch enhances the extra header solution to allow Linux to use
ACPI_USE_NATIVE_INTERFACE_HEADER and the file name can be automatically
replaced during ACPICA release process. Using this way, the rest of the
ACPICA users needn't know the name of the extra header file. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ca0cb60..682398b 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -62,8 +62,8 @@
 #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
 #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
 #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
-#ifdef ACPI_NATIVE_INTERFACE_HEADER
-#include ACPI_NATIVE_INTERFACE_HEADER
+#ifdef ACPI_USE_NATIVE_INTERFACE_HEADER
+#include <acpi/acpi_opt.h>
 #endif
 
 #endif				/* __ACPI_H__ */
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header.
@ 2014-04-23  6:53       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This is a linuxized result of an ACPICA commit to upgrade the extra
header mechanism.

This patch enhances the extra header solution to allow Linux to use
ACPI_USE_NATIVE_INTERFACE_HEADER and the file name can be automatically
replaced during ACPICA release process. Using this way, the rest of the
ACPICA users needn't know the name of the extra header file. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ca0cb60..682398b 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -62,8 +62,8 @@
 #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
 #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
 #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
-#ifdef ACPI_NATIVE_INTERFACE_HEADER
-#include ACPI_NATIVE_INTERFACE_HEADER
+#ifdef ACPI_USE_NATIVE_INTERFACE_HEADER
+#include <acpi/acpi_opt.h>
 #endif
 
 #endif				/* __ACPI_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 2/5] ACPICA: Add <acpi/acpi_opt.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-04-23  6:53     ` Lv Zheng
@ 2014-04-23  6:53       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/acpi_opt.h> to fix this issue by splitting
conditions and declarations (most of them are inline functions) into 2
header files so that the wrong inclusion of <acpi/actypes.h> can be removed
from <acpi/platform/aclinux.h>.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi_opt.h         |   90 ++++++++++++++++++++++++++++++++++
 include/acpi/platform/aclinux.h |  101 +++++----------------------------------
 2 files changed, 101 insertions(+), 90 deletions(-)
 create mode 100644 include/acpi/acpi_opt.h

diff --git a/include/acpi/acpi_opt.h b/include/acpi/acpi_opt.h
new file mode 100644
index 0000000..51ccbe5
--- /dev/null
+++ b/include/acpi/acpi_opt.h
@@ -0,0 +1,90 @@
+/*
+ * Extra OS specific ACPI defines for Linux.
+ *
+ * Copyright (C) 2014, Intel Corporation
+ * Authors: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ACPI_OPT_H_
+#define _ACPI_OPT_H_
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * Memory allocation/deallocation
+ */
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t *cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id)(unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem *logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size);
+
+#endif
+
+#endif
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f242909..a20f051 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -130,73 +130,6 @@
 
 #ifdef __KERNEL__
 
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
 #ifndef CONFIG_PREEMPT
 
 /*
@@ -212,27 +145,18 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 #endif
 
 /*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
+ * Overrides for in-kernel ACPICA
  */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define USE_NATIVE_ALLOCATE_ZEROED
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
 
 /*
@@ -253,11 +177,8 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
 
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
 #endif				/* __KERNEL__ */
 
+#define ACPI_USE_NATIVE_INTERFACE_HEADER    1
+
 #endif				/* __ACLINUX_H__ */
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 2/5] ACPICA: Add <acpi/acpi_opt.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
@ 2014-04-23  6:53       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:53 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/acpi_opt.h> to fix this issue by splitting
conditions and declarations (most of them are inline functions) into 2
header files so that the wrong inclusion of <acpi/actypes.h> can be removed
from <acpi/platform/aclinux.h>.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi_opt.h         |   90 ++++++++++++++++++++++++++++++++++
 include/acpi/platform/aclinux.h |  101 +++++----------------------------------
 2 files changed, 101 insertions(+), 90 deletions(-)
 create mode 100644 include/acpi/acpi_opt.h

diff --git a/include/acpi/acpi_opt.h b/include/acpi/acpi_opt.h
new file mode 100644
index 0000000..51ccbe5
--- /dev/null
+++ b/include/acpi/acpi_opt.h
@@ -0,0 +1,90 @@
+/*
+ * Extra OS specific ACPI defines for Linux.
+ *
+ * Copyright (C) 2014, Intel Corporation
+ * Authors: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ACPI_OPT_H_
+#define _ACPI_OPT_H_
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * Memory allocation/deallocation
+ */
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t *cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id)(unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem *logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size);
+
+#endif
+
+#endif
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f242909..a20f051 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -130,73 +130,6 @@
 
 #ifdef __KERNEL__
 
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
 #ifndef CONFIG_PREEMPT
 
 /*
@@ -212,27 +145,18 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 #endif
 
 /*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
+ * Overrides for in-kernel ACPICA
  */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define USE_NATIVE_ALLOCATE_ZEROED
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
 
 /*
@@ -253,11 +177,8 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
 
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
 #endif				/* __KERNEL__ */
 
+#define ACPI_USE_NATIVE_INTERFACE_HEADER    1
+
 #endif				/* __ACLINUX_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-23  6:53     ` Lv Zheng
  (?)
@ 2014-04-23  6:54       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a20f051..99d0546 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
@ 2014-04-23  6:54       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a20f051..99d0546 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/
@ 2014-04-23  6:54       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index d651102..b0ddcfd 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index a20f051..99d0546 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 /* Host-dependent types and defines for in-kernel ACPICA */
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
  2014-04-23  6:53     ` Lv Zheng
  (?)
@ 2014-04-23  6:54       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 99d0546..90eea12 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
@ 2014-04-23  6:54       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 99d0546..90eea12 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/ace
@ 2014-04-23  6:54       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 99d0546..90eea12 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-23  6:53     ` Lv Zheng
@ 2014-04-23  6:54       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are _LINUX defined so that when Linux kernel is compiled using broken
compilers that having not __linux__ defined can still include
<acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.

This behavior is deprecated as all drivers/acpi/acpica files are compiled
without including <linux/acpi.h>, thus without _LINUX defined.  As there is
no issues encountered when we compile ACPICA code without _LINUX defined,
it is OK to remove _LINUX from <linux/acpi.h> now.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/acpi.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd..9c559f7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -31,10 +31,6 @@
 
 #ifdef	CONFIG_ACPI
 
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
@ 2014-04-23  6:54       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-04-23  6:54 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are _LINUX defined so that when Linux kernel is compiled using broken
compilers that having not __linux__ defined can still include
<acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.

This behavior is deprecated as all drivers/acpi/acpica files are compiled
without including <linux/acpi.h>, thus without _LINUX defined.  As there is
no issues encountered when we compile ACPICA code without _LINUX defined,
it is OK to remove _LINUX from <linux/acpi.h> now.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/acpi.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd..9c559f7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -31,10 +31,6 @@
 
 #ifdef	CONFIG_ACPI
 
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header.
  2014-04-23  6:53       ` Lv Zheng
  (?)
@ 2014-04-27 21:33       ` Rafael J. Wysocki
  2014-04-28  4:12           ` Zheng, Lv
  -1 siblings, 1 reply; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-27 21:33 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi

On Wednesday, April 23, 2014 02:53:52 PM Lv Zheng wrote:
> This is a linuxized result of an ACPICA commit to upgrade the extra
> header mechanism.
> 
> This patch enhances the extra header solution to allow Linux to use
> ACPI_USE_NATIVE_INTERFACE_HEADER and the file name can be automatically
> replaced during ACPICA release process. Using this way, the rest of the
> ACPICA users needn't know the name of the extra header file. Lv Zheng.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
>  include/acpi/acpi.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
> index ca0cb60..682398b 100644
> --- a/include/acpi/acpi.h
> +++ b/include/acpi/acpi.h
> @@ -62,8 +62,8 @@
>  #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
>  #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
>  #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
> -#ifdef ACPI_NATIVE_INTERFACE_HEADER
> -#include ACPI_NATIVE_INTERFACE_HEADER
> +#ifdef ACPI_USE_NATIVE_INTERFACE_HEADER
> +#include <acpi/acpi_opt.h>
>  #endif
>  
>  #endif				/* __ACPI_H__ */

Well, I still think there's a better way.

Introduce <acpi/platform/acenvex.h> into ACPICA and put this into it:

#if defined(_LINUX) || defined(__linux__)
#include <acpi/platform/aclinuxex.h>

#endif

and then move stuff you want in acpi/acpi_opt.h into acpi/platform/aclinuxex.h.

Then, you'll have in acpi.h:

#include <acpi/acrestyp.h>		/* Resource Descriptor structs */
#include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
#include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
#include <acpi/platform/acenvex.h>	/* Extra environment-specific items */


That should work I suppose, shouldn't it?


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-23  6:54       ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Lv Zheng
@ 2014-04-27 21:36         ` Rafael J. Wysocki
  -1 siblings, 0 replies; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-27 21:36 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Tony Luck, Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> There is a mis-order inclusion for <asm/acpi.h>.
> 
> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> can find the inclusion order is as follows:
> 
> <linux/acpi.h>
>   <acpi/acpi.h>
>    <acpi/platform/acenv.h>
>     (acenv.h before including aclinux.h)
>     <acpi/platform/aclinux.h>
> ...........................................................................
>      (aclinux.h before including asm/acpi.h)
>      <asm/acpi.h>                             @Redundant@
>       (ACPICA specific stuff)
> ...........................................................................
> ...........................................................................
>       (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
>      (aclinux.h after including asm/acpi.h)   @Invisible@   |
>     (acenv.h after including aclinux.h)       @Invisible@   |
>    other ACPICA headers                       @Invisible@   |
> ............................................................|..............
>   <acpi/acpi_bus.h>                                         |
>   <acpi/acpi_drivers.h>                                     |
>   <asm/acpi.h> (Excluded)                                   |
>    (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> 
> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> generated <generated/autoconf.h> for Linux, it is meant to be included
> before including any ACPICA code.
> 
> In the above figure, there is a question mark for "Linux ACPI specific
> stuff" in <asm/acpi.h> which should be included after including all other
> ACPICA header files.  Thus they really need to be moved to the position
> marked with exclaimation mark or the definitions in the blocks marked with
> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> specific stuff" header blocks.  This leaves 2 issues:
> 1. All environmental definitions in these blocks should have a copy in the
>    area marked with "@Redundant@" if they are required by the "Linux ACPI
>    specific stuff".
> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> 
> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> fix this issue.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Fenghua Yu <fenghua.yu@intel.com>
> Cc: linux-ia64@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> ---
>  arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
>  arch/ia64/include/asm/acpi.h    |   50 ---------------------------
>  arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
>  arch/x86/include/asm/acpi.h     |   45 -------------------------
>  include/acpi/platform/aclinux.h |    2 +-

Please rename the files first (in a separate patch) and then modify the
renamed ones.  That will make changes much easier to follow.

>  5 files changed, 137 insertions(+), 96 deletions(-)
>  create mode 100644 arch/ia64/include/asm/acenv.h
>  create mode 100644 arch/x86/include/asm/acenv.h
> 
> diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
> new file mode 100644
> index 0000000..e0896eb
> --- /dev/null
> +++ b/arch/ia64/include/asm/acenv.h
> @@ -0,0 +1,71 @@
> +/*
> + * IA64 specific ACPICA environments and implementation
> + *
> + * Copyright (C) 2014, Intel Corporation
> + *   Author: Lv Zheng <lv.zheng@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _ASM_IA64_ACENV_H
> +#define _ASM_IA64_ACENV_H
> +
> +#include <asm/intrinsics.h>
> +
> +#define COMPILER_DEPENDENT_INT64	long
> +#define COMPILER_DEPENDENT_UINT64	unsigned long
> +
> +/*
> + * Calling conventions:
> + *
> + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> + */
> +#define ACPI_SYSTEM_XFACE
> +#define ACPI_EXTERNAL_XFACE
> +#define ACPI_INTERNAL_XFACE
> +#define ACPI_INTERNAL_VAR_XFACE
> +
> +/* Asm macros */
> +
> +#define ACPI_FLUSH_CPU_CACHE()
> +
> +#ifdef CONFIG_ACPI
> +
> +static inline int
> +ia64_acpi_acquire_global_lock(unsigned int *lock)
> +{
> +	unsigned int old, new, val;
> +	do {
> +		old = *lock;
> +		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> +		val = ia64_cmpxchg4_acq(lock, new, old);
> +	} while (unlikely (val != old));
> +	return (new < 3) ? -1 : 0;
> +}
> +
> +static inline int
> +ia64_acpi_release_global_lock(unsigned int *lock)
> +{
> +	unsigned int old, new, val;
> +	do {
> +		old = *lock;
> +		new = old & ~0x3;
> +		val = ia64_cmpxchg4_acq(lock, new, old);
> +	} while (unlikely (val != old));
> +	return old & 0x1;
> +}
> +
> +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> +	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> +
> +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> +	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> +
> +#endif
> +
> +#endif /* _ASM_IA64_ACENV_H */
> diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
> index d651102..b0ddcfd 100644
> --- a/arch/ia64/include/asm/acpi.h
> +++ b/arch/ia64/include/asm/acpi.h
> @@ -34,56 +34,6 @@
>  #include <linux/numa.h>
>  #include <asm/numa.h>
>  
> -#define COMPILER_DEPENDENT_INT64	long
> -#define COMPILER_DEPENDENT_UINT64	unsigned long
> -
> -/*
> - * Calling conventions:
> - *
> - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> - */
> -#define ACPI_SYSTEM_XFACE
> -#define ACPI_EXTERNAL_XFACE
> -#define ACPI_INTERNAL_XFACE
> -#define ACPI_INTERNAL_VAR_XFACE
> -
> -/* Asm macros */
> -
> -#define ACPI_FLUSH_CPU_CACHE()
> -
> -static inline int
> -ia64_acpi_acquire_global_lock (unsigned int *lock)
> -{
> -	unsigned int old, new, val;
> -	do {
> -		old = *lock;
> -		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> -		val = ia64_cmpxchg4_acq(lock, new, old);
> -	} while (unlikely (val != old));
> -	return (new < 3) ? -1 : 0;
> -}
> -
> -static inline int
> -ia64_acpi_release_global_lock (unsigned int *lock)
> -{
> -	unsigned int old, new, val;
> -	do {
> -		old = *lock;
> -		new = old & ~0x3;
> -		val = ia64_cmpxchg4_acq(lock, new, old);
> -	} while (unlikely (val != old));
> -	return old & 0x1;
> -}
> -
> -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> -	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> -
> -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> -	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> -
>  #ifdef	CONFIG_ACPI
>  #define acpi_disabled 0	/* ACPI always enabled on IA64 */
>  #define acpi_noirq 0	/* ACPI always enabled on IA64 */
> diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
> new file mode 100644
> index 0000000..6978584
> --- /dev/null
> +++ b/arch/x86/include/asm/acenv.h
> @@ -0,0 +1,65 @@
> +/*
> + * X86 specific ACPICA environments and implementation
> + *
> + * Copyright (C) 2014, Intel Corporation
> + *   Author: Lv Zheng <lv.zheng@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _ASM_X86_ACENV_H
> +#define _ASM_X86_ACENV_H
> +
> +#include <asm/special_insns.h>
> +
> +#define COMPILER_DEPENDENT_INT64   long long
> +#define COMPILER_DEPENDENT_UINT64  unsigned long long
> +
> +/*
> + * Calling conventions:
> + *
> + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> + */
> +#define ACPI_SYSTEM_XFACE
> +#define ACPI_EXTERNAL_XFACE
> +#define ACPI_INTERNAL_XFACE
> +#define ACPI_INTERNAL_VAR_XFACE
> +
> +/* Asm macros */
> +
> +#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> +
> +#ifdef CONFIG_ACPI
> +
> +int __acpi_acquire_global_lock(unsigned int *lock);
> +int __acpi_release_global_lock(unsigned int *lock);
> +
> +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> +	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> +
> +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> +	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> +
> +/*
> + * Math helper asm macros
> + */
> +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> +	asm("divl %2;"				     \
> +	    : "=a"(q32), "=d"(r32)		     \
> +	    : "r"(d32),				     \
> +	     "0"(n_lo), "1"(n_hi))
> +
> +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> +	asm("shrl   $1,%2	;"	\
> +	    "rcrl   $1,%3;"		\
> +	    : "=r"(n_hi), "=r"(n_lo)	\
> +	    : "0"(n_hi), "1"(n_lo))
> +
> +#endif
> +
> +#endif /* _ASM_X86_ACENV_H */
> diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
> index c8c1e70..e06225e 100644
> --- a/arch/x86/include/asm/acpi.h
> +++ b/arch/x86/include/asm/acpi.h
> @@ -32,51 +32,6 @@
>  #include <asm/mpspec.h>
>  #include <asm/realmode.h>
>  
> -#define COMPILER_DEPENDENT_INT64   long long
> -#define COMPILER_DEPENDENT_UINT64  unsigned long long
> -
> -/*
> - * Calling conventions:
> - *
> - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> - */
> -#define ACPI_SYSTEM_XFACE
> -#define ACPI_EXTERNAL_XFACE
> -#define ACPI_INTERNAL_XFACE
> -#define ACPI_INTERNAL_VAR_XFACE
> -
> -/* Asm macros */
> -
> -#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> -
> -int __acpi_acquire_global_lock(unsigned int *lock);
> -int __acpi_release_global_lock(unsigned int *lock);
> -
> -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> -	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> -
> -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> -	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> -
> -/*
> - * Math helper asm macros
> - */
> -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> -	asm("divl %2;"				     \
> -	    : "=a"(q32), "=d"(r32)		     \
> -	    : "r"(d32),				     \
> -	     "0"(n_lo), "1"(n_hi))
> -
> -
> -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> -	asm("shrl   $1,%2	;"	\
> -	    "rcrl   $1,%3;"		\
> -	    : "=r"(n_hi), "=r"(n_lo)	\
> -	    : "0"(n_hi), "1"(n_lo))
> -
>  #ifdef CONFIG_ACPI
>  extern int acpi_lapic;
>  extern int acpi_ioapic;
> diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> index a20f051..99d0546 100644
> --- a/include/acpi/platform/aclinux.h
> +++ b/include/acpi/platform/aclinux.h
> @@ -71,7 +71,7 @@
>  #ifdef EXPORT_ACPI_INTERFACES
>  #include <linux/export.h>
>  #endif
> -#include <asm/acpi.h>
> +#include <asm/acenv.h>
>  
>  /* Host-dependent types and defines for in-kernel ACPICA */
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a
@ 2014-04-27 21:36         ` Rafael J. Wysocki
  0 siblings, 0 replies; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-27 21:36 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Tony Luck, Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> There is a mis-order inclusion for <asm/acpi.h>.
> 
> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> can find the inclusion order is as follows:
> 
> <linux/acpi.h>
>   <acpi/acpi.h>
>    <acpi/platform/acenv.h>
>     (acenv.h before including aclinux.h)
>     <acpi/platform/aclinux.h>
> ...........................................................................
>      (aclinux.h before including asm/acpi.h)
>      <asm/acpi.h>                             @Redundant@
>       (ACPICA specific stuff)
> ...........................................................................
> ...........................................................................
>       (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
>      (aclinux.h after including asm/acpi.h)   @Invisible@   |
>     (acenv.h after including aclinux.h)       @Invisible@   |
>    other ACPICA headers                       @Invisible@   |
> ............................................................|..............
>   <acpi/acpi_bus.h>                                         |
>   <acpi/acpi_drivers.h>                                     |
>   <asm/acpi.h> (Excluded)                                   |
>    (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> 
> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> generated <generated/autoconf.h> for Linux, it is meant to be included
> before including any ACPICA code.
> 
> In the above figure, there is a question mark for "Linux ACPI specific
> stuff" in <asm/acpi.h> which should be included after including all other
> ACPICA header files.  Thus they really need to be moved to the position
> marked with exclaimation mark or the definitions in the blocks marked with
> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> specific stuff" header blocks.  This leaves 2 issues:
> 1. All environmental definitions in these blocks should have a copy in the
>    area marked with "@Redundant@" if they are required by the "Linux ACPI
>    specific stuff".
> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> 
> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> fix this issue.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Fenghua Yu <fenghua.yu@intel.com>
> Cc: linux-ia64@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> ---
>  arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
>  arch/ia64/include/asm/acpi.h    |   50 ---------------------------
>  arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
>  arch/x86/include/asm/acpi.h     |   45 -------------------------
>  include/acpi/platform/aclinux.h |    2 +-

Please rename the files first (in a separate patch) and then modify the
renamed ones.  That will make changes much easier to follow.

>  5 files changed, 137 insertions(+), 96 deletions(-)
>  create mode 100644 arch/ia64/include/asm/acenv.h
>  create mode 100644 arch/x86/include/asm/acenv.h
> 
> diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
> new file mode 100644
> index 0000000..e0896eb
> --- /dev/null
> +++ b/arch/ia64/include/asm/acenv.h
> @@ -0,0 +1,71 @@
> +/*
> + * IA64 specific ACPICA environments and implementation
> + *
> + * Copyright (C) 2014, Intel Corporation
> + *   Author: Lv Zheng <lv.zheng@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _ASM_IA64_ACENV_H
> +#define _ASM_IA64_ACENV_H
> +
> +#include <asm/intrinsics.h>
> +
> +#define COMPILER_DEPENDENT_INT64	long
> +#define COMPILER_DEPENDENT_UINT64	unsigned long
> +
> +/*
> + * Calling conventions:
> + *
> + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> + */
> +#define ACPI_SYSTEM_XFACE
> +#define ACPI_EXTERNAL_XFACE
> +#define ACPI_INTERNAL_XFACE
> +#define ACPI_INTERNAL_VAR_XFACE
> +
> +/* Asm macros */
> +
> +#define ACPI_FLUSH_CPU_CACHE()
> +
> +#ifdef CONFIG_ACPI
> +
> +static inline int
> +ia64_acpi_acquire_global_lock(unsigned int *lock)
> +{
> +	unsigned int old, new, val;
> +	do {
> +		old = *lock;
> +		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> +		val = ia64_cmpxchg4_acq(lock, new, old);
> +	} while (unlikely (val != old));
> +	return (new < 3) ? -1 : 0;
> +}
> +
> +static inline int
> +ia64_acpi_release_global_lock(unsigned int *lock)
> +{
> +	unsigned int old, new, val;
> +	do {
> +		old = *lock;
> +		new = old & ~0x3;
> +		val = ia64_cmpxchg4_acq(lock, new, old);
> +	} while (unlikely (val != old));
> +	return old & 0x1;
> +}
> +
> +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> +	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> +
> +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> +	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> +
> +#endif
> +
> +#endif /* _ASM_IA64_ACENV_H */
> diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
> index d651102..b0ddcfd 100644
> --- a/arch/ia64/include/asm/acpi.h
> +++ b/arch/ia64/include/asm/acpi.h
> @@ -34,56 +34,6 @@
>  #include <linux/numa.h>
>  #include <asm/numa.h>
>  
> -#define COMPILER_DEPENDENT_INT64	long
> -#define COMPILER_DEPENDENT_UINT64	unsigned long
> -
> -/*
> - * Calling conventions:
> - *
> - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> - */
> -#define ACPI_SYSTEM_XFACE
> -#define ACPI_EXTERNAL_XFACE
> -#define ACPI_INTERNAL_XFACE
> -#define ACPI_INTERNAL_VAR_XFACE
> -
> -/* Asm macros */
> -
> -#define ACPI_FLUSH_CPU_CACHE()
> -
> -static inline int
> -ia64_acpi_acquire_global_lock (unsigned int *lock)
> -{
> -	unsigned int old, new, val;
> -	do {
> -		old = *lock;
> -		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> -		val = ia64_cmpxchg4_acq(lock, new, old);
> -	} while (unlikely (val != old));
> -	return (new < 3) ? -1 : 0;
> -}
> -
> -static inline int
> -ia64_acpi_release_global_lock (unsigned int *lock)
> -{
> -	unsigned int old, new, val;
> -	do {
> -		old = *lock;
> -		new = old & ~0x3;
> -		val = ia64_cmpxchg4_acq(lock, new, old);
> -	} while (unlikely (val != old));
> -	return old & 0x1;
> -}
> -
> -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> -	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> -
> -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> -	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> -
>  #ifdef	CONFIG_ACPI
>  #define acpi_disabled 0	/* ACPI always enabled on IA64 */
>  #define acpi_noirq 0	/* ACPI always enabled on IA64 */
> diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
> new file mode 100644
> index 0000000..6978584
> --- /dev/null
> +++ b/arch/x86/include/asm/acenv.h
> @@ -0,0 +1,65 @@
> +/*
> + * X86 specific ACPICA environments and implementation
> + *
> + * Copyright (C) 2014, Intel Corporation
> + *   Author: Lv Zheng <lv.zheng@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _ASM_X86_ACENV_H
> +#define _ASM_X86_ACENV_H
> +
> +#include <asm/special_insns.h>
> +
> +#define COMPILER_DEPENDENT_INT64   long long
> +#define COMPILER_DEPENDENT_UINT64  unsigned long long
> +
> +/*
> + * Calling conventions:
> + *
> + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> + */
> +#define ACPI_SYSTEM_XFACE
> +#define ACPI_EXTERNAL_XFACE
> +#define ACPI_INTERNAL_XFACE
> +#define ACPI_INTERNAL_VAR_XFACE
> +
> +/* Asm macros */
> +
> +#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> +
> +#ifdef CONFIG_ACPI
> +
> +int __acpi_acquire_global_lock(unsigned int *lock);
> +int __acpi_release_global_lock(unsigned int *lock);
> +
> +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> +	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> +
> +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> +	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> +
> +/*
> + * Math helper asm macros
> + */
> +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> +	asm("divl %2;"				     \
> +	    : "=a"(q32), "=d"(r32)		     \
> +	    : "r"(d32),				     \
> +	     "0"(n_lo), "1"(n_hi))
> +
> +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> +	asm("shrl   $1,%2	;"	\
> +	    "rcrl   $1,%3;"		\
> +	    : "=r"(n_hi), "=r"(n_lo)	\
> +	    : "0"(n_hi), "1"(n_lo))
> +
> +#endif
> +
> +#endif /* _ASM_X86_ACENV_H */
> diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
> index c8c1e70..e06225e 100644
> --- a/arch/x86/include/asm/acpi.h
> +++ b/arch/x86/include/asm/acpi.h
> @@ -32,51 +32,6 @@
>  #include <asm/mpspec.h>
>  #include <asm/realmode.h>
>  
> -#define COMPILER_DEPENDENT_INT64   long long
> -#define COMPILER_DEPENDENT_UINT64  unsigned long long
> -
> -/*
> - * Calling conventions:
> - *
> - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> - */
> -#define ACPI_SYSTEM_XFACE
> -#define ACPI_EXTERNAL_XFACE
> -#define ACPI_INTERNAL_XFACE
> -#define ACPI_INTERNAL_VAR_XFACE
> -
> -/* Asm macros */
> -
> -#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> -
> -int __acpi_acquire_global_lock(unsigned int *lock);
> -int __acpi_release_global_lock(unsigned int *lock);
> -
> -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> -	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> -
> -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> -	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> -
> -/*
> - * Math helper asm macros
> - */
> -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> -	asm("divl %2;"				     \
> -	    : "=a"(q32), "=d"(r32)		     \
> -	    : "r"(d32),				     \
> -	     "0"(n_lo), "1"(n_hi))
> -
> -
> -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> -	asm("shrl   $1,%2	;"	\
> -	    "rcrl   $1,%3;"		\
> -	    : "=r"(n_hi), "=r"(n_lo)	\
> -	    : "0"(n_hi), "1"(n_lo))
> -
>  #ifdef CONFIG_ACPI
>  extern int acpi_lapic;
>  extern int acpi_ioapic;
> diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> index a20f051..99d0546 100644
> --- a/include/acpi/platform/aclinux.h
> +++ b/include/acpi/platform/aclinux.h
> @@ -71,7 +71,7 @@
>  #ifdef EXPORT_ACPI_INTERFACES
>  #include <linux/export.h>
>  #endif
> -#include <asm/acpi.h>
> +#include <asm/acenv.h>
>  
>  /* Host-dependent types and defines for in-kernel ACPICA */
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-23  6:54       ` Lv Zheng
  (?)
@ 2014-04-27 21:38       ` Rafael J. Wysocki
  2014-04-28  4:10           ` Zheng, Lv
  -1 siblings, 1 reply; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-27 21:38 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi

On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
> There are _LINUX defined so that when Linux kernel is compiled using broken
> compilers that having not __linux__ defined can still include
> <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
> 
> This behavior is deprecated as all drivers/acpi/acpica files are compiled
> without including <linux/acpi.h>, thus without _LINUX defined.  As there is
> no issues encountered when we compile ACPICA code without _LINUX defined,
> it is OK to remove _LINUX from <linux/acpi.h> now.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
>  include/linux/acpi.h |    4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 7a8f2cd..9c559f7 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -31,10 +31,6 @@
>  
>  #ifdef	CONFIG_ACPI
>  
> -#ifndef _LINUX
> -#define _LINUX
> -#endif
> -
>  #include <linux/list.h>
>  #include <linux/mod_devicetable.h>

What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
after this change?


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-27 21:36         ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Rafael J. Wysocki
  (?)
@ 2014-04-28  3:02           ` Zheng, Lv
  -1 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  3:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Luck, Tony, Yu, Fenghua, linux-ia64, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86

Hi, Rafael

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> Sent: Monday, April 28, 2014 5:37 AM
> To: Zheng, Lv
> 
> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> > There is a mis-order inclusion for <asm/acpi.h>.
> >
> > As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> > can find the inclusion order is as follows:
> >
> > <linux/acpi.h>
> >   <acpi/acpi.h>
> >    <acpi/platform/acenv.h>
> >     (acenv.h before including aclinux.h)
> >     <acpi/platform/aclinux.h>
> > ...........................................................................
> >      (aclinux.h before including asm/acpi.h)
> >      <asm/acpi.h>                             @Redundant@
> >       (ACPICA specific stuff)
> > ...........................................................................
> > ...........................................................................
> >       (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
> >      (aclinux.h after including asm/acpi.h)   @Invisible@   |
> >     (acenv.h after including aclinux.h)       @Invisible@   |
> >    other ACPICA headers                       @Invisible@   |
> > ............................................................|..............
> >   <acpi/acpi_bus.h>                                         |
> >   <acpi/acpi_drivers.h>                                     |
> >   <asm/acpi.h> (Excluded)                                   |
> >    (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> >
> > NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> > generated <generated/autoconf.h> for Linux, it is meant to be included
> > before including any ACPICA code.
> >
> > In the above figure, there is a question mark for "Linux ACPI specific
> > stuff" in <asm/acpi.h> which should be included after including all other
> > ACPICA header files.  Thus they really need to be moved to the position
> > marked with exclaimation mark or the definitions in the blocks marked with
> > "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> > specific stuff" header blocks.  This leaves 2 issues:
> > 1. All environmental definitions in these blocks should have a copy in the
> >    area marked with "@Redundant@" if they are required by the "Linux ACPI
> >    specific stuff".
> > 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> >
> > This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> > fix this issue.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > Cc: Tony Luck <tony.luck@intel.com>
> > Cc: Fenghua Yu <fenghua.yu@intel.com>
> > Cc: linux-ia64@vger.kernel.org
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: x86@kernel.org
> > ---
> >  arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
> >  arch/ia64/include/asm/acpi.h    |   50 ---------------------------
> >  arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
> >  arch/x86/include/asm/acpi.h     |   45 -------------------------
> >  include/acpi/platform/aclinux.h |    2 +-
> 
> Please rename the files first (in a separate patch) and then modify the
> renamed ones.  That will make changes much easier to follow.

This patch doesn't provide a rename.
Currently, <asm/acpi.h> includes:
1. arch specific ACPI stuff
2. arch specific ACPICA stuff
This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.

Thanks and best regards
-Lv

> 
> >  5 files changed, 137 insertions(+), 96 deletions(-)
> >  create mode 100644 arch/ia64/include/asm/acenv.h
> >  create mode 100644 arch/x86/include/asm/acenv.h
> >
> > diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
> > new file mode 100644
> > index 0000000..e0896eb
> > --- /dev/null
> > +++ b/arch/ia64/include/asm/acenv.h
> > @@ -0,0 +1,71 @@
> > +/*
> > + * IA64 specific ACPICA environments and implementation
> > + *
> > + * Copyright (C) 2014, Intel Corporation
> > + *   Author: Lv Zheng <lv.zheng@intel.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#ifndef _ASM_IA64_ACENV_H
> > +#define _ASM_IA64_ACENV_H
> > +
> > +#include <asm/intrinsics.h>
> > +
> > +#define COMPILER_DEPENDENT_INT64	long
> > +#define COMPILER_DEPENDENT_UINT64	unsigned long
> > +
> > +/*
> > + * Calling conventions:
> > + *
> > + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > + */
> > +#define ACPI_SYSTEM_XFACE
> > +#define ACPI_EXTERNAL_XFACE
> > +#define ACPI_INTERNAL_XFACE
> > +#define ACPI_INTERNAL_VAR_XFACE
> > +
> > +/* Asm macros */
> > +
> > +#define ACPI_FLUSH_CPU_CACHE()
> > +
> > +#ifdef CONFIG_ACPI
> > +
> > +static inline int
> > +ia64_acpi_acquire_global_lock(unsigned int *lock)
> > +{
> > +	unsigned int old, new, val;
> > +	do {
> > +		old = *lock;
> > +		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> > +		val = ia64_cmpxchg4_acq(lock, new, old);
> > +	} while (unlikely (val != old));
> > +	return (new < 3) ? -1 : 0;
> > +}
> > +
> > +static inline int
> > +ia64_acpi_release_global_lock(unsigned int *lock)
> > +{
> > +	unsigned int old, new, val;
> > +	do {
> > +		old = *lock;
> > +		new = old & ~0x3;
> > +		val = ia64_cmpxchg4_acq(lock, new, old);
> > +	} while (unlikely (val != old));
> > +	return old & 0x1;
> > +}
> > +
> > +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> > +	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> > +
> > +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> > +	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> > +
> > +#endif
> > +
> > +#endif /* _ASM_IA64_ACENV_H */
> > diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
> > index d651102..b0ddcfd 100644
> > --- a/arch/ia64/include/asm/acpi.h
> > +++ b/arch/ia64/include/asm/acpi.h
> > @@ -34,56 +34,6 @@
> >  #include <linux/numa.h>
> >  #include <asm/numa.h>
> >
> > -#define COMPILER_DEPENDENT_INT64	long
> > -#define COMPILER_DEPENDENT_UINT64	unsigned long
> > -
> > -/*
> > - * Calling conventions:
> > - *
> > - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > - */
> > -#define ACPI_SYSTEM_XFACE
> > -#define ACPI_EXTERNAL_XFACE
> > -#define ACPI_INTERNAL_XFACE
> > -#define ACPI_INTERNAL_VAR_XFACE
> > -
> > -/* Asm macros */
> > -
> > -#define ACPI_FLUSH_CPU_CACHE()
> > -
> > -static inline int
> > -ia64_acpi_acquire_global_lock (unsigned int *lock)
> > -{
> > -	unsigned int old, new, val;
> > -	do {
> > -		old = *lock;
> > -		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> > -		val = ia64_cmpxchg4_acq(lock, new, old);
> > -	} while (unlikely (val != old));
> > -	return (new < 3) ? -1 : 0;
> > -}
> > -
> > -static inline int
> > -ia64_acpi_release_global_lock (unsigned int *lock)
> > -{
> > -	unsigned int old, new, val;
> > -	do {
> > -		old = *lock;
> > -		new = old & ~0x3;
> > -		val = ia64_cmpxchg4_acq(lock, new, old);
> > -	} while (unlikely (val != old));
> > -	return old & 0x1;
> > -}
> > -
> > -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> > -	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> > -
> > -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> > -	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> > -
> >  #ifdef	CONFIG_ACPI
> >  #define acpi_disabled 0	/* ACPI always enabled on IA64 */
> >  #define acpi_noirq 0	/* ACPI always enabled on IA64 */
> > diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
> > new file mode 100644
> > index 0000000..6978584
> > --- /dev/null
> > +++ b/arch/x86/include/asm/acenv.h
> > @@ -0,0 +1,65 @@
> > +/*
> > + * X86 specific ACPICA environments and implementation
> > + *
> > + * Copyright (C) 2014, Intel Corporation
> > + *   Author: Lv Zheng <lv.zheng@intel.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#ifndef _ASM_X86_ACENV_H
> > +#define _ASM_X86_ACENV_H
> > +
> > +#include <asm/special_insns.h>
> > +
> > +#define COMPILER_DEPENDENT_INT64   long long
> > +#define COMPILER_DEPENDENT_UINT64  unsigned long long
> > +
> > +/*
> > + * Calling conventions:
> > + *
> > + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > + */
> > +#define ACPI_SYSTEM_XFACE
> > +#define ACPI_EXTERNAL_XFACE
> > +#define ACPI_INTERNAL_XFACE
> > +#define ACPI_INTERNAL_VAR_XFACE
> > +
> > +/* Asm macros */
> > +
> > +#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> > +
> > +#ifdef CONFIG_ACPI
> > +
> > +int __acpi_acquire_global_lock(unsigned int *lock);
> > +int __acpi_release_global_lock(unsigned int *lock);
> > +
> > +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> > +	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> > +
> > +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> > +	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> > +
> > +/*
> > + * Math helper asm macros
> > + */
> > +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> > +	asm("divl %2;"				     \
> > +	    : "=a"(q32), "=d"(r32)		     \
> > +	    : "r"(d32),				     \
> > +	     "0"(n_lo), "1"(n_hi))
> > +
> > +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> > +	asm("shrl   $1,%2	;"	\
> > +	    "rcrl   $1,%3;"		\
> > +	    : "=r"(n_hi), "=r"(n_lo)	\
> > +	    : "0"(n_hi), "1"(n_lo))
> > +
> > +#endif
> > +
> > +#endif /* _ASM_X86_ACENV_H */
> > diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
> > index c8c1e70..e06225e 100644
> > --- a/arch/x86/include/asm/acpi.h
> > +++ b/arch/x86/include/asm/acpi.h
> > @@ -32,51 +32,6 @@
> >  #include <asm/mpspec.h>
> >  #include <asm/realmode.h>
> >
> > -#define COMPILER_DEPENDENT_INT64   long long
> > -#define COMPILER_DEPENDENT_UINT64  unsigned long long
> > -
> > -/*
> > - * Calling conventions:
> > - *
> > - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > - */
> > -#define ACPI_SYSTEM_XFACE
> > -#define ACPI_EXTERNAL_XFACE
> > -#define ACPI_INTERNAL_XFACE
> > -#define ACPI_INTERNAL_VAR_XFACE
> > -
> > -/* Asm macros */
> > -
> > -#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> > -
> > -int __acpi_acquire_global_lock(unsigned int *lock);
> > -int __acpi_release_global_lock(unsigned int *lock);
> > -
> > -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> > -	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> > -
> > -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> > -	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> > -
> > -/*
> > - * Math helper asm macros
> > - */
> > -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> > -	asm("divl %2;"				     \
> > -	    : "=a"(q32), "=d"(r32)		     \
> > -	    : "r"(d32),				     \
> > -	     "0"(n_lo), "1"(n_hi))
> > -
> > -
> > -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> > -	asm("shrl   $1,%2	;"	\
> > -	    "rcrl   $1,%3;"		\
> > -	    : "=r"(n_hi), "=r"(n_lo)	\
> > -	    : "0"(n_hi), "1"(n_lo))
> > -
> >  #ifdef CONFIG_ACPI
> >  extern int acpi_lapic;
> >  extern int acpi_ioapic;
> > diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> > index a20f051..99d0546 100644
> > --- a/include/acpi/platform/aclinux.h
> > +++ b/include/acpi/platform/aclinux.h
> > @@ -71,7 +71,7 @@
> >  #ifdef EXPORT_ACPI_INTERFACES
> >  #include <linux/export.h>
> >  #endif
> > -#include <asm/acpi.h>
> > +#include <asm/acenv.h>
> >
> >  /* Host-dependent types and defines for in-kernel ACPICA */
> >
> >
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
@ 2014-04-28  3:02           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  3:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Luck, Tony, Yu, Fenghua, linux-ia64, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 13025 bytes --]

Hi, Rafael

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> Sent: Monday, April 28, 2014 5:37 AM
> To: Zheng, Lv
> 
> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> > There is a mis-order inclusion for <asm/acpi.h>.
> >
> > As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> > can find the inclusion order is as follows:
> >
> > <linux/acpi.h>
> >   <acpi/acpi.h>
> >    <acpi/platform/acenv.h>
> >     (acenv.h before including aclinux.h)
> >     <acpi/platform/aclinux.h>
> > ...........................................................................
> >      (aclinux.h before including asm/acpi.h)
> >      <asm/acpi.h>                             @Redundant@
> >       (ACPICA specific stuff)
> > ...........................................................................
> > ...........................................................................
> >       (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
> >      (aclinux.h after including asm/acpi.h)   @Invisible@   |
> >     (acenv.h after including aclinux.h)       @Invisible@   |
> >    other ACPICA headers                       @Invisible@   |
> > ............................................................|..............
> >   <acpi/acpi_bus.h>                                         |
> >   <acpi/acpi_drivers.h>                                     |
> >   <asm/acpi.h> (Excluded)                                   |
> >    (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> >
> > NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> > generated <generated/autoconf.h> for Linux, it is meant to be included
> > before including any ACPICA code.
> >
> > In the above figure, there is a question mark for "Linux ACPI specific
> > stuff" in <asm/acpi.h> which should be included after including all other
> > ACPICA header files.  Thus they really need to be moved to the position
> > marked with exclaimation mark or the definitions in the blocks marked with
> > "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> > specific stuff" header blocks.  This leaves 2 issues:
> > 1. All environmental definitions in these blocks should have a copy in the
> >    area marked with "@Redundant@" if they are required by the "Linux ACPI
> >    specific stuff".
> > 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> >
> > This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> > fix this issue.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > Cc: Tony Luck <tony.luck@intel.com>
> > Cc: Fenghua Yu <fenghua.yu@intel.com>
> > Cc: linux-ia64@vger.kernel.org
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: x86@kernel.org
> > ---
> >  arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
> >  arch/ia64/include/asm/acpi.h    |   50 ---------------------------
> >  arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
> >  arch/x86/include/asm/acpi.h     |   45 -------------------------
> >  include/acpi/platform/aclinux.h |    2 +-
> 
> Please rename the files first (in a separate patch) and then modify the
> renamed ones.  That will make changes much easier to follow.

This patch doesn't provide a rename.
Currently, <asm/acpi.h> includes:
1. arch specific ACPI stuff
2. arch specific ACPICA stuff
This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.

Thanks and best regards
-Lv

> 
> >  5 files changed, 137 insertions(+), 96 deletions(-)
> >  create mode 100644 arch/ia64/include/asm/acenv.h
> >  create mode 100644 arch/x86/include/asm/acenv.h
> >
> > diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
> > new file mode 100644
> > index 0000000..e0896eb
> > --- /dev/null
> > +++ b/arch/ia64/include/asm/acenv.h
> > @@ -0,0 +1,71 @@
> > +/*
> > + * IA64 specific ACPICA environments and implementation
> > + *
> > + * Copyright (C) 2014, Intel Corporation
> > + *   Author: Lv Zheng <lv.zheng@intel.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#ifndef _ASM_IA64_ACENV_H
> > +#define _ASM_IA64_ACENV_H
> > +
> > +#include <asm/intrinsics.h>
> > +
> > +#define COMPILER_DEPENDENT_INT64	long
> > +#define COMPILER_DEPENDENT_UINT64	unsigned long
> > +
> > +/*
> > + * Calling conventions:
> > + *
> > + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > + */
> > +#define ACPI_SYSTEM_XFACE
> > +#define ACPI_EXTERNAL_XFACE
> > +#define ACPI_INTERNAL_XFACE
> > +#define ACPI_INTERNAL_VAR_XFACE
> > +
> > +/* Asm macros */
> > +
> > +#define ACPI_FLUSH_CPU_CACHE()
> > +
> > +#ifdef CONFIG_ACPI
> > +
> > +static inline int
> > +ia64_acpi_acquire_global_lock(unsigned int *lock)
> > +{
> > +	unsigned int old, new, val;
> > +	do {
> > +		old = *lock;
> > +		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> > +		val = ia64_cmpxchg4_acq(lock, new, old);
> > +	} while (unlikely (val != old));
> > +	return (new < 3) ? -1 : 0;
> > +}
> > +
> > +static inline int
> > +ia64_acpi_release_global_lock(unsigned int *lock)
> > +{
> > +	unsigned int old, new, val;
> > +	do {
> > +		old = *lock;
> > +		new = old & ~0x3;
> > +		val = ia64_cmpxchg4_acq(lock, new, old);
> > +	} while (unlikely (val != old));
> > +	return old & 0x1;
> > +}
> > +
> > +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> > +	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> > +
> > +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> > +	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> > +
> > +#endif
> > +
> > +#endif /* _ASM_IA64_ACENV_H */
> > diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
> > index d651102..b0ddcfd 100644
> > --- a/arch/ia64/include/asm/acpi.h
> > +++ b/arch/ia64/include/asm/acpi.h
> > @@ -34,56 +34,6 @@
> >  #include <linux/numa.h>
> >  #include <asm/numa.h>
> >
> > -#define COMPILER_DEPENDENT_INT64	long
> > -#define COMPILER_DEPENDENT_UINT64	unsigned long
> > -
> > -/*
> > - * Calling conventions:
> > - *
> > - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > - */
> > -#define ACPI_SYSTEM_XFACE
> > -#define ACPI_EXTERNAL_XFACE
> > -#define ACPI_INTERNAL_XFACE
> > -#define ACPI_INTERNAL_VAR_XFACE
> > -
> > -/* Asm macros */
> > -
> > -#define ACPI_FLUSH_CPU_CACHE()
> > -
> > -static inline int
> > -ia64_acpi_acquire_global_lock (unsigned int *lock)
> > -{
> > -	unsigned int old, new, val;
> > -	do {
> > -		old = *lock;
> > -		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
> > -		val = ia64_cmpxchg4_acq(lock, new, old);
> > -	} while (unlikely (val != old));
> > -	return (new < 3) ? -1 : 0;
> > -}
> > -
> > -static inline int
> > -ia64_acpi_release_global_lock (unsigned int *lock)
> > -{
> > -	unsigned int old, new, val;
> > -	do {
> > -		old = *lock;
> > -		new = old & ~0x3;
> > -		val = ia64_cmpxchg4_acq(lock, new, old);
> > -	} while (unlikely (val != old));
> > -	return old & 0x1;
> > -}
> > -
> > -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
> > -	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
> > -
> > -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
> > -	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
> > -
> >  #ifdef	CONFIG_ACPI
> >  #define acpi_disabled 0	/* ACPI always enabled on IA64 */
> >  #define acpi_noirq 0	/* ACPI always enabled on IA64 */
> > diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
> > new file mode 100644
> > index 0000000..6978584
> > --- /dev/null
> > +++ b/arch/x86/include/asm/acenv.h
> > @@ -0,0 +1,65 @@
> > +/*
> > + * X86 specific ACPICA environments and implementation
> > + *
> > + * Copyright (C) 2014, Intel Corporation
> > + *   Author: Lv Zheng <lv.zheng@intel.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#ifndef _ASM_X86_ACENV_H
> > +#define _ASM_X86_ACENV_H
> > +
> > +#include <asm/special_insns.h>
> > +
> > +#define COMPILER_DEPENDENT_INT64   long long
> > +#define COMPILER_DEPENDENT_UINT64  unsigned long long
> > +
> > +/*
> > + * Calling conventions:
> > + *
> > + * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > + * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > + * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > + * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > + */
> > +#define ACPI_SYSTEM_XFACE
> > +#define ACPI_EXTERNAL_XFACE
> > +#define ACPI_INTERNAL_XFACE
> > +#define ACPI_INTERNAL_VAR_XFACE
> > +
> > +/* Asm macros */
> > +
> > +#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> > +
> > +#ifdef CONFIG_ACPI
> > +
> > +int __acpi_acquire_global_lock(unsigned int *lock);
> > +int __acpi_release_global_lock(unsigned int *lock);
> > +
> > +#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> > +	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> > +
> > +#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> > +	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> > +
> > +/*
> > + * Math helper asm macros
> > + */
> > +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> > +	asm("divl %2;"				     \
> > +	    : "=a"(q32), "=d"(r32)		     \
> > +	    : "r"(d32),				     \
> > +	     "0"(n_lo), "1"(n_hi))
> > +
> > +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> > +	asm("shrl   $1,%2	;"	\
> > +	    "rcrl   $1,%3;"		\
> > +	    : "=r"(n_hi), "=r"(n_lo)	\
> > +	    : "0"(n_hi), "1"(n_lo))
> > +
> > +#endif
> > +
> > +#endif /* _ASM_X86_ACENV_H */
> > diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
> > index c8c1e70..e06225e 100644
> > --- a/arch/x86/include/asm/acpi.h
> > +++ b/arch/x86/include/asm/acpi.h
> > @@ -32,51 +32,6 @@
> >  #include <asm/mpspec.h>
> >  #include <asm/realmode.h>
> >
> > -#define COMPILER_DEPENDENT_INT64   long long
> > -#define COMPILER_DEPENDENT_UINT64  unsigned long long
> > -
> > -/*
> > - * Calling conventions:
> > - *
> > - * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
> > - * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
> > - * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
> > - * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
> > - */
> > -#define ACPI_SYSTEM_XFACE
> > -#define ACPI_EXTERNAL_XFACE
> > -#define ACPI_INTERNAL_XFACE
> > -#define ACPI_INTERNAL_VAR_XFACE
> > -
> > -/* Asm macros */
> > -
> > -#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
> > -
> > -int __acpi_acquire_global_lock(unsigned int *lock);
> > -int __acpi_release_global_lock(unsigned int *lock);
> > -
> > -#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
> > -	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
> > -
> > -#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
> > -	((Acq) = __acpi_release_global_lock(&facs->global_lock))
> > -
> > -/*
> > - * Math helper asm macros
> > - */
> > -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> > -	asm("divl %2;"				     \
> > -	    : "=a"(q32), "=d"(r32)		     \
> > -	    : "r"(d32),				     \
> > -	     "0"(n_lo), "1"(n_hi))
> > -
> > -
> > -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> > -	asm("shrl   $1,%2	;"	\
> > -	    "rcrl   $1,%3;"		\
> > -	    : "=r"(n_hi), "=r"(n_lo)	\
> > -	    : "0"(n_hi), "1"(n_lo))
> > -
> >  #ifdef CONFIG_ACPI
> >  extern int acpi_lapic;
> >  extern int acpi_ioapic;
> > diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> > index a20f051..99d0546 100644
> > --- a/include/acpi/platform/aclinux.h
> > +++ b/include/acpi/platform/aclinux.h
> > @@ -71,7 +71,7 @@
> >  #ifdef EXPORT_ACPI_INTERFACES
> >  #include <linux/export.h>
> >  #endif
> > -#include <asm/acpi.h>
> > +#include <asm/acenv.h>
> >
> >  /* Host-dependent types and defines for in-kernel ACPICA */
> >
> >
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a
@ 2014-04-28  3:02           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  3:02 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Luck, Tony, Yu, Fenghua, linux-ia64, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86

SGksIFJhZmFlbA0KDQo+IEZyb206IGxpbnV4LWFjcGktb3duZXJAdmdlci5rZXJuZWwub3JnIFtt
YWlsdG86bGludXgtYWNwaS1vd25lckB2Z2VyLmtlcm5lbC5vcmddIE9uIEJlaGFsZiBPZiBSYWZh
ZWwgSi4gV3lzb2NraQ0KPiBTZW50OiBNb25kYXksIEFwcmlsIDI4LCAyMDE0IDU6MzcgQU0NCj4g
VG86IFpoZW5nLCBMdg0KPiANCj4gT24gV2VkbmVzZGF5LCBBcHJpbCAyMywgMjAxNCAwMjo1NDow
NiBQTSBMdiBaaGVuZyB3cm90ZToNCj4gPiBUaGVyZSBpcyBhIG1pcy1vcmRlciBpbmNsdXNpb24g
Zm9yIDxhc20vYWNwaS5oPi4NCj4gPg0KPiA+IEFzIHdlIHdpbGwgZW5mb3JjZSBpbmNsdWRpbmcg
PGxpbnV4L2FjcGkuaD4gZm9yIGFsbCBMaW51eCBBQ1BJIHVzZXJzLCB3ZQ0KPiA+IGNhbiBmaW5k
IHRoZSBpbmNsdXNpb24gb3JkZXIgaXMgYXMgZm9sbG93czoNCj4gPg0KPiA+IDxsaW51eC9hY3Bp
Lmg+DQo+ID4gICA8YWNwaS9hY3BpLmg+DQo+ID4gICAgPGFjcGkvcGxhdGZvcm0vYWNlbnYuaD4N
Cj4gPiAgICAgKGFjZ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lzdDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtYWNwaSIgaW4N
Cj4gdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRvIG1ham9yZG9tb0B2Z2VyLmtlcm5lbC5vcmcNCj4g
TW9yZSBtYWpvcmRvbW8gaW5mbyBhdCAgaHR0cDovL3ZnZXIua2VybmVsLm9yZy9tYWpvcmRvbW8t
aW5mby5odG1sDQo

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-27 21:38       ` Rafael J. Wysocki
@ 2014-04-28  4:10           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  4:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Monday, April 28, 2014 5:39 AM
> 
> On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
> > There are _LINUX defined so that when Linux kernel is compiled using broken
> > compilers that having not __linux__ defined can still include
> > <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
> >
> > This behavior is deprecated as all drivers/acpi/acpica files are compiled
> > without including <linux/acpi.h>, thus without _LINUX defined.  As there is
> > no issues encountered when we compile ACPICA code without _LINUX defined,
> > it is OK to remove _LINUX from <linux/acpi.h> now.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/linux/acpi.h |    4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index 7a8f2cd..9c559f7 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -31,10 +31,6 @@
> >
> >  #ifdef	CONFIG_ACPI
> >
> > -#ifndef _LINUX
> > -#define _LINUX
> > -#endif
> > -
> >  #include <linux/list.h>
> >  #include <linux/mod_devicetable.h>
> 
> What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
> after this change?

If you mean these lines:
  #if defined(_LINUX) || defined(__linux__)
  #include <acpi/platform/aclinux.h>
After deleting "_LINUX" from <linux/acpi.h>, acenv.h still can include aclinux.h because of "__linux__".
Actually all drivers/acpi/acpica source files are compiled without including <linux/acpi.h>, so "_LINUX" defined in this file is useless to Linux.
We needn't delete "_LINUX" from acenv.h.

"_LINUX" is only used in ACPICA makefiles, Linux never uses it:
  https://github.com/acpica/acpica/blob/master/generate/unix/Makefile.config
ACPICA can be compiled using the following make command:
  make HOST=_LINUX
I think this is the only usage of "_LINUX" for now.

Thanks and best regards
-Lv

> 
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
@ 2014-04-28  4:10           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  4:10 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2207 bytes --]

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Monday, April 28, 2014 5:39 AM
> 
> On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
> > There are _LINUX defined so that when Linux kernel is compiled using broken
> > compilers that having not __linux__ defined can still include
> > <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
> >
> > This behavior is deprecated as all drivers/acpi/acpica files are compiled
> > without including <linux/acpi.h>, thus without _LINUX defined.  As there is
> > no issues encountered when we compile ACPICA code without _LINUX defined,
> > it is OK to remove _LINUX from <linux/acpi.h> now.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/linux/acpi.h |    4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index 7a8f2cd..9c559f7 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -31,10 +31,6 @@
> >
> >  #ifdef	CONFIG_ACPI
> >
> > -#ifndef _LINUX
> > -#define _LINUX
> > -#endif
> > -
> >  #include <linux/list.h>
> >  #include <linux/mod_devicetable.h>
> 
> What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
> after this change?

If you mean these lines:
  #if defined(_LINUX) || defined(__linux__)
  #include <acpi/platform/aclinux.h>
After deleting "_LINUX" from <linux/acpi.h>, acenv.h still can include aclinux.h because of "__linux__".
Actually all drivers/acpi/acpica source files are compiled without including <linux/acpi.h>, so "_LINUX" defined in this file is useless to Linux.
We needn't delete "_LINUX" from acenv.h.

"_LINUX" is only used in ACPICA makefiles, Linux never uses it:
  https://github.com/acpica/acpica/blob/master/generate/unix/Makefile.config
ACPICA can be compiled using the following make command:
  make HOST=_LINUX
I think this is the only usage of "_LINUX" for now.

Thanks and best regards
-Lv

> 
> 
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header.
  2014-04-27 21:33       ` Rafael J. Wysocki
@ 2014-04-28  4:12           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  4:12 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Monday, April 28, 2014 5:34 AM
> 
> On Wednesday, April 23, 2014 02:53:52 PM Lv Zheng wrote:
> > This is a linuxized result of an ACPICA commit to upgrade the extra
> > header mechanism.
> >
> > This patch enhances the extra header solution to allow Linux to use
> > ACPI_USE_NATIVE_INTERFACE_HEADER and the file name can be automatically
> > replaced during ACPICA release process. Using this way, the rest of the
> > ACPICA users needn't know the name of the extra header file. Lv Zheng.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/acpi/acpi.h |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
> > index ca0cb60..682398b 100644
> > --- a/include/acpi/acpi.h
> > +++ b/include/acpi/acpi.h
> > @@ -62,8 +62,8 @@
> >  #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
> >  #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
> >  #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
> > -#ifdef ACPI_NATIVE_INTERFACE_HEADER
> > -#include ACPI_NATIVE_INTERFACE_HEADER
> > +#ifdef ACPI_USE_NATIVE_INTERFACE_HEADER
> > +#include <acpi/acpi_opt.h>
> >  #endif
> >
> >  #endif				/* __ACPI_H__ */
> 
> Well, I still think there's a better way.
> 
> Introduce <acpi/platform/acenvex.h> into ACPICA and put this into it:
> 
> #if defined(_LINUX) || defined(__linux__)
> #include <acpi/platform/aclinuxex.h>
> 
> #endif
> 
> and then move stuff you want in acpi/acpi_opt.h into acpi/platform/aclinuxex.h.
> 
> Then, you'll have in acpi.h:
> 
> #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
> #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
> #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
> #include <acpi/platform/acenvex.h>	/* Extra environment-specific items */
> 
> 
> That should work I suppose, shouldn't it?

I think this should work.
I'll modify this patch according the above suggestion.

Thanks and best regards
-Lv

> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header.
@ 2014-04-28  4:12           ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-28  4:12 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2349 bytes --]

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Monday, April 28, 2014 5:34 AM
> 
> On Wednesday, April 23, 2014 02:53:52 PM Lv Zheng wrote:
> > This is a linuxized result of an ACPICA commit to upgrade the extra
> > header mechanism.
> >
> > This patch enhances the extra header solution to allow Linux to use
> > ACPI_USE_NATIVE_INTERFACE_HEADER and the file name can be automatically
> > replaced during ACPICA release process. Using this way, the rest of the
> > ACPICA users needn't know the name of the extra header file. Lv Zheng.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/acpi/acpi.h |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
> > index ca0cb60..682398b 100644
> > --- a/include/acpi/acpi.h
> > +++ b/include/acpi/acpi.h
> > @@ -62,8 +62,8 @@
> >  #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
> >  #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
> >  #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
> > -#ifdef ACPI_NATIVE_INTERFACE_HEADER
> > -#include ACPI_NATIVE_INTERFACE_HEADER
> > +#ifdef ACPI_USE_NATIVE_INTERFACE_HEADER
> > +#include <acpi/acpi_opt.h>
> >  #endif
> >
> >  #endif				/* __ACPI_H__ */
> 
> Well, I still think there's a better way.
> 
> Introduce <acpi/platform/acenvex.h> into ACPICA and put this into it:
> 
> #if defined(_LINUX) || defined(__linux__)
> #include <acpi/platform/aclinuxex.h>
> 
> #endif
> 
> and then move stuff you want in acpi/acpi_opt.h into acpi/platform/aclinuxex.h.
> 
> Then, you'll have in acpi.h:
> 
> #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
> #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
> #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
> #include <acpi/platform/acenvex.h>	/* Extra environment-specific items */
> 
> 
> That should work I suppose, shouldn't it?

I think this should work.
I'll modify this patch according the above suggestion.

Thanks and best regards
-Lv

> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-28  4:10           ` Zheng, Lv
  (?)
@ 2014-04-28 20:26           ` Rafael J. Wysocki
  2014-04-29  7:50               ` Zheng, Lv
  -1 siblings, 1 reply; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-28 20:26 UTC (permalink / raw)
  To: Zheng, Lv, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi

On 4/28/2014 6:10 AM, Zheng, Lv wrote:
> Hi, Rafael
>
>> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
>> Sent: Monday, April 28, 2014 5:39 AM
>>
>> On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
>>> There are _LINUX defined so that when Linux kernel is compiled using broken
>>> compilers that having not __linux__ defined can still include
>>> <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
>>>
>>> This behavior is deprecated as all drivers/acpi/acpica files are compiled
>>> without including <linux/acpi.h>, thus without _LINUX defined.  As there is
>>> no issues encountered when we compile ACPICA code without _LINUX defined,
>>> it is OK to remove _LINUX from <linux/acpi.h> now.
>>>
>>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>>> ---
>>>   include/linux/acpi.h |    4 ----
>>>   1 file changed, 4 deletions(-)
>>>
>>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>>> index 7a8f2cd..9c559f7 100644
>>> --- a/include/linux/acpi.h
>>> +++ b/include/linux/acpi.h
>>> @@ -31,10 +31,6 @@
>>>
>>>   #ifdef	CONFIG_ACPI
>>>
>>> -#ifndef _LINUX
>>> -#define _LINUX
>>> -#endif
>>> -
>>>   #include <linux/list.h>
>>>   #include <linux/mod_devicetable.h>
>> What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
>> after this change?
> If you mean these lines:
>    #if defined(_LINUX) || defined(__linux__)
>    #include <acpi/platform/aclinux.h>
> After deleting "_LINUX" from <linux/acpi.h>, acenv.h still can include aclinux.h because of "__linux__".
> Actually all drivers/acpi/acpica source files are compiled without including <linux/acpi.h>, so "_LINUX" defined in this file is useless to Linux.
> We needn't delete "_LINUX" from acenv.h.
>
> "_LINUX" is only used in ACPICA makefiles, Linux never uses it:
>    https://github.com/acpica/acpica/blob/master/generate/unix/Makefile.config
> ACPICA can be compiled using the following make command:
>    make HOST=_LINUX
> I think this is the only usage of "_LINUX" for now.

Well, my point was: If we delete the definition of _LINUX, why don't we 
drop the symbol itself from everywhere along with it?

It definitely is not useful to refer to a symbol that's never defined, 
is it?

Rafael


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-28  3:02           ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Zheng, Lv
@ 2014-04-28 20:30             ` Rafael J. Wysocki
  -1 siblings, 0 replies; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-28 20:30 UTC (permalink / raw)
  To: Zheng, Lv, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi, Luck, Tony, Yu,
	Fenghua, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On 4/28/2014 5:02 AM, Zheng, Lv wrote:
> Hi, Rafael
>
>> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
>> Sent: Monday, April 28, 2014 5:37 AM
>> To: Zheng, Lv
>>
>> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
>>> There is a mis-order inclusion for <asm/acpi.h>.
>>>
>>> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
>>> can find the inclusion order is as follows:
>>>
>>> <linux/acpi.h>
>>>    <acpi/acpi.h>
>>>     <acpi/platform/acenv.h>
>>>      (acenv.h before including aclinux.h)
>>>      <acpi/platform/aclinux.h>
>>> ...........................................................................
>>>       (aclinux.h before including asm/acpi.h)
>>>       <asm/acpi.h>                             @Redundant@
>>>        (ACPICA specific stuff)
>>> ...........................................................................
>>> ...........................................................................
>>>        (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
>>>       (aclinux.h after including asm/acpi.h)   @Invisible@   |
>>>      (acenv.h after including aclinux.h)       @Invisible@   |
>>>     other ACPICA headers                       @Invisible@   |
>>> ............................................................|..............
>>>    <acpi/acpi_bus.h>                                         |
>>>    <acpi/acpi_drivers.h>                                     |
>>>    <asm/acpi.h> (Excluded)                                   |
>>>     (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
>>>
>>> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
>>> generated <generated/autoconf.h> for Linux, it is meant to be included
>>> before including any ACPICA code.
>>>
>>> In the above figure, there is a question mark for "Linux ACPI specific
>>> stuff" in <asm/acpi.h> which should be included after including all other
>>> ACPICA header files.  Thus they really need to be moved to the position
>>> marked with exclaimation mark or the definitions in the blocks marked with
>>> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
>>> specific stuff" header blocks.  This leaves 2 issues:
>>> 1. All environmental definitions in these blocks should have a copy in the
>>>     area marked with "@Redundant@" if they are required by the "Linux ACPI
>>>     specific stuff".
>>> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
>>>
>>> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
>>> fix this issue.
>>>
>>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>>> Cc: Tony Luck <tony.luck@intel.com>
>>> Cc: Fenghua Yu <fenghua.yu@intel.com>
>>> Cc: linux-ia64@vger.kernel.org
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Ingo Molnar <mingo@redhat.com>
>>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>>> Cc: x86@kernel.org
>>> ---
>>>   arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
>>>   arch/ia64/include/asm/acpi.h    |   50 ---------------------------
>>>   arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
>>>   arch/x86/include/asm/acpi.h     |   45 -------------------------
>>>   include/acpi/platform/aclinux.h |    2 +-
>> Please rename the files first (in a separate patch) and then modify the
>> renamed ones.  That will make changes much easier to follow.
> This patch doesn't provide a rename.
> Currently, <asm/acpi.h> includes:
> 1. arch specific ACPI stuff
> 2. arch specific ACPICA stuff
> This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.

Ah, I overlooked that, sorry.

Which I might not do if the changelog said what the patch was really doing.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a
@ 2014-04-28 20:30             ` Rafael J. Wysocki
  0 siblings, 0 replies; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-04-28 20:30 UTC (permalink / raw)
  To: Zheng, Lv, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi, Luck, Tony, Yu,
	Fenghua, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

On 4/28/2014 5:02 AM, Zheng, Lv wrote:
> Hi, Rafael
>
>> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
>> Sent: Monday, April 28, 2014 5:37 AM
>> To: Zheng, Lv
>>
>> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
>>> There is a mis-order inclusion for <asm/acpi.h>.
>>>
>>> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
>>> can find the inclusion order is as follows:
>>>
>>> <linux/acpi.h>
>>>    <acpi/acpi.h>
>>>     <acpi/platform/acenv.h>
>>>      (acenv.h before including aclinux.h)
>>>      <acpi/platform/aclinux.h>
>>> ...........................................................................
>>>       (aclinux.h before including asm/acpi.h)
>>>       <asm/acpi.h>                             @Redundant@
>>>        (ACPICA specific stuff)
>>> ...........................................................................
>>> ...........................................................................
>>>        (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
>>>       (aclinux.h after including asm/acpi.h)   @Invisible@   |
>>>      (acenv.h after including aclinux.h)       @Invisible@   |
>>>     other ACPICA headers                       @Invisible@   |
>>> ............................................................|..............
>>>    <acpi/acpi_bus.h>                                         |
>>>    <acpi/acpi_drivers.h>                                     |
>>>    <asm/acpi.h> (Excluded)                                   |
>>>     (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
>>>
>>> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
>>> generated <generated/autoconf.h> for Linux, it is meant to be included
>>> before including any ACPICA code.
>>>
>>> In the above figure, there is a question mark for "Linux ACPI specific
>>> stuff" in <asm/acpi.h> which should be included after including all other
>>> ACPICA header files.  Thus they really need to be moved to the position
>>> marked with exclaimation mark or the definitions in the blocks marked with
>>> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
>>> specific stuff" header blocks.  This leaves 2 issues:
>>> 1. All environmental definitions in these blocks should have a copy in the
>>>     area marked with "@Redundant@" if they are required by the "Linux ACPI
>>>     specific stuff".
>>> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
>>>
>>> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
>>> fix this issue.
>>>
>>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>>> Cc: Tony Luck <tony.luck@intel.com>
>>> Cc: Fenghua Yu <fenghua.yu@intel.com>
>>> Cc: linux-ia64@vger.kernel.org
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Ingo Molnar <mingo@redhat.com>
>>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>>> Cc: x86@kernel.org
>>> ---
>>>   arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
>>>   arch/ia64/include/asm/acpi.h    |   50 ---------------------------
>>>   arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
>>>   arch/x86/include/asm/acpi.h     |   45 -------------------------
>>>   include/acpi/platform/aclinux.h |    2 +-
>> Please rename the files first (in a separate patch) and then modify the
>> renamed ones.  That will make changes much easier to follow.
> This patch doesn't provide a rename.
> Currently, <asm/acpi.h> includes:
> 1. arch specific ACPI stuff
> 2. arch specific ACPICA stuff
> This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.

Ah, I overlooked that, sorry.

Which I might not do if the changelog said what the patch was really doing.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-04-28 20:30             ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Rafael J. Wysocki
  (?)
@ 2014-04-29  7:49               ` Zheng, Lv
  -1 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-29  7:49 UTC (permalink / raw)
  To: Wysocki, Rafael J, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi, Luck, Tony, Yu,
	Fenghua, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Hi, Rafael

> From: Wysocki, Rafael J
> Sent: Tuesday, April 29, 2014 4:30 AM
> 
> On 4/28/2014 5:02 AM, Zheng, Lv wrote:
> > Hi, Rafael
> >
> >> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> >> Sent: Monday, April 28, 2014 5:37 AM
> >> To: Zheng, Lv
> >>
> >> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> >>> There is a mis-order inclusion for <asm/acpi.h>.
> >>>
> >>> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> >>> can find the inclusion order is as follows:
> >>>
> >>> <linux/acpi.h>
> >>>    <acpi/acpi.h>
> >>>     <acpi/platform/acenv.h>
> >>>      (acenv.h before including aclinux.h)
> >>>      <acpi/platform/aclinux.h>
> >>> ...........................................................................
> >>>       (aclinux.h before including asm/acpi.h)
> >>>       <asm/acpi.h>                             @Redundant@
> >>>        (ACPICA specific stuff)
> >>> ...........................................................................
> >>> ...........................................................................
> >>>        (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
> >>>       (aclinux.h after including asm/acpi.h)   @Invisible@   |
> >>>      (acenv.h after including aclinux.h)       @Invisible@   |
> >>>     other ACPICA headers                       @Invisible@   |
> >>> ............................................................|..............
> >>>    <acpi/acpi_bus.h>                                         |
> >>>    <acpi/acpi_drivers.h>                                     |
> >>>    <asm/acpi.h> (Excluded)                                   |
> >>>     (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> >>>
> >>> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> >>> generated <generated/autoconf.h> for Linux, it is meant to be included
> >>> before including any ACPICA code.
> >>>
> >>> In the above figure, there is a question mark for "Linux ACPI specific
> >>> stuff" in <asm/acpi.h> which should be included after including all other
> >>> ACPICA header files.  Thus they really need to be moved to the position
> >>> marked with exclaimation mark or the definitions in the blocks marked with
> >>> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> >>> specific stuff" header blocks.  This leaves 2 issues:
> >>> 1. All environmental definitions in these blocks should have a copy in the
> >>>     area marked with "@Redundant@" if they are required by the "Linux ACPI
> >>>     specific stuff".
> >>> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> >>>
> >>> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> >>> fix this issue.
> >>>
> >>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> >>> Cc: Tony Luck <tony.luck@intel.com>
> >>> Cc: Fenghua Yu <fenghua.yu@intel.com>
> >>> Cc: linux-ia64@vger.kernel.org
> >>> Cc: Thomas Gleixner <tglx@linutronix.de>
> >>> Cc: Ingo Molnar <mingo@redhat.com>
> >>> Cc: "H. Peter Anvin" <hpa@zytor.com>
> >>> Cc: x86@kernel.org
> >>> ---
> >>>   arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
> >>>   arch/ia64/include/asm/acpi.h    |   50 ---------------------------
> >>>   arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
> >>>   arch/x86/include/asm/acpi.h     |   45 -------------------------
> >>>   include/acpi/platform/aclinux.h |    2 +-
> >> Please rename the files first (in a separate patch) and then modify the
> >> renamed ones.  That will make changes much easier to follow.
> > This patch doesn't provide a rename.
> > Currently, <asm/acpi.h> includes:
> > 1. arch specific ACPI stuff
> > 2. arch specific ACPICA stuff
> > This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.
> 
> Ah, I overlooked that, sorry.
> 
> Which I might not do if the changelog said what the patch was really doing.

Hmm, I'll refine the changelog in the next revision. :-)
Thanks for the helping.

Best regards
-Lv

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
@ 2014-04-29  7:49               ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-29  7:49 UTC (permalink / raw)
  To: Wysocki, Rafael J, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi, Luck, Tony, Yu,
	Fenghua, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4267 bytes --]

Hi, Rafael

> From: Wysocki, Rafael J
> Sent: Tuesday, April 29, 2014 4:30 AM
> 
> On 4/28/2014 5:02 AM, Zheng, Lv wrote:
> > Hi, Rafael
> >
> >> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> >> Sent: Monday, April 28, 2014 5:37 AM
> >> To: Zheng, Lv
> >>
> >> On Wednesday, April 23, 2014 02:54:06 PM Lv Zheng wrote:
> >>> There is a mis-order inclusion for <asm/acpi.h>.
> >>>
> >>> As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
> >>> can find the inclusion order is as follows:
> >>>
> >>> <linux/acpi.h>
> >>>    <acpi/acpi.h>
> >>>     <acpi/platform/acenv.h>
> >>>      (acenv.h before including aclinux.h)
> >>>      <acpi/platform/aclinux.h>
> >>> ...........................................................................
> >>>       (aclinux.h before including asm/acpi.h)
> >>>       <asm/acpi.h>                             @Redundant@
> >>>        (ACPICA specific stuff)
> >>> ...........................................................................
> >>> ...........................................................................
> >>>        (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
> >>>       (aclinux.h after including asm/acpi.h)   @Invisible@   |
> >>>      (acenv.h after including aclinux.h)       @Invisible@   |
> >>>     other ACPICA headers                       @Invisible@   |
> >>> ............................................................|..............
> >>>    <acpi/acpi_bus.h>                                         |
> >>>    <acpi/acpi_drivers.h>                                     |
> >>>    <asm/acpi.h> (Excluded)                                   |
> >>>     (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +
> >>>
> >>> NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
> >>> generated <generated/autoconf.h> for Linux, it is meant to be included
> >>> before including any ACPICA code.
> >>>
> >>> In the above figure, there is a question mark for "Linux ACPI specific
> >>> stuff" in <asm/acpi.h> which should be included after including all other
> >>> ACPICA header files.  Thus they really need to be moved to the position
> >>> marked with exclaimation mark or the definitions in the blocks marked with
> >>> "@Invisible@" will be invisible to such architecture specific "Linux ACPI
> >>> specific stuff" header blocks.  This leaves 2 issues:
> >>> 1. All environmental definitions in these blocks should have a copy in the
> >>>     area marked with "@Redundant@" if they are required by the "Linux ACPI
> >>>     specific stuff".
> >>> 2. We cannot use any ACPICA defined types in <asm/acpi.h>.
> >>>
> >>> This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
> >>> fix this issue.
> >>>
> >>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> >>> Cc: Tony Luck <tony.luck@intel.com>
> >>> Cc: Fenghua Yu <fenghua.yu@intel.com>
> >>> Cc: linux-ia64@vger.kernel.org
> >>> Cc: Thomas Gleixner <tglx@linutronix.de>
> >>> Cc: Ingo Molnar <mingo@redhat.com>
> >>> Cc: "H. Peter Anvin" <hpa@zytor.com>
> >>> Cc: x86@kernel.org
> >>> ---
> >>>   arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
> >>>   arch/ia64/include/asm/acpi.h    |   50 ---------------------------
> >>>   arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
> >>>   arch/x86/include/asm/acpi.h     |   45 -------------------------
> >>>   include/acpi/platform/aclinux.h |    2 +-
> >> Please rename the files first (in a separate patch) and then modify the
> >> renamed ones.  That will make changes much easier to follow.
> > This patch doesn't provide a rename.
> > Currently, <asm/acpi.h> includes:
> > 1. arch specific ACPI stuff
> > 2. arch specific ACPICA stuff
> > This patch moves "2" to a separate file <asm/acenv.h>, thus no renaming happens here.
> 
> Ah, I overlooked that, sorry.
> 
> Which I might not do if the changelog said what the patch was really doing.

Hmm, I'll refine the changelog in the next revision. :-)
Thanks for the helping.

Best regards
-Lv
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a
@ 2014-04-29  7:49               ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-29  7:49 UTC (permalink / raw)
  To: Wysocki, Rafael J, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi,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Zm
DQo+ID4gVGhpcyBwYXRjaCBtb3ZlcyAiMiIgdG8gYSBzZXBhcmF0ZSBmaWxlIDxhc20vYWNlbnYu
aD4sIHRodXMgbm8gcmVuYW1pbmcgaGFwcGVucyBoZXJlLg0KPiANCj4gQWgsIEkgb3Zlcmxvb2tl
ZCB0aGF0LCBzb3JyeS4NCj4gDQo+IFdoaWNoIEkgbWlnaHQgbm90IGRvIGlmIHRoZSBjaGFuZ2Vs
b2cgc2FpZCB3aGF0IHRoZSBwYXRjaCB3YXMgcmVhbGx5IGRvaW5nLg0KDQpIbW0sIEknbGwgcmVm
aW5lIHRoZSBjaGFuZ2Vsb2cgaW4gdGhlIG5leHQgcmV2aXNpb24uIDotKQ0KVGhhbmtzIGZvciB0
aGUgaGVscGluZy4NCg0KQmVzdCByZWdhcmRzDQotTHYNCg=

^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
  2014-04-28 20:26           ` Rafael J. Wysocki
@ 2014-04-29  7:50               ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-29  7:50 UTC (permalink / raw)
  To: Wysocki, Rafael J, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi

Hi,

> From: Wysocki, Rafael J
> Sent: Tuesday, April 29, 2014 4:27 AM
> 
> On 4/28/2014 6:10 AM, Zheng, Lv wrote:
> > Hi, Rafael
> >
> >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> >> Sent: Monday, April 28, 2014 5:39 AM
> >>
> >> On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
> >>> There are _LINUX defined so that when Linux kernel is compiled using broken
> >>> compilers that having not __linux__ defined can still include
> >>> <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
> >>>
> >>> This behavior is deprecated as all drivers/acpi/acpica files are compiled
> >>> without including <linux/acpi.h>, thus without _LINUX defined.  As there is
> >>> no issues encountered when we compile ACPICA code without _LINUX defined,
> >>> it is OK to remove _LINUX from <linux/acpi.h> now.
> >>>
> >>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> >>> ---
> >>>   include/linux/acpi.h |    4 ----
> >>>   1 file changed, 4 deletions(-)
> >>>
> >>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> >>> index 7a8f2cd..9c559f7 100644
> >>> --- a/include/linux/acpi.h
> >>> +++ b/include/linux/acpi.h
> >>> @@ -31,10 +31,6 @@
> >>>
> >>>   #ifdef	CONFIG_ACPI
> >>>
> >>> -#ifndef _LINUX
> >>> -#define _LINUX
> >>> -#endif
> >>> -
> >>>   #include <linux/list.h>
> >>>   #include <linux/mod_devicetable.h>
> >> What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
> >> after this change?
> > If you mean these lines:
> >    #if defined(_LINUX) || defined(__linux__)
> >    #include <acpi/platform/aclinux.h>
> > After deleting "_LINUX" from <linux/acpi.h>, acenv.h still can include aclinux.h because of "__linux__".
> > Actually all drivers/acpi/acpica source files are compiled without including <linux/acpi.h>, so "_LINUX" defined in this file is useless to
> Linux.
> > We needn't delete "_LINUX" from acenv.h.
> >
> > "_LINUX" is only used in ACPICA makefiles, Linux never uses it:
> >    https://github.com/acpica/acpica/blob/master/generate/unix/Makefile.config
> > ACPICA can be compiled using the following make command:
> >    make HOST=_LINUX
> > I think this is the only usage of "_LINUX" for now.
> 
> Well, my point was: If we delete the definition of _LINUX, why don't we
> drop the symbol itself from everywhere along with it?
> 
> It definitely is not useful to refer to a symbol that's never defined,
> is it?

It sounds like I should clean up acenv.h first than deleting this.
OK, I'll drop this patch from this series.
I might re-do the deletion after cleaning up the acenv.h.

Thanks and best regards
-Lv

> 
> Rafael


^ permalink raw reply	[flat|nested] 64+ messages in thread

* RE: [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA.
@ 2014-04-29  7:50               ` Zheng, Lv
  0 siblings, 0 replies; 64+ messages in thread
From: Zheng, Lv @ 2014-04-29  7:50 UTC (permalink / raw)
  To: Wysocki, Rafael J, Rafael J. Wysocki
  Cc: Brown, Len, Lv Zheng, linux-kernel, linux-acpi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2760 bytes --]

Hi,

> From: Wysocki, Rafael J
> Sent: Tuesday, April 29, 2014 4:27 AM
> 
> On 4/28/2014 6:10 AM, Zheng, Lv wrote:
> > Hi, Rafael
> >
> >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> >> Sent: Monday, April 28, 2014 5:39 AM
> >>
> >> On Wednesday, April 23, 2014 02:54:22 PM Lv Zheng wrote:
> >>> There are _LINUX defined so that when Linux kernel is compiled using broken
> >>> compilers that having not __linux__ defined can still include
> >>> <acpi/platform/aclinux.h> from <acpi/platform/acenv.h>.
> >>>
> >>> This behavior is deprecated as all drivers/acpi/acpica files are compiled
> >>> without including <linux/acpi.h>, thus without _LINUX defined.  As there is
> >>> no issues encountered when we compile ACPICA code without _LINUX defined,
> >>> it is OK to remove _LINUX from <linux/acpi.h> now.
> >>>
> >>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> >>> ---
> >>>   include/linux/acpi.h |    4 ----
> >>>   1 file changed, 4 deletions(-)
> >>>
> >>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> >>> index 7a8f2cd..9c559f7 100644
> >>> --- a/include/linux/acpi.h
> >>> +++ b/include/linux/acpi.h
> >>> @@ -31,10 +31,6 @@
> >>>
> >>>   #ifdef	CONFIG_ACPI
> >>>
> >>> -#ifndef _LINUX
> >>> -#define _LINUX
> >>> -#endif
> >>> -
> >>>   #include <linux/list.h>
> >>>   #include <linux/mod_devicetable.h>
> >> What about <acpi/platform/acenv.h>?  Should it still check if _LINUX is defined
> >> after this change?
> > If you mean these lines:
> >    #if defined(_LINUX) || defined(__linux__)
> >    #include <acpi/platform/aclinux.h>
> > After deleting "_LINUX" from <linux/acpi.h>, acenv.h still can include aclinux.h because of "__linux__".
> > Actually all drivers/acpi/acpica source files are compiled without including <linux/acpi.h>, so "_LINUX" defined in this file is useless to
> Linux.
> > We needn't delete "_LINUX" from acenv.h.
> >
> > "_LINUX" is only used in ACPICA makefiles, Linux never uses it:
> >    https://github.com/acpica/acpica/blob/master/generate/unix/Makefile.config
> > ACPICA can be compiled using the following make command:
> >    make HOST=_LINUX
> > I think this is the only usage of "_LINUX" for now.
> 
> Well, my point was: If we delete the definition of _LINUX, why don't we
> drop the symbol itself from everywhere along with it?
> 
> It definitely is not useful to refer to a symbol that's never defined,
> is it?

It sounds like I should clean up acenv.h first than deleting this.
OK, I'll drop this patch from this series.
I might re-do the deletion after cleaning up the acenv.h.

Thanks and best regards
-Lv

> 
> Rafael

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v3 0/4] ACPICA: Cleanups for <acpi/platform/acenv.h> and <acpi/platform/aclinux.h>.
  2014-04-08  7:55   ` Lv Zheng
@ 2014-05-12  7:44     ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:44 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch series cleans up <acpi/platform/acenv.h> and
<acpi/platform/aclinux.h>.  it also fixes some mis-ordered inclusions for
Linux resident ACPICA.

There is no real issue in the Linux kernel, but this can help to cleanup
the code so that (benefits):
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>.
2. Lift a burden off the ACPICA release automation - copying default ACPICA
   environment setting to all <asm/acpi.h> file each time a new environment
   is introduced just in order to avoid build errors.
3. The wrong <acpi/actypes.h> inclusion can be removed from
   <acpi/platform/aclinux.h>.
4. Using ACPICA defined types in <asm/acpi.h> is possible.
5. Using "static inline" to define ACPICA OSL functions is still possible
   and won't cause build errors any longer.
6. All non back ported prototypes are collected in a single file.

The patch set has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + default + COFNIG_ACPI=n
3. x86_64 + default + COFNIG_ACPI=y
4. x86_64 + default + COFNIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All drivers/acpi configurations
   All platform drivers
   All ACPI drivers
   4 DRM drivers that implement ACPI opregion
   All buses with ACPI bindings
   All cpufreq configurations
   All xen configurations
   All ACPI table drivers

Lv Zheng (4):
  ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no
    usages.
  ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove
    mis-ordered inclusion of <acpi/actypes.h> from
    <acpi/platform/aclinux.h>.
  ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered
    inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.

 arch/ia64/include/asm/acenv.h     |   56 ++++++++++++
 arch/ia64/include/asm/acpi.h      |   50 -----------
 arch/x86/include/asm/acenv.h      |   49 +++++++++++
 arch/x86/include/asm/acpi.h       |   45 ----------
 include/acpi/acpi.h               |    4 +-
 include/acpi/platform/acenvex.h   |   63 ++++++++++++++
 include/acpi/platform/aclinux.h   |  171 ++++++++-----------------------------
 include/acpi/platform/aclinuxex.h |  116 +++++++++++++++++++++++++
 8 files changed, 322 insertions(+), 232 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/platform/acenvex.h
 create mode 100644 include/acpi/platform/aclinuxex.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v3 0/4] ACPICA: Cleanups for <acpi/platform/acenv.h> and <acpi/platform/aclinux.h>.
@ 2014-05-12  7:44     ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:44 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch series cleans up <acpi/platform/acenv.h> and
<acpi/platform/aclinux.h>.  it also fixes some mis-ordered inclusions for
Linux resident ACPICA.

There is no real issue in the Linux kernel, but this can help to cleanup
the code so that (benefits):
1. Redundant environment definitions can be removed from <asm/acpi.h> and
   <acpi/platform/aclinux.h>.
2. Lift a burden off the ACPICA release automation - copying default ACPICA
   environment setting to all <asm/acpi.h> file each time a new environment
   is introduced just in order to avoid build errors.
3. The wrong <acpi/actypes.h> inclusion can be removed from
   <acpi/platform/aclinux.h>.
4. Using ACPICA defined types in <asm/acpi.h> is possible.
5. Using "static inline" to define ACPICA OSL functions is still possible
   and won't cause build errors any longer.
6. All non back ported prototypes are collected in a single file.

The patch set has passed the following build/boot tests.
Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + default + COFNIG_ACPI=n
3. x86_64 + default + COFNIG_ACPI=y
4. x86_64 + default + COFNIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
   All hardware drivers related to the machines of i386/x86_64
   All drivers/acpi configurations
   All platform drivers
   All ACPI drivers
   4 DRM drivers that implement ACPI opregion
   All buses with ACPI bindings
   All cpufreq configurations
   All xen configurations
   All ACPI table drivers

Lv Zheng (4):
  ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no
    usages.
  ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove
    mis-ordered inclusion of <acpi/actypes.h> from
    <acpi/platform/aclinux.h>.
  ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered
    inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  ACPICA: Cleanup redudant definitions that already have defaults in
    <acpi/platform/acenv.h>.

 arch/ia64/include/asm/acenv.h     |   56 ++++++++++++
 arch/ia64/include/asm/acpi.h      |   50 -----------
 arch/x86/include/asm/acenv.h      |   49 +++++++++++
 arch/x86/include/asm/acpi.h       |   45 ----------
 include/acpi/acpi.h               |    4 +-
 include/acpi/platform/acenvex.h   |   63 ++++++++++++++
 include/acpi/platform/aclinux.h   |  171 ++++++++-----------------------------
 include/acpi/platform/aclinuxex.h |  116 +++++++++++++++++++++++++
 8 files changed, 322 insertions(+), 232 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/acpi/platform/acenvex.h
 create mode 100644 include/acpi/platform/aclinuxex.h

-- 
1.7.10


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH v3 1/4] ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no usages.
  2014-05-12  7:44     ` Lv Zheng
@ 2014-05-12  7:45       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:45 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch deletes deprecated ACPI_PREEMPTION_POINT(), there is no user for
it in Linux kernel now. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h |   14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 4c2f9e7..3b8b52f 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -228,20 +228,6 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 
-#ifndef CONFIG_PREEMPT
-
-/*
- * Used within ACPICA to show where it is safe to preempt execution
- * when CONFIG_PREEMPT=n
- */
-#define ACPI_PREEMPTION_POINT() \
-	do { \
-		if (!irqs_disabled()) \
-			cond_resched(); \
-	} while (0)
-
-#endif
-
 /*
  * When lockdep is enabled, the spin_lock_init() macro stringifies it's
  * argument and uses that as a name for the lock in debugging.
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 1/4] ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no usages.
@ 2014-05-12  7:45       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:45 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch deletes deprecated ACPI_PREEMPTION_POINT(), there is no user for
it in Linux kernel now. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h |   14 --------------
 1 file changed, 14 deletions(-)

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 4c2f9e7..3b8b52f 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -228,20 +228,6 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
 
 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
 
-#ifndef CONFIG_PREEMPT
-
-/*
- * Used within ACPICA to show where it is safe to preempt execution
- * when CONFIG_PREEMPT=n
- */
-#define ACPI_PREEMPTION_POINT() \
-	do { \
-		if (!irqs_disabled()) \
-			cond_resched(); \
-	} while (0)
-
-#endif
-
 /*
  * When lockdep is enabled, the spin_lock_init() macro stringifies it's
  * argument and uses that as a name for the lock in debugging.
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 2/4] ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
  2014-05-12  7:44     ` Lv Zheng
@ 2014-05-12  7:46       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/platform/aclinuxex.h> to fix this issue by
splitting conditions and declarations (most of them are inline functions)
into 2 header files so that the wrong inclusion of <acpi/actypes.h> can be
removed from <acpi/platform/aclinux.h>.

This patch also removes old ACPI_NATIVE_INTERFACE_HEADER mechanism which is
not preferred by Linux and adds the platform/acenvex.h to be the solution
to solve this issue. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi.h               |    4 +-
 include/acpi/platform/acenvex.h   |   63 +++++++++++++++
 include/acpi/platform/aclinux.h   |  154 +++++++++----------------------------
 include/acpi/platform/aclinuxex.h |  116 ++++++++++++++++++++++++++++
 4 files changed, 216 insertions(+), 121 deletions(-)
 create mode 100644 include/acpi/platform/acenvex.h
 create mode 100644 include/acpi/platform/aclinuxex.h

diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ca0cb60..a08e55a 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -62,8 +62,6 @@
 #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
 #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
 #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
-#ifdef ACPI_NATIVE_INTERFACE_HEADER
-#include ACPI_NATIVE_INTERFACE_HEADER
-#endif
+#include <acpi/platform/acenvex.h>	/* Extra environment-specific items */
 
 #endif				/* __ACPI_H__ */
diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h
new file mode 100644
index 0000000..2b61238
--- /dev/null
+++ b/include/acpi/platform/acenvex.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * Name: acenvex.h - Extra host and compiler configuration
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACENVEX_H__
+#define __ACENVEX_H__
+
+/*! [Begin] no source code translation */
+
+/******************************************************************************
+ *
+ * Extra host configuration files. All ACPICA headers are included before
+ * including these files.
+ *
+ *****************************************************************************/
+
+#if defined(_LINUX) || defined(__linux__)
+#include <acpi/platform/aclinuxex.h>
+
+#endif
+
+/*! [End] no source code translation !*/
+
+#endif				/* __ACENVEX_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 3b8b52f..0ab05d9 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -114,6 +114,42 @@
 #define acpi_spinlock                       spinlock_t *
 #define acpi_cpu_flags                      unsigned long
 
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+#define USE_NATIVE_ALLOCATE_ZEROED
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
+
+/*
+ * OSL interfaces used by debugger/disassembler
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
+
+/*
+ * OSL interfaces used by utilities
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
+
 #else				/* !__KERNEL__ */
 
 #include <stdarg.h>
@@ -159,122 +195,4 @@
 
 #include <acpi/platform/acgcc.h>
 
-#ifdef __KERNEL__
-
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
-/*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
- */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
-
-/*
- * OSL interfaces used by debugger/disassembler
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
-
-/*
- * OSL interfaces used by utilities
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
-
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
-#endif				/* __KERNEL__ */
-
 #endif				/* __ACLINUX_H__ */
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
new file mode 100644
index 0000000..cce0723
--- /dev/null
+++ b/include/acpi/platform/aclinuxex.h
@@ -0,0 +1,116 @@
+/******************************************************************************
+ *
+ * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLINUXEX_H__
+#define __ACLINUXEX_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id) (unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
+
+#endif				/* __KERNEL__ */
+
+#endif				/* __ACLINUXEX_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 2/4] ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h>.
@ 2014-05-12  7:46       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

>From ACPICA's perspective, <acpi/actypes.h> should be included after
inclusion of <acpi/platform/acenv.h>.  But currently in Linux,
<acpi/platform/aclinux.h> included by <acpi/platform/acenv.h> has
included <acpi/actypes.h> to find ACPICA types for inline functions.

This causes the following problem:
1. Redundant code in <asm/acpi.h> and <acpi/platform/aclinux.h>:
   Linux must be careful to keep conditions for <acpi/actypes.h> inclusion
   consistent with the conditions for <acpi/platform/aclinux.h> inclusion.
   Which finally leads to the issue that we have to keep many useless macro
   definitions in <acpi/platform/aclinux.h> or <asm/acpi.h>.
   Such conditions include:
     COMPILER_DEPENDENT_UINT64
     COMPILER_DEPENDENT_INT64
     ACPI_INLINE
     ACPI_SYSTEM_XFACE
     ACPI_EXTERNAL_XFACE
     ACPI_INTERNAL_XFACE
     ACPI_INTERNAL_VAR_XFACE
     ACPI_MUTEX_TYPE
     DEBUGGER_THREADING
     ACPI_ACQUIRE_GLOBAL_LOCK
     ACPI_RELEASE_GLOBAL_LOCK
     ACPI_FLUSH_CPU_CACHE
   They have default implementations in <include/acpi/platform/acenv.h>
   while Linux need to keep a copy in <asm/acpi.h> to avoid build errors.
   Typical Linux build error if we deletes COMPILER_DEPENDENT_x and
   ACPI_x_XFACE definitions from asm/acpi.h:
      CC      init/main.o
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:129:1: error: unknown type name 'COMPILER_DEPENDENT_UINT64'
    include/acpi/actypes.h:130:1: error: unknown type name 'COMPILER_DEPENDENT_INT64'
    In file included from include/acpi/platform/aclinux.h:293:0,
                     from include/acpi/platform/acenv.h:149,
                     from include/acpi/acpi.h:56,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/actypes.h:1025:21: error: expected ')' before '*' token
    include/acpi/actypes.h:1028:21: error: expected ')' before '*' token
    In file included from include/acpi/acpi.h:63:0,
                     from include/linux/acpi.h:41,
                     from init/main.c:27:
    include/acpi/acpiosxf.h:240:7: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:247:6: error: unknown type name 'acpi_osd_handler'
    include/acpi/acpiosxf.h:260:3: error: unknown type name 'acpi_osd_exec_callback'

This patch introduces <acpi/platform/aclinuxex.h> to fix this issue by
splitting conditions and declarations (most of them are inline functions)
into 2 header files so that the wrong inclusion of <acpi/actypes.h> can be
removed from <acpi/platform/aclinux.h>.

This patch also removes old ACPI_NATIVE_INTERFACE_HEADER mechanism which is
not preferred by Linux and adds the platform/acenvex.h to be the solution
to solve this issue. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpi.h               |    4 +-
 include/acpi/platform/acenvex.h   |   63 +++++++++++++++
 include/acpi/platform/aclinux.h   |  154 +++++++++----------------------------
 include/acpi/platform/aclinuxex.h |  116 ++++++++++++++++++++++++++++
 4 files changed, 216 insertions(+), 121 deletions(-)
 create mode 100644 include/acpi/platform/acenvex.h
 create mode 100644 include/acpi/platform/aclinuxex.h

diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ca0cb60..a08e55a 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -62,8 +62,6 @@
 #include <acpi/acrestyp.h>		/* Resource Descriptor structs */
 #include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
 #include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
-#ifdef ACPI_NATIVE_INTERFACE_HEADER
-#include ACPI_NATIVE_INTERFACE_HEADER
-#endif
+#include <acpi/platform/acenvex.h>	/* Extra environment-specific items */
 
 #endif				/* __ACPI_H__ */
diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h
new file mode 100644
index 0000000..2b61238
--- /dev/null
+++ b/include/acpi/platform/acenvex.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * Name: acenvex.h - Extra host and compiler configuration
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACENVEX_H__
+#define __ACENVEX_H__
+
+/*! [Begin] no source code translation */
+
+/******************************************************************************
+ *
+ * Extra host configuration files. All ACPICA headers are included before
+ * including these files.
+ *
+ *****************************************************************************/
+
+#if defined(_LINUX) || defined(__linux__)
+#include <acpi/platform/aclinuxex.h>
+
+#endif
+
+/*! [End] no source code translation !*/
+
+#endif				/* __ACENVEX_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 3b8b52f..0ab05d9 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -114,6 +114,42 @@
 #define acpi_spinlock                       spinlock_t *
 #define acpi_cpu_flags                      unsigned long
 
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+#define USE_NATIVE_ALLOCATE_ZEROED
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
+
+/*
+ * OSL interfaces used by debugger/disassembler
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
+
+/*
+ * OSL interfaces used by utilities
+ */
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
+
 #else				/* !__KERNEL__ */
 
 #include <stdarg.h>
@@ -159,122 +195,4 @@
 
 #include <acpi/platform/acgcc.h>
 
-#ifdef __KERNEL__
-
-/*
- * FIXME: Inclusion of actypes.h
- * Linux kernel need this before defining inline OSL interfaces as
- * actypes.h need to be included to find ACPICA type definitions.
- * Since from ACPICA's perspective, the actypes.h should be included after
- * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
- */
-#include <acpi/actypes.h>
-
-/*
- * Overrides for in-kernel ACPICA
- */
-acpi_status __init acpi_os_initialize(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
-
-acpi_status acpi_os_terminate(void);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
-
-/*
- * Memory allocation/deallocation
- */
-
-/*
- * The irqs_disabled() check is for resume from RAM.
- * Interrupts are off during resume, just like they are for boot.
- * However, boot has  (system_state != SYSTEM_RUNNING)
- * to quiet __might_sleep() in kmalloc() and resume does not.
- */
-static inline void *acpi_os_allocate(acpi_size size)
-{
-	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
-
-/* Use native linux version of acpi_os_allocate_zeroed */
-
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
-{
-	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
-#define USE_NATIVE_ALLOCATE_ZEROED
-
-static inline void acpi_os_free(void *memory)
-{
-	kfree(memory);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
-
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
-{
-	return kmem_cache_zalloc(cache,
-				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
-
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
-	return (acpi_thread_id) (unsigned long)current;
-}
-
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
-
-/*
- * When lockdep is enabled, the spin_lock_init() macro stringifies it's
- * argument and uses that as a name for the lock in debugging.
- * By executing spin_lock_init() in a macro the key changes from "lock" for
- * all locks to the name of the argument of acpi_os_create_lock(), which
- * prevents lockdep from reporting false positives for ACPICA locks.
- */
-#define acpi_os_create_lock(__handle) \
-	({ \
-		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
-		if (lock) { \
-			*(__handle) = lock; \
-			spin_lock_init(*(__handle)); \
-		} \
-		lock ? AE_OK : AE_NO_MEMORY; \
-	})
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
-
-void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
-
-void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
-
-/*
- * OSL interfaces used by debugger/disassembler
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
-
-/*
- * OSL interfaces used by utilities
- */
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
-#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
-
-/*
- * OSL interfaces added by Linux
- */
-void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
-
-#endif				/* __KERNEL__ */
-
 #endif				/* __ACLINUX_H__ */
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
new file mode 100644
index 0000000..cce0723
--- /dev/null
+++ b/include/acpi/platform/aclinuxex.h
@@ -0,0 +1,116 @@
+/******************************************************************************
+ *
+ * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLINUXEX_H__
+#define __ACLINUXEX_H__
+
+#ifdef __KERNEL__
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+acpi_status __init acpi_os_initialize(void);
+
+acpi_status acpi_os_terminate(void);
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+static inline void *acpi_os_allocate(acpi_size size)
+{
+	return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+	return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void acpi_os_free(void *memory)
+{
+	kfree(memory);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+	return kmem_cache_zalloc(cache,
+				 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+	return (acpi_thread_id) (unsigned long)current;
+}
+
+/*
+ * When lockdep is enabled, the spin_lock_init() macro stringifies it's
+ * argument and uses that as a name for the lock in debugging.
+ * By executing spin_lock_init() in a macro the key changes from "lock" for
+ * all locks to the name of the argument of acpi_os_create_lock(), which
+ * prevents lockdep from reporting false positives for ACPICA locks.
+ */
+#define acpi_os_create_lock(__handle) \
+	({ \
+		spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
+		if (lock) { \
+			*(__handle) = lock; \
+			spin_lock_init(*(__handle)); \
+		} \
+		lock ? AE_OK : AE_NO_MEMORY; \
+	})
+
+void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
+
+void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
+
+/*
+ * OSL interfaces added by Linux
+ */
+void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
+
+#endif				/* __KERNEL__ */
+
+#endif				/* __ACLINUXEX_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
  2014-05-12  7:44     ` Lv Zheng
  (?)
@ 2014-05-12  7:46       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 97cb160..a7344f6 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0ab05d9..5d27e56 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 #ifndef CONFIG_ACPI
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
@ 2014-05-12  7:46       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 97cb160..a7344f6 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0ab05d9..5d27e56 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 #ifndef CONFIG_ACPI
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi
@ 2014-05-12  7:46       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

There is a mis-order inclusion for <asm/acpi.h>.

As we will enforce including <linux/acpi.h> for all Linux ACPI users, we
can find the inclusion order is as follows:

<linux/acpi.h>
  <acpi/acpi.h>
   <acpi/platform/acenv.h>
    (acenv.h before including aclinux.h)
    <acpi/platform/aclinux.h>
...........................................................................
     (aclinux.h before including asm/acpi.h)
     <asm/acpi.h>                             @Redundant@
      (ACPICA specific stuff)
...........................................................................
...........................................................................
      (Linux ACPI specific stuff) ? - - - - - - - - - - - - +
     (aclinux.h after including asm/acpi.h)   @Invisible@   |
    (acenv.h after including aclinux.h)       @Invisible@   |
   other ACPICA headers                       @Invisible@   |
............................................................|..............
  <acpi/acpi_bus.h>                                         |
  <acpi/acpi_drivers.h>                                     |
  <asm/acpi.h> (Excluded)                                   |
   (Linux ACPI specific stuff) ! <- - - - - - - - - - - - - +

NOTE that, in ACPICA, <acpi/platform/acenv.h> is more like Kconfig
generated <generated/autoconf.h> for Linux, it is meant to be included
before including any ACPICA code.

In the above figure, there is a question mark for "Linux ACPI specific
stuff" in <asm/acpi.h> which should be included after including all other
ACPICA header files.  Thus they really need to be moved to the position
marked with exclaimation mark or the definitions in the blocks marked with
"@Invisible@" will be invisible to such architecture specific "Linux ACPI
specific stuff" header blocks.  This leaves 2 issues:
1. All environmental definitions in these blocks should have a copy in the
   area marked with "@Redundant@" if they are required by the "Linux ACPI
   specific stuff".
2. We cannot use any ACPICA defined types in <asm/acpi.h>.

This patch splits architecture specific ACPICA stuff from <asm/acpi.h> to
fix this issue.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   65 +++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    2 +-
 5 files changed, 137 insertions(+), 96 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
new file mode 100644
index 0000000..e0896eb
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+#define COMPILER_DEPENDENT_INT64	long
+#define COMPILER_DEPENDENT_UINT64	unsigned long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()
+
+#ifdef CONFIG_ACPI
+
+static inline int
+ia64_acpi_acquire_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return (new < 3) ? -1 : 0;
+}
+
+static inline int
+ia64_acpi_release_global_lock(unsigned int *lock)
+{
+	unsigned int old, new, val;
+	do {
+		old = *lock;
+		new = old & ~0x3;
+		val = ia64_cmpxchg4_acq(lock, new, old);
+	} while (unlikely (val != old));
+	return old & 0x1;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
+	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
+
+#endif
+
+#endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 97cb160..a7344f6 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -34,56 +34,6 @@
 #include <linux/numa.h>
 #include <asm/numa.h>
 
-#define COMPILER_DEPENDENT_INT64	long
-#define COMPILER_DEPENDENT_UINT64	unsigned long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()
-
-static inline int
-ia64_acpi_acquire_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return (new < 3) ? -1 : 0;
-}
-
-static inline int
-ia64_acpi_release_global_lock (unsigned int *lock)
-{
-	unsigned int old, new, val;
-	do {
-		old = *lock;
-		new = old & ~0x3;
-		val = ia64_cmpxchg4_acq(lock, new, old);
-	} while (unlikely (val != old));
-	return old & 0x1;
-}
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
-	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
-
 #ifdef	CONFIG_ACPI
 #define acpi_disabled 0	/* ACPI always enabled on IA64 */
 #define acpi_noirq 0	/* ACPI always enabled on IA64 */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
new file mode 100644
index 0000000..6978584
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,65 @@
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2014, Intel Corporation
+ *   Author: Lv Zheng <lv.zheng@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+#include <asm/special_insns.h>
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
+
+#ifdef CONFIG_ACPI
+
+int __acpi_acquire_global_lock(unsigned int *lock);
+int __acpi_release_global_lock(unsigned int *lock);
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
+
+#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
+	((Acq) = __acpi_release_global_lock(&facs->global_lock))
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	asm("divl %2;"				     \
+	    : "=a"(q32), "=d"(r32)		     \
+	    : "r"(d32),				     \
+	     "0"(n_lo), "1"(n_hi))
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	asm("shrl   $1,%2	;"	\
+	    "rcrl   $1,%3;"		\
+	    : "=r"(n_hi), "=r"(n_lo)	\
+	    : "0"(n_hi), "1"(n_lo))
+
+#endif
+
+#endif /* _ASM_X86_ACENV_H */
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index c8c1e70..e06225e 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -32,51 +32,6 @@
 #include <asm/mpspec.h>
 #include <asm/realmode.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-/* Asm macros */
-
-#define ACPI_FLUSH_CPU_CACHE()	wbinvd()
-
-int __acpi_acquire_global_lock(unsigned int *lock);
-int __acpi_release_global_lock(unsigned int *lock);
-
-#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
-
-#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
-	((Acq) = __acpi_release_global_lock(&facs->global_lock))
-
-/*
- * Math helper asm macros
- */
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-	asm("divl %2;"				     \
-	    : "=a"(q32), "=d"(r32)		     \
-	    : "r"(d32),				     \
-	     "0"(n_lo), "1"(n_hi))
-
-
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
-	asm("shrl   $1,%2	;"	\
-	    "rcrl   $1,%3;"		\
-	    : "=r"(n_hi), "=r"(n_lo)	\
-	    : "0"(n_hi), "1"(n_lo))
-
 #ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 0ab05d9..5d27e56 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -71,7 +71,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
-#include <asm/acpi.h>
+#include <asm/acenv.h>
 
 #ifndef CONFIG_ACPI
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
  2014-05-12  7:44     ` Lv Zheng
  (?)
@ 2014-05-12  7:46       ` Lv Zheng
  -1 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5d27e56..e700129 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h>.
@ 2014-05-12  7:46       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5d27e56..e700129 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/ace
@ 2014-05-12  7:46       ` Lv Zheng
  0 siblings, 0 replies; 64+ messages in thread
From: Lv Zheng @ 2014-05-12  7:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck,
	Fenghua Yu, linux-ia64, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

Since mis-order issues have been solved, we can cleanup redundant
definitions that already have defaults in <acpi/platform/acenv.h>.

This patch removes redudant environments for __KERNEL__ surrounded code.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/ia64/include/asm/acenv.h   |   15 ---------------
 arch/x86/include/asm/acenv.h    |   16 ----------------
 include/acpi/platform/aclinux.h |    1 -
 3 files changed, 32 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index e0896eb..3f9eaee 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -17,23 +17,8 @@
 #define COMPILER_DEPENDENT_INT64	long
 #define COMPILER_DEPENDENT_UINT64	unsigned long
 
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
-#define ACPI_FLUSH_CPU_CACHE()
-
 #ifdef CONFIG_ACPI
 
 static inline int
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6978584..6687329 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -14,22 +14,6 @@
 
 #include <asm/special_insns.h>
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
 /* Asm macros */
 
 #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5d27e56..e700129 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
 
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
-#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
 
 #ifdef __KERNEL__
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 64+ messages in thread

* Re: [PATCH v3 0/4] ACPICA: Cleanups for <acpi/platform/acenv.h> and <acpi/platform/aclinux.h>.
  2014-05-12  7:44     ` Lv Zheng
                       ` (4 preceding siblings ...)
  (?)
@ 2014-05-16 12:06     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 64+ messages in thread
From: Rafael J. Wysocki @ 2014-05-16 12:06 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi

On Monday, May 12, 2014 03:44:37 PM Lv Zheng wrote:
> This patch series cleans up <acpi/platform/acenv.h> and
> <acpi/platform/aclinux.h>.  it also fixes some mis-ordered inclusions for
> Linux resident ACPICA.
> 
> There is no real issue in the Linux kernel, but this can help to cleanup
> the code so that (benefits):
> 1. Redundant environment definitions can be removed from <asm/acpi.h> and
>    <acpi/platform/aclinux.h>.
> 2. Lift a burden off the ACPICA release automation - copying default ACPICA
>    environment setting to all <asm/acpi.h> file each time a new environment
>    is introduced just in order to avoid build errors.
> 3. The wrong <acpi/actypes.h> inclusion can be removed from
>    <acpi/platform/aclinux.h>.
> 4. Using ACPICA defined types in <asm/acpi.h> is possible.
> 5. Using "static inline" to define ACPICA OSL functions is still possible
>    and won't cause build errors any longer.
> 6. All non back ported prototypes are collected in a single file.
> 
> The patch set has passed the following build/boot tests.
> Build tests are performed as follows:
> 1. i386 + default + COFNIG_ACPI=y
> 2. i386 + default + COFNIG_ACPI=n
> 3. x86_64 + default + COFNIG_ACPI=y
> 4. x86_64 + default + COFNIG_ACPI=n
> Boot tests are performed as follows:
> 1. i386 + default + COFNIG_ACPI=y
> 2. x86_64 + default + COFNIG_ACPI=y
> Where:
> 1. i386: machine named as "Dell Inspiron Mini 1010"
> 2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
> 3. default: kernel configuration with following items enabled:
>    All hardware drivers related to the machines of i386/x86_64
>    All drivers/acpi configurations
>    All platform drivers
>    All ACPI drivers
>    4 DRM drivers that implement ACPI opregion
>    All buses with ACPI bindings
>    All cpufreq configurations
>    All xen configurations
>    All ACPI table drivers
> 
> Lv Zheng (4):
>   ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no
>     usages.
>   ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove
>     mis-ordered inclusion of <acpi/actypes.h> from
>     <acpi/platform/aclinux.h>.
>   ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered
>     inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h>.
>   ACPICA: Cleanup redudant definitions that already have defaults in
>     <acpi/platform/acenv.h>.
> 
>  arch/ia64/include/asm/acenv.h     |   56 ++++++++++++
>  arch/ia64/include/asm/acpi.h      |   50 -----------
>  arch/x86/include/asm/acenv.h      |   49 +++++++++++
>  arch/x86/include/asm/acpi.h       |   45 ----------
>  include/acpi/acpi.h               |    4 +-
>  include/acpi/platform/acenvex.h   |   63 ++++++++++++++
>  include/acpi/platform/aclinux.h   |  171 ++++++++-----------------------------
>  include/acpi/platform/aclinuxex.h |  116 +++++++++++++++++++++++++
>  8 files changed, 322 insertions(+), 232 deletions(-)
>  create mode 100644 arch/ia64/include/asm/acenv.h
>  create mode 100644 arch/x86/include/asm/acenv.h
>  create mode 100644 include/acpi/platform/acenvex.h
>  create mode 100644 include/acpi/platform/aclinuxex.h

All four applied to bleeding-edge, thanks Lv!

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2014-05-16 11:49 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1385110130.git.lv.zheng@intel.com>
2014-04-08  7:55 ` [PATCH 0/4] ACPICA: Fix some mis-ordered inclusions Lv Zheng
2014-04-08  7:55   ` Lv Zheng
2014-04-08  7:56   ` [PATCH 1/4] ACPICA: Add <acpi/platform/aclinuxxf.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-04-08  7:56     ` Lv Zheng
2014-04-21 20:58     ` Rafael J. Wysocki
2014-04-22  2:01       ` Zheng, Lv
2014-04-22  2:01         ` Zheng, Lv
2014-04-22 11:16         ` Rafael J. Wysocki
2014-04-23  1:06           ` Zheng, Lv
2014-04-23  1:06             ` Zheng, Lv
2014-04-08  7:56   ` [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> " Lv Zheng
2014-04-08  7:56     ` [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/pla Lv Zheng
2014-04-08  7:56     ` [PATCH 2/4] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-04-08  7:57   ` [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-04-08  7:57     ` [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv Lv Zheng
2014-04-08  7:57     ` [PATCH 3/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-04-08  7:57   ` [PATCH 4/4] ACPICA: Remove deprecated _LINUX definitions for ACPICA Lv Zheng
2014-04-08  7:57     ` Lv Zheng
2014-04-23  6:53   ` [PATCH v2 0/5] ACPICA: Fix some mis-ordered inclusions Lv Zheng
2014-04-23  6:53     ` Lv Zheng
2014-04-23  6:53     ` [PATCH v2 1/5] ACPICA: OSL: Add direct inclusion of extra header Lv Zheng
2014-04-23  6:53       ` Lv Zheng
2014-04-27 21:33       ` Rafael J. Wysocki
2014-04-28  4:12         ` Zheng, Lv
2014-04-28  4:12           ` Zheng, Lv
2014-04-23  6:53     ` [PATCH v2 2/5] ACPICA: Add <acpi/acpi_opt.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-04-23  6:53       ` Lv Zheng
2014-04-23  6:54     ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> " Lv Zheng
2014-04-23  6:54       ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/ Lv Zheng
2014-04-23  6:54       ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-04-27 21:36       ` Rafael J. Wysocki
2014-04-27 21:36         ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Rafael J. Wysocki
2014-04-28  3:02         ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Zheng, Lv
2014-04-28  3:02           ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Zheng, Lv
2014-04-28  3:02           ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Zheng, Lv
2014-04-28 20:30           ` Rafael J. Wysocki
2014-04-28 20:30             ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Rafael J. Wysocki
2014-04-29  7:49             ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Zheng, Lv
2014-04-29  7:49               ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <a Zheng, Lv
2014-04-29  7:49               ` [PATCH v2 3/5] ACPICA: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Zheng, Lv
2014-04-23  6:54     ` [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-04-23  6:54       ` [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/ace Lv Zheng
2014-04-23  6:54       ` [PATCH v2 4/5] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-04-23  6:54     ` [PATCH v2 5/5] ACPICA: Remove deprecated _LINUX definitions for ACPICA Lv Zheng
2014-04-23  6:54       ` Lv Zheng
2014-04-27 21:38       ` Rafael J. Wysocki
2014-04-28  4:10         ` Zheng, Lv
2014-04-28  4:10           ` Zheng, Lv
2014-04-28 20:26           ` Rafael J. Wysocki
2014-04-29  7:50             ` Zheng, Lv
2014-04-29  7:50               ` Zheng, Lv
2014-05-12  7:44   ` [PATCH v3 0/4] ACPICA: Cleanups for <acpi/platform/acenv.h> and <acpi/platform/aclinux.h> Lv Zheng
2014-05-12  7:44     ` Lv Zheng
2014-05-12  7:45     ` [PATCH v3 1/4] ACPICA: Linux headers: Remove ACPI_PREEMPTION_POINT() due to no usages Lv Zheng
2014-05-12  7:45       ` Lv Zheng
2014-05-12  7:46     ` [PATCH v3 2/4] ACPICA: Linux headers: Add <acpi/platform/aclinuxex.h> to remove mis-ordered inclusion of <acpi/actypes.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-05-12  7:46       ` Lv Zheng
2014-05-12  7:46     ` [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> " Lv Zheng
2014-05-12  7:46       ` [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi Lv Zheng
2014-05-12  7:46       ` [PATCH v3 3/4] ACPICA: Linux headers: Add <asm/acenv.h> to remove mis-ordered inclusion of <asm/acpi.h> from <acpi/platform/aclinux.h> Lv Zheng
2014-05-12  7:46     ` [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-05-12  7:46       ` [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/ace Lv Zheng
2014-05-12  7:46       ` [PATCH v3 4/4] ACPICA: Cleanup redudant definitions that already have defaults in <acpi/platform/acenv.h> Lv Zheng
2014-05-16 12:06     ` [PATCH v3 0/4] ACPICA: Cleanups for <acpi/platform/acenv.h> and <acpi/platform/aclinux.h> Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.