linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files.
@ 2013-12-18  9:05 Lv Zheng
  2013-12-18  9:05 ` [RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables Lv Zheng
                   ` (17 more replies)
  0 siblings, 18 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:05 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

Currently, there are issues in the ACPI subsystem:

1. ACPICA header files are lacking in stub protections.
   This makes all ACPICA header files could only be included for
   CONFIG_ACPI=y environment.  This infects new ACPI prototypes, if such
   prototypes referenced ACPICA defined types, they must be incldued only
   in the CONFIG_ACPI=y environment.  While CONFIG_SFI requires to include
   ACPICA headers to find generic table definitions when CONFIG_ACPI is not
   enabled.  This seems to be too complicated to achieve a cleaned SFI
   header.  So please check if this solution is acceptable.  And this patch
   set is thus marked as RFC.
2. ACPICA layer is lacking in its own architecture specific layer.
   The file <asm/acpi.h> now is used as architecture specific layer of both
   in kernel ACPICA and Linux ACPI.  While Linux ACPI headers are always
   need to include ACPICA top level header <acpi/acpi.h> to find ACPICA
   defined types before including their own architecture specific layer.
   The mis-order of header inclusion will potentially infect
   arch/x86/include/asm folder, and defining prototypes using ACPICA types
   in <asm/acpi.h> is not possible.

This patchset solves above issues to make ACPICA a law-abiding resident in
the Linux kernel.

The benefits of merging this series are:
1. We can sort all direct <acpi/acpi.h> inclusions from subsystems other
   than ACPICA out from the entire kernel source tree.
2. We are able to kill many "#ifdef CONFIG_ACPI" code from other kernel
   subsystems.
3. Using ACPICA types in <asm/acpi.h> is possible.

PATCH 01-13 add stub protections for ACPICA headers.
      01-02 add stub support for ACPICA global variables
      03    add stub support for ACPICA OSL prototypes
      04    add stub support for ACPICA macros
      05-09 add stub support for ACPICA external functions
      10-13 remove <asm/acpi.h> inclusion from ACPICA headers.
PATCH 14-15 remove wrong direct <acpi/acpi.h> inclusions.

NOTE: PATCH 01-08 are linuxized ACPICA commits, it is better to merge them
      into the ACPICA upstream first and integrate them into Linux during
      ACPICA release process.  Or the divergences generated by this series
      may hurt ACPICA release automation.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
  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
They are tested twice with CONFIG_ACPI enabled/disabled.

Also allyes/allno/allmod tests are done for ARCH=i386 and ARCH=x86_64.

A boot test has been done to ARCH=x86_64 default configuration and it is
confirmed that the ACPI devices are successfully created under
/sys/bus/acpi/devices when CONFIG_ACPI is enabled.

Another test is to compose a .c file invoking all ACPICA globals,
functions, macros and built it with and without CONFIG_ACPI enabled.

Lv Zheng (15):
  ACPICA: OSL: Add configurability mechanism for global variables.
  ACPICA: Linux: Add configurability for external globals.
  ACPICA: Linux: Add configurability for OSL APIs.
  ACPICA: OSL: Cleanup external macros and add stubs for macros.
  ACPICA: OSL: Add configurability to error message functions.
  ACPICA: OSL: Add configurability to debug output functions.
  ACPICA: OSL: Add configurability mechanism for external APIs.
  ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages for external APIs.
  ACPICA: Linux: Add stub support for Linux specific variables and
    functions.
  ACPICA: Linux: Add architecture specific ACPICA headers in Linux.
  ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  ACPICA: Linux: Add configuration item to indicate the architecture
    specific support.
  ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers.
  ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper -
    table definitions.
  ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI
    users.

 arch/ia64/Kconfig                    |    1 +
 arch/ia64/include/asm/acenv.h        |   73 ++++
 arch/ia64/include/asm/acpi.h         |   50 ---
 arch/ia64/kernel/acpi.c              |    1 -
 arch/x86/Kconfig                     |    1 +
 arch/x86/include/asm/acenv.h         |   70 +++
 arch/x86/include/asm/acpi.h          |   45 --
 arch/x86/kernel/acpi/boot.c          |    1 -
 drivers/acpi/Kconfig                 |    4 +
 drivers/acpi/acpica/acglobal.h       |  123 ------
 drivers/acpi/acpica/utglobal.c       |    6 -
 drivers/acpi/acpica/utxferror.c      |    2 +
 drivers/acpi/bus.c                   |    3 -
 drivers/platform/x86/thinkpad_acpi.c |    1 -
 include/acpi/acpixf.h                |  782 +++++++++++++++++++++++-----------
 include/acpi/actypes.h               |   21 +
 include/acpi/platform/aclinux.h      |  182 +++++++-
 include/linux/acpi.h                 |   13 +-
 include/linux/acpica.h               |   22 +
 include/linux/sfi_acpi.h             |    3 -
 include/linux/thinkpad_acpi.h        |    2 +
 sound/pci/hda/patch_conexant.c       |    1 -
 sound/pci/hda/patch_realtek.c        |    1 -
 23 files changed, 910 insertions(+), 498 deletions(-)
 create mode 100644 arch/ia64/include/asm/acenv.h
 create mode 100644 arch/x86/include/asm/acenv.h
 create mode 100644 include/linux/acpica.h

-- 
1.7.10.4


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

* [RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
@ 2013-12-18  9:05 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 02/15] ACPICA: Linux: Add configurability for external globals Lv Zheng
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:05 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch extends ACPI_INIT_GLOBAL mechanism to all global variables so
that the OSPMs can have full control to configure them into immediates.
This patch doesn't include any code for Linux to utilize this mechanism.

Linux practice shows there are external users out of Linux ACPI subsystem
checking ACPICA provided global variables.  Linux trends to protect such
global variables by defining them to default values when specific Kconfig
items are not enabled (particular to ACPICA, it should be CONFIG_ACPI) or
Linux will suffer from build errors complaining the absense of such global
variables.
This patch converts all ACPICA global variables into macro wrapped so that
OSPMs can configure such global variables out by defining ACPI_GLOBAL and
ACPI_INIT_GLOBAL into no-ops.  For the code still referencing such globals
when ACPICA is configured out, OSPMs can either define global variable
symbols into constant variables (static const if it doesn't increase the
size of the OSPMs' binary image) or maintain a big list of the macros in
the "#define AcpiGbl_x v" style.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/acglobal.h |  123 -----------------------------
 drivers/acpi/acpica/utglobal.c |    6 --
 include/acpi/acpixf.h          |  170 ++++++++++++++++++++++++++++++++--------
 3 files changed, 138 insertions(+), 161 deletions(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index e9f1fc7..923fa29 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -44,127 +44,6 @@
 #ifndef __ACGLOBAL_H__
 #define __ACGLOBAL_H__
 
-/*
- * Ensure that the globals are actually defined and initialized only once.
- *
- * The use of these macros allows a single list of globals (here) in order
- * to simplify maintenance of the code.
- */
-#ifdef DEFINE_ACPI_GLOBALS
-#define ACPI_EXTERN
-#define ACPI_INIT_GLOBAL(a,b) a=b
-#else
-#define ACPI_EXTERN extern
-#define ACPI_INIT_GLOBAL(a,b) a
-#endif
-
-#ifdef DEFINE_ACPI_GLOBALS
-
-/* Public globals, available from outside ACPICA subsystem */
-
-/*****************************************************************************
- *
- * Runtime configuration (static defaults that can be overriden at runtime)
- *
- ****************************************************************************/
-
-/*
- * Enable "slack" in the AML interpreter?  Default is FALSE, and the
- * interpreter strictly follows the ACPI specification. Setting to TRUE
- * allows the interpreter to ignore certain errors and/or bad AML constructs.
- *
- * Currently, these features are enabled by this flag:
- *
- * 1) Allow "implicit return" of last value in a control method
- * 2) Allow access beyond the end of an operation region
- * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
- * 4) Allow ANY object type to be a source operand for the Store() operator
- * 5) Allow unresolved references (invalid target name) in package objects
- * 6) Enable warning messages for behavior that is not ACPI spec compliant
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
-
-/*
- * Automatically serialize ALL control methods? Default is FALSE, meaning
- * to use the Serialized/not_serialized method flags on a per method basis.
- * Only change this if the ASL code is poorly written and cannot handle
- * reentrancy even though methods are marked "NotSerialized".
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
-
-/*
- * Create the predefined _OSI method in the namespace? Default is TRUE
- * because ACPI CA is fully compatible with other ACPI implementations.
- * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
-
-/*
- * Optionally use default values for the ACPI register widths. Set this to
- * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
-
-/*
- * Optionally enable output from the AML Debug Object.
- */
-bool ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
-
-/*
- * Optionally copy the entire DSDT to local memory (instead of simply
- * mapping it.) There are some BIOSs that corrupt or replace the original
- * DSDT, creating the need for this option. Default is FALSE, do not copy
- * the DSDT.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE);
-
-/*
- * Optionally truncate I/O addresses to 16 bits. Provides compatibility
- * with other ACPI implementations. NOTE: During ACPICA initialization,
- * this value is set to TRUE if any Windows OSI strings have been
- * requested by the BIOS.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
-
-/*
- * Disable runtime checking and repair of values returned by control methods.
- * Use only if the repair is causing a problem on a particular machine.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
-
-/*
- * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
- * This can be useful for debugging ACPI problems on some machines.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
-
-/*
- * We keep track of the latest version of Windows that has been requested by
- * the BIOS.
- */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_osi_data, 0);
-
-/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
-
-struct acpi_table_fadt acpi_gbl_FADT;
-u32 acpi_current_gpe_count;
-u32 acpi_gbl_trace_flags;
-acpi_name acpi_gbl_trace_method_name;
-u8 acpi_gbl_system_awake_and_running;
-
-/*
- * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
- * that the ACPI hardware is no longer required. A flag in the FADT indicates
- * a reduced HW machine, and that flag is duplicated here for convenience.
- */
-u8 acpi_gbl_reduced_hardware;
-
-#endif				/* DEFINE_ACPI_GLOBALS */
-
-/* Do not disassemble buffers to resource descriptors */
-
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
-
 /*****************************************************************************
  *
  * ACPI Table globals
@@ -428,8 +307,6 @@ ACPI_EXTERN u8 acpi_gbl_db_output_flags;
 
 #ifdef ACPI_DISASSEMBLER
 
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE);
-
 ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
 ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
 ACPI_EXTERN u8 acpi_gbl_num_external_methods;
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 81f9a95..b15b822 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -59,12 +59,6 @@ ACPI_MODULE_NAME("utglobal")
  * We want the debug switches statically initialized so they
  * are already set when the debugger is entered.
  */
-/* Debug switch - level and trace mask */
-u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
-
-/* Debug switch - layer (component) mask */
-
-u32 acpi_dbg_layer = 0;
 u32 acpi_gbl_nesting_level = 0;
 
 /* Debugger globals */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 4278aba9..76df71d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -57,34 +57,147 @@ extern u8 acpi_gbl_permanent_mmap;
 extern u32 acpi_rsdt_forced;
 
 /*
- * Globals that are publically available
+ * Ensure that the globals are actually defined and initialized only once.
+ *
+ * The use of these macros allows a single list of globals (here) in order
+ * to simplify maintenance of the code.
+ */
+#ifdef DEFINE_ACPI_GLOBALS
+
+#define ACPI_EXTERN
+#define ACPI_GLOBAL(t,a) \
+	t a;
+#define ACPI_INIT_GLOBAL(t,a,b) \
+	t a=b;
+#define ACPI_GLOBAL_FADT \
+	struct acpi_table_fadt acpi_gbl_FADT;
+
+#else
+
+#define ACPI_EXTERN extern
+#define ACPI_GLOBAL(t,a) \
+	extern t a;
+#define ACPI_INIT_GLOBAL(t,a,b) \
+	extern t a;
+#define ACPI_GLOBAL_FADT \
+	extern struct acpi_table_fadt acpi_gbl_FADT;
+
+#endif
+
+/* Public globals, available from outside ACPICA subsystem */
+
+/*****************************************************************************
+ *
+ * Runtime configuration (static defaults that can be overriden at runtime)
+ *
+ ****************************************************************************/
+
+/*
+ * Enable "slack" in the AML interpreter?  Default is FALSE, and the
+ * interpreter strictly follows the ACPI specification. Setting to TRUE
+ * allows the interpreter to ignore certain errors and/or bad AML constructs.
+ *
+ * Currently, these features are enabled by this flag:
+ *
+ * 1) Allow "implicit return" of last value in a control method
+ * 2) Allow access beyond the end of an operation region
+ * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
+ * 4) Allow ANY object type to be a source operand for the Store() operator
+ * 5) Allow unresolved references (invalid target name) in package objects
+ * 6) Enable warning messages for behavior that is not ACPI spec compliant
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE)
+
+/*
+ * Automatically serialize ALL control methods? Default is FALSE, meaning
+ * to use the Serialized/not_serialized method flags on a per method basis.
+ * Only change this if the ASL code is poorly written and cannot handle
+ * reentrancy even though methods are marked "NotSerialized".
  */
-extern u32 acpi_current_gpe_count;
-extern struct acpi_table_fadt acpi_gbl_FADT;
-extern u8 acpi_gbl_system_awake_and_running;
-extern u8 acpi_gbl_reduced_hardware;	/* ACPI 5.0 */
-extern u8 acpi_gbl_osi_data;
-
-/* Runtime configuration of debug print levels */
-
-extern u32 acpi_dbg_level;
-extern u32 acpi_dbg_layer;
-
-/* ACPICA runtime options */
-
-extern u8 acpi_gbl_enable_interpreter_slack;
-extern u8 acpi_gbl_all_methods_serialized;
-extern u8 acpi_gbl_create_osi_method;
-extern u8 acpi_gbl_use_default_register_widths;
-extern acpi_name acpi_gbl_trace_method_name;
-extern u32 acpi_gbl_trace_flags;
-extern bool acpi_gbl_enable_aml_debug_object;
-extern u8 acpi_gbl_copy_dsdt_locally;
-extern u8 acpi_gbl_truncate_io_addresses;
-extern u8 acpi_gbl_disable_auto_repair;
-extern u8 acpi_gbl_disable_ssdt_table_load;
+ACPI_INIT_GLOBAL(u8, acpi_gbl_all_methods_serialized, FALSE)
 
 /*
+ * Create the predefined _OSI method in the namespace? Default is TRUE
+ * because ACPI CA is fully compatible with other ACPI implementations.
+ * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE)
+
+/*
+ * Optionally use default values for the ACPI register widths. Set this to
+ * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE)
+
+/*
+ * Optionally enable output from the AML Debug Object.
+ */
+ACPI_INIT_GLOBAL(bool, acpi_gbl_enable_aml_debug_object, FALSE)
+
+/*
+ * Optionally copy the entire DSDT to local memory (instead of simply
+ * mapping it.) There are some BIOSs that corrupt or replace the original
+ * DSDT, creating the need for this option. Default is FALSE, do not copy
+ * the DSDT.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE)
+
+/*
+ * Optionally truncate I/O addresses to 16 bits. Provides compatibility
+ * with other ACPI implementations. NOTE: During ACPICA initialization,
+ * this value is set to TRUE if any Windows OSI strings have been
+ * requested by the BIOS.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE)
+
+/*
+ * Disable runtime checking and repair of values returned by control methods.
+ * Use only if the repair is causing a problem on a particular machine.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE)
+
+/*
+ * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
+ * This can be useful for debugging ACPI problems on some machines.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_load, FALSE)
+
+/*
+ * We keep track of the latest version of Windows that has been requested by
+ * the BIOS.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0)
+
+/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
+ ACPI_GLOBAL_FADT
+ACPI_GLOBAL(u32, acpi_current_gpe_count)
+ACPI_GLOBAL(u32, acpi_gbl_trace_flags)
+ACPI_GLOBAL(acpi_name, acpi_gbl_trace_method_name)
+ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running)
+
+/* Debug switch - level and trace mask */
+#ifdef ACPI_DEBUG_OUTPUT
+ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT)
+#else
+ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_NORMAL_DEFAULT)
+#endif
+/* Debug switch - layer (component) mask */
+ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, ACPI_COMPONENT_DEFAULT)
+
+/*
+ * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
+ * that the ACPI hardware is no longer required. A flag in the FADT indicates
+ * a reduced HW machine, and that flag is duplicated here for convenience.
+ */
+ACPI_GLOBAL(u8, acpi_gbl_reduced_hardware)
+
+/* Disassembler related globals */
+#ifdef ACPI_DISASSEMBLER
+/* Do not disassemble buffers to resource descriptors */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
+ ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE)
+#endif
+/*
  * Hardware-reduced prototypes. All interfaces that use these macros will
  * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
  * is set to TRUE.
@@ -92,25 +205,18 @@ extern u8 acpi_gbl_disable_ssdt_table_load;
 #if (!ACPI_REDUCED_HARDWARE)
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
 	prototype;
-
 #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
 	prototype;
-
 #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
 	prototype;
-
 #else
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
 	static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
-
 #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
 	static ACPI_INLINE prototype {return(AE_OK);}
-
 #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
 	static ACPI_INLINE prototype {return;}
-
 #endif				/* !ACPI_REDUCED_HARDWARE */
-
 /*
  * Initialization
  */
-- 
1.7.10.4


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

* [RFC PATCH 02/15] ACPICA: Linux: Add configurability for external globals.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
  2013-12-18  9:05 ` [RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 03/15] ACPICA: Linux: Add configurability for OSL APIs Lv Zheng
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.

This patch configures ACPICA external globals out and defines them into
immediates when CONFIG_ACPI is not enabled.  Lv Zheng.

Known issues:
1. No possible referencs by !CONFIG_ACPI code
   We even don't need to define specific globals into immediates if it is
   impossible that there are references for them in !CONFIG_ACPI code.
   This patch just adds immediates for all of them from ACPICA's
   perspectives.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpixf.h           |   11 ++++++++
 include/acpi/platform/aclinux.h |   53 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 76df71d..2fc2094 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -74,13 +74,24 @@ extern u32 acpi_rsdt_forced;
 
 #else
 
+#ifndef ACPI_EXTERN
 #define ACPI_EXTERN extern
+#endif
+
+#ifndef ACPI_GLOBAL
 #define ACPI_GLOBAL(t,a) \
 	extern t a;
+#endif
+
+#ifndef ACPI_INIT_GLOBAL
 #define ACPI_INIT_GLOBAL(t,a,b) \
 	extern t a;
+#endif
+
+#ifndef ACPI_GLOBAL_FADT
 #define ACPI_GLOBAL_FADT \
 	extern struct acpi_table_fadt acpi_gbl_FADT;
+#endif
 
 #endif
 
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 28f4f4d..68cda04 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -65,6 +65,59 @@
 #endif
 #include <asm/acpi.h>
 
+#ifdef CONFIG_ACPI
+
+/*
+ * External acpi_gbl_FADT users will use Revision and Flags to test
+ * features, such code may not well protected by CONFIG_ACPI.
+ */
+#define acpi_get_fadt_revision()    (acpi_gbl_FADT.header.revision)
+#define acpi_test_fadt_flags(__flags) (acpi_gbl_FADT.flags & (__flags))
+
+#else				/* CONFIG_ACPI */
+
+/* Extarnal globals for __KERNEL__, stubs is needed */
+
+#define ACPI_EXTERN
+#define ACPI_GLOBAL(t,a)
+#define ACPI_INIT_GLOBAL(t,a,b)
+#define ACPI_GLOBAL_FADT
+
+/* Immediates to protect global variables accesses */
+
+#define acpi_current_gpe_count              0
+#define acpi_gbl_trace_flags                0
+#define acpi_gbl_trace_method_name          0
+#define acpi_gbl_system_awake_and_running   FALSE
+#define acpi_gbl_reduced_hardware           FALSE
+#define acpi_gbl_enable_interpreter_slack   FALSE
+#define acpi_gbl_all_methods_serialized     FALSE
+#define acpi_gbl_create_osi_method          TRUE
+#define acpi_gbl_use_default_register_widths TRUE
+#define acpi_gbl_enable_aml_debug_object    FALSE
+#define acpi_gbl_copy_dsdt_locally          FALSE
+#define acpi_gbl_truncate_io_addresses      FALSE
+#define acpi_gbl_disable_auto_repair        FALSE
+#define acpi_gbl_disable_ssdt_table_load    FALSE
+#define acpi_gbl_osi_data                   0
+#define acpi_dbg_level                      ACPI_DEBUG_DEFAULT
+#define acpi_dbg_layer                      ACPI_COMPONENT_DEFAULT
+
+/* Helpers to protect acpi_gbl_FADT accesses */
+
+#define acpi_get_fadt_revision()    0
+#define acpi_test_fadt_flags(__flags) 0
+
+#endif				/* CONFIG_ACPI */
+
+#ifndef ACPI_DISASSEMBLER
+
+/* Immediates to protect global variables accesses */
+
+#define acpi_gbl_no_resource_disassembly    FALSE
+#define acpi_gbl_ignore_noop_operator       FALSE
+#endif
+
 /* Host-dependent types and defines for in-kernel ACPICA */
 
 #define ACPI_MACHINE_WIDTH          BITS_PER_LONG
-- 
1.7.10.4


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

* [RFC PATCH 03/15] ACPICA: Linux: Add configurability for OSL APIs.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
  2013-12-18  9:05 ` [RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 02/15] ACPICA: Linux: Add configurability for external globals Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 04/15] ACPICA: OSL: Cleanup external macros and add stubs for macros Lv Zheng
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.
This patch configures ACPICA internal OSL prototypes out when ACPI is
disabled to facilitate Linux with such configurability.

Note that this patch is generated in the assumption that all ACPICA OSL
APIs should only be used by ACPICA itself.  While the real world is there
are some external ACPICA macros called ACPICA OSL APIs.  This patch
doesn't include protections around the OSL APIs that are used by such
ACPICA external macros.  Lv Zheng.

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

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 68cda04..5e5de9c 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -108,6 +108,65 @@
 #define acpi_get_fadt_revision()    0
 #define acpi_test_fadt_flags(__flags) 0
 
+/* OSL prototypes for __KERNEL__, hiding their declarations */
+
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex
+#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_map_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
+#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf
+#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
+
 #endif				/* CONFIG_ACPI */
 
 #ifndef ACPI_DISASSEMBLER
@@ -164,6 +223,8 @@
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_ACPI
+
 /*
  * FIXME: Inclusion of actypes.h
  * Linux kernel need this before defining inline OSL interfaces as
@@ -296,6 +357,8 @@ void acpi_os_gpe_count(u32 gpe_number);
 
 void acpi_os_fixed_event_count(u32 fixed_event_number);
 
+#endif				/* CONFIG_ACPI */
+
 #endif				/* __KERNEL__ */
 
 #endif				/* __ACLINUX_H__ */
-- 
1.7.10.4


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

* [RFC PATCH 04/15] ACPICA: OSL: Cleanup external macros and add stubs for macros.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (2 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 03/15] ACPICA: Linux: Add configurability for OSL APIs Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 05/15] ACPICA: OSL: Add configurability to error message functions Lv Zheng
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

OSPMs like Linux trend to include all header files but leave empty stub
macros for a feature that is not configured during build.

For macros defined to constants or defined to functions without other
functions referencesd (exceptions are ACPI_ALLOCATE_BUFFER and
ACPI_OFFSET-like macros), it is safe to leave them without protections.

By investigation, there are only the following internal/external
functions referenced by the ACPICA macros:
1. C library functions, including string, ctype, stdarg APIs.  Such
   functionalities are always accessbile in the kernel source tree, so
   it is safe to leave them without protected for Linux.
2. ACPICA OSL functions, such functions are designed to be used only by
   ACPICA internal APIs.  But in the Linux kernel, there are references
   in the macros referencing mutex and memory allocation APIs.
   Fortunately, there is no external users directly invoking ACPI_MUTEX
   OSL functions.  But for ACPI_ALLOCATE and ACPI_ALLOCATE_BUFFER, there
   are AcpiOsFree or kfree called as their reversals.  This patch adds
   mechanism to protect ACPICA memory allocation APIs for Linux so that
   Linux can have full control of such macros to configure them into
   no-ops.
3. ACPI_OFFSET and other macros that would access structure members that
   are not accessible under a specific configuration.  Fortunately,
   currently Linux doesn't use such structure members when CONFIG_ACPI
   is disabled.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/actypes.h          |   21 +++++++++++++++++++++
 include/acpi/platform/aclinux.h |   12 ++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 809b1a0..8332d95 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -329,6 +329,15 @@ typedef u32 acpi_physical_address;
  *
  ******************************************************************************/
 
+#ifdef ACPI_NO_MEM_ALLOCATIONS
+
+#define ACPI_ALLOCATE(a)                NULL
+#define ACPI_ALLOCATE_ZEROED(a)         NULL
+#define ACPI_FREE(a)
+#define ACPI_MEM_TRACKING(a)
+
+#else				/* ACPI_NO_MEM_ALLOCATIONS */
+
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 /*
  * Memory allocation tracking (used by acpi_exec to detect memory leaks)
@@ -350,6 +359,8 @@ typedef u32 acpi_physical_address;
 
 #endif				/* ACPI_DBG_TRACK_ALLOCATIONS */
 
+#endif				/* ACPI_NO_MEM_ALLOCATIONS */
+
 /******************************************************************************
  *
  * ACPI Specification constants (Do not change unless the specification changes)
@@ -928,9 +939,19 @@ struct acpi_object_list {
  * Miscellaneous common Data Structures used by the interfaces
  */
 #define ACPI_NO_BUFFER              0
+
+#ifdef ACPI_NO_MEM_ALLOCATIONS
+
+#define ACPI_ALLOCATE_BUFFER        (acpi_size) (0)
+#define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (0)
+
+#else				/* ACPI_NO_MEM_ALLOCATIONS */
+
 #define ACPI_ALLOCATE_BUFFER        (acpi_size) (-1)
 #define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (-2)
 
+#endif				/* ACPI_NO_MEM_ALLOCATIONS */
+
 struct acpi_buffer {
 	acpi_size length;	/* Length in bytes of the buffer */
 	void *pointer;		/* pointer to buffer */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5e5de9c..fce521d 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -52,6 +52,18 @@
 
 #ifdef __KERNEL__
 
+/* Never using tracking mechanism for Linux kernel */
+
+#undef ACPI_DBG_TRACK_ALLOCATIONS
+
+#ifndef CONFIG_ACPI
+
+/* Generating stubs for configurable ACPICA macros */
+
+#define ACPI_NO_MEM_ALLOCATIONS
+
+#endif
+
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
-- 
1.7.10.4


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

* [RFC PATCH 05/15] ACPICA: OSL: Add configurability to error message functions.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (3 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 04/15] ACPICA: OSL: Cleanup external macros and add stubs for macros Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 06/15] ACPICA: OSL: Add configurability to debug output functions Lv Zheng
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch extends ACPI_HW_DEPENDENT_x mechanism to all error message
related functions so that the OSPMs can have full control to configure
them into stub functions.
This patch also includes code for Linux to use this new mechanism for
the code that is built without CONFIG_ACPI enabled.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/utxferror.c |    2 ++
 include/acpi/acpixf.h           |   75 +++++++++++++++++++++++++--------------
 include/acpi/platform/aclinux.h |    4 +++
 3 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index f7edb88..44e36d7 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -53,6 +53,7 @@ ACPI_MODULE_NAME("utxferror")
  * This module is used for the in-kernel ACPICA as well as the ACPICA
  * tools/applications.
  */
+#ifndef ACPI_NO_ERROR_MESSAGES	/* Entire module */
 /*******************************************************************************
  *
  * FUNCTION:    acpi_error
@@ -249,3 +250,4 @@ acpi_bios_warning(const char *module_name,
 }
 
 ACPI_EXPORT_SYMBOL(acpi_bios_warning)
+#endif				/* ACPI_NO_ERROR_MESSAGES */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 2fc2094..6c8619d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -229,6 +229,18 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
 	static ACPI_INLINE prototype {return;}
 #endif				/* !ACPI_REDUCED_HARDWARE */
 /*
+ * Error-message prototypes. All interfaces that use these macros will
+ * be configured out of the ACPICA build if the ACPI_NO_ERROR_MESSAGE flag
+ * is defined.
+ */
+#ifndef ACPI_NO_ERROR_MESSAGES
+#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
+	prototype;
+#else
+#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
+	static ACPI_INLINE prototype {return;}
+#endif				/* ACPI_NO_ERROR_MESSAGES */
+/*
  * Initialization
  */
 acpi_status __init
@@ -661,38 +673,47 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 /*
  * Error/Warning output
  */
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_error(const char *module_name, u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(4)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_exception(const char *module_name,
-	       u32 line_number, acpi_status status, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_warning(const char *module_name, u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_info(const char *module_name, u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_bios_error(const char *module_name,
-		u32 line_number, const char *format, ...);
-
-ACPI_PRINTF_LIKE(3)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_bios_warning(const char *module_name,
-		  u32 line_number, const char *format, ...);
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+			       void ACPI_INTERNAL_VAR_XFACE
+			       acpi_error(const char *module_name,
+					  u32 line_number,
+					  const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_exception(const char *module_name,
+					       u32 line_number,
+					       acpi_status status,
+					       const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_warning(const char *module_name,
+					     u32 line_number,
+					     const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_info(const char *module_name,
+					  u32 line_number,
+					  const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_bios_error(const char *module_name,
+						u32 line_number,
+						const char *format, ...))
+
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_bios_warning(const char *module_name,
+						  u32 line_number,
+						  const char *format, ...))
 
 /*
  * Debug output
  */
 #ifdef ACPI_DEBUG_OUTPUT
-
 ACPI_PRINTF_LIKE(6)
 void ACPI_INTERNAL_VAR_XFACE
 acpi_debug_print(u32 requested_debug_level,
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index fce521d..c38929b 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -62,6 +62,10 @@
 
 #define ACPI_NO_MEM_ALLOCATIONS
 
+/* Generating stubs for configurable ACPICA functions */
+
+#define ACPI_NO_ERROR_MESSAGES
+
 #endif
 
 #include <linux/string.h>
-- 
1.7.10.4


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

* [RFC PATCH 06/15] ACPICA: OSL: Add configurability to debug output functions.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (4 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 05/15] ACPICA: OSL: Add configurability to error message functions Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 07/15] ACPICA: OSL: Add configurability mechanism for external APIs Lv Zheng
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch extends ACPI_HW_DEPENDENT_x mechanism to all debugging output
related functions so that the OSPMs can have full control to configure
them into stub functions.
This patch also includes code for Linux to use this new mechanism for
the code that is built without CONFIG_ACPI enabled.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpixf.h           |   45 ++++++++++++++++++++++++---------------
 include/acpi/platform/aclinux.h |    1 +
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 6c8619d..08a1fdb 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -241,6 +241,18 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
 	static ACPI_INLINE prototype {return;}
 #endif				/* ACPI_NO_ERROR_MESSAGES */
 /*
+ * Debugging-output prototypes. All interfaces that use these macros will
+ * be configured out of the ACPICA build if the ACPI_DEBUG_OUTPUT flag is
+ * not defined.
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
+	prototype;
+#else
+#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
+	static ACPI_INLINE prototype {return;}
+#endif				/* ACPI_DEBUG_OUTPUT */
+/*
  * Initialization
  */
 acpi_status __init
@@ -713,22 +725,21 @@ ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
 /*
  * Debug output
  */
-#ifdef ACPI_DEBUG_OUTPUT
-ACPI_PRINTF_LIKE(6)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print(u32 requested_debug_level,
-		 u32 line_number,
-		 const char *function_name,
-		 const char *module_name,
-		 u32 component_id, const char *format, ...);
-
-ACPI_PRINTF_LIKE(6)
-void ACPI_INTERNAL_VAR_XFACE
-acpi_debug_print_raw(u32 requested_debug_level,
-		     u32 line_number,
-		     const char *function_name,
-		     const char *module_name,
-		     u32 component_id, const char *format, ...);
-#endif
+ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
+			       void ACPI_INTERNAL_VAR_XFACE
+			       acpi_debug_print(u32 requested_debug_level,
+						u32 line_number,
+						const char *function_name,
+						const char *module_name,
+						u32 component_id,
+						const char *format, ...))
 
+ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
+				void ACPI_INTERNAL_VAR_XFACE
+				acpi_debug_print_raw(u32 requested_debug_level,
+						     u32 line_number,
+						     const char *function_name,
+						     const char *module_name,
+						     u32 component_id,
+						     const char *format, ...))
 #endif				/* __ACXFACE_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index c38929b..45df524 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -65,6 +65,7 @@
 /* Generating stubs for configurable ACPICA functions */
 
 #define ACPI_NO_ERROR_MESSAGES
+#undef ACPI_DEBUG_OUTPUT
 
 #endif
 
-- 
1.7.10.4


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

* [RFC PATCH 07/15] ACPICA: OSL: Add configurability mechanism for external APIs.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (5 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 06/15] ACPICA: OSL: Add configurability to debug output functions Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 08/15] ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages " Lv Zheng
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

OSPMs like Linux trend to include all header files but leave empty inline
stub functions for a feature that is not configured during build.
This patch adds wrappers mechanism to be used around ACPICA external
interfaces to facilitate OSPM with such configurability.
This patch doesn't include code for Linux to use this mechanism.

Note that in order to the reduce the difficulties caused by the source code
differences between Linux and ACPICA upstream of maintaining large
ACPI_EXTERNAL_RETURN_x macro updates, actual ACPI_EXTERNAL_RETURN_x macro
usages are done and split into other commits.

ACPICA commits will be linuxized by the scripts. If there were divergences
in the middle of a diff block, the linuxized diff block should require
human intervention to be performed to make it possible to apply the
linuxized commit into Linux source tree.  Sometime such human intervention
will be very difficult as the linuxized commits will be messed up in
addition to the normal line offsettings by the patch/diff based utilities.
Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpixf.h           |   33 ++++++++++++++++++++++++++++++---
 include/acpi/platform/aclinux.h |   13 +++++++++++++
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 08a1fdb..ed6c53b 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -95,6 +95,33 @@ extern u32 acpi_rsdt_forced;
 
 #endif
 
+/* ACPICA prototypes */
+
+#ifndef ACPI_EXTERNAL_RETURN_STATUS
+#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
+	prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_OK
+#define ACPI_EXTERNAL_RETURN_OK(prototype) \
+	prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_VOID
+#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
+	prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_UINT32
+#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
+	prototype;
+#endif
+
+#ifndef ACPI_EXTERNAL_RETURN_PTR
+#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
+	prototype;
+#endif
+
 /* Public globals, available from outside ACPICA subsystem */
 
 /*****************************************************************************
@@ -215,11 +242,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
  */
 #if (!ACPI_REDUCED_HARDWARE)
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
-	prototype;
+	ACPI_EXTERNAL_RETURN_STATUS(prototype)
 #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
-	prototype;
+	ACPI_EXTERNAL_RETURN_OK(prototype)
 #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
-	prototype;
+	ACPI_EXTERNAL_RETURN_VOID(prototype)
 #else
 #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
 	static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 45df524..12ef8be 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -100,6 +100,19 @@
 #define ACPI_INIT_GLOBAL(t,a,b)
 #define ACPI_GLOBAL_FADT
 
+/* External interface for __KERNEL__, stub is needed */
+
+#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
+	static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
+#define ACPI_EXTERNAL_RETURN_OK(prototype) \
+	static ACPI_INLINE prototype {return(AE_OK);}
+#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
+	static ACPI_INLINE prototype {return;}
+#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
+	static ACPI_INLINE prototype {return(0);}
+#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
+	static ACPI_INLINE prototype {return(NULL);}
+
 /* Immediates to protect global variables accesses */
 
 #define acpi_current_gpe_count              0
-- 
1.7.10.4


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

* [RFC PATCH 08/15] ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages for external APIs.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (6 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 07/15] ACPICA: OSL: Add configurability mechanism for external APIs Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 09/15] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

OSPMs like Linux trend to include all header files but leave empty inline
stub variables for a feature that is not configured during build.

This patch configures ACPICA external APIs out and defines them into
function stubs when CONFIG_ACPI is not enabled.  Lv Zheng.

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

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index ed6c53b..8f32dfe 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -282,17 +282,19 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
 /*
  * Initialization
  */
-acpi_status __init
-acpi_initialize_tables(struct acpi_table_desc *initial_storage,
-		       u32 initial_table_count, u8 allow_resize);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
+			    acpi_initialize_tables(struct acpi_table_desc
+						   *initial_storage,
+						   u32 initial_table_count,
+						   u8 allow_resize))
 
-acpi_status __init acpi_initialize_subsystem(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void))
 
-acpi_status __init acpi_enable_subsystem(u32 flags);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags))
 
-acpi_status __init acpi_initialize_objects(u32 flags);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_objects(u32 flags))
 
-acpi_status __init acpi_terminate(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void))
 
 /*
  * Miscellaneous global interfaces
@@ -300,152 +302,198 @@ acpi_status __init acpi_terminate(void);
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
+
 #ifdef ACPI_FUTURE_USAGE
- acpi_status acpi_subsystem_status(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void))
 #endif
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_system_info(struct acpi_buffer
+						 *ret_buffer))
 #endif
 
-acpi_status acpi_get_statistics(struct acpi_statistics *stats);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_statistics(struct acpi_statistics *stats))
 
-const char *acpi_format_exception(acpi_status exception);
+ACPI_EXTERNAL_RETURN_PTR(const char
+			  *acpi_format_exception(acpi_status exception))
 
-acpi_status acpi_purge_cached_objects(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void))
 
-acpi_status acpi_install_interface(acpi_string interface_name);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_install_interface(acpi_string interface_name))
 
-acpi_status acpi_remove_interface(acpi_string interface_name);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_remove_interface(acpi_string interface_name))
 
-acpi_status acpi_update_interfaces(u8 action);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action))
 
-u32
-acpi_check_address_range(acpi_adr_space_type space_id,
-			 acpi_physical_address address,
-			 acpi_size length, u8 warn);
+ACPI_EXTERNAL_RETURN_UINT32(u32
+			    acpi_check_address_range(acpi_adr_space_type
+						     space_id,
+						     acpi_physical_address
+						     address, acpi_size length,
+						     u8 warn))
 
-acpi_status
-acpi_decode_pld_buffer(u8 *in_buffer,
-		       acpi_size length, struct acpi_pld_info **return_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_decode_pld_buffer(u8 *in_buffer,
+						    acpi_size length,
+						    struct acpi_pld_info
+						    **return_buffer))
 
 /*
  * ACPI table load/unload interfaces
  */
-acpi_status acpi_load_table(struct acpi_table_header *table);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_load_table(struct acpi_table_header *table))
 
-acpi_status acpi_unload_parent_table(acpi_handle object);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_unload_parent_table(acpi_handle object))
 
-acpi_status __init acpi_load_tables(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
 
 /*
  * ACPI table manipulation interfaces
  */
-acpi_status __init acpi_reallocate_root_table(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
 
-acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
+			    acpi_find_root_pointer(acpi_size * rsdp_address))
 
 acpi_status acpi_unload_table_id(acpi_owner_id id);
 
-acpi_status
-acpi_get_table_header(acpi_string signature,
-		      u32 instance, struct acpi_table_header *out_table_header);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_table_header(acpi_string signature,
+						  u32 instance,
+						  struct acpi_table_header
+						  *out_table_header))
 
 acpi_status
 acpi_get_table_with_size(acpi_string signature,
 	       u32 instance, struct acpi_table_header **out_table,
 	       acpi_size *tbl_size);
 
-acpi_status
-acpi_get_table(acpi_string signature,
-	       u32 instance, struct acpi_table_header **out_table);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_table(acpi_string signature, u32 instance,
+					    struct acpi_table_header
+					    **out_table))
 
-acpi_status
-acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_table_by_index(u32 table_index,
+						     struct acpi_table_header
+						     **out_table))
 
-acpi_status
-acpi_install_table_handler(acpi_table_handler handler, void *context);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_install_table_handler(acpi_table_handler
+							handler, void *context))
 
-acpi_status acpi_remove_table_handler(acpi_table_handler handler);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_remove_table_handler(acpi_table_handler
+						       handler))
 
 /*
  * Namespace and name interfaces
  */
-acpi_status
-acpi_walk_namespace(acpi_object_type type,
-		    acpi_handle start_object,
-		    u32 max_depth,
-		    acpi_walk_callback descending_callback,
-		    acpi_walk_callback ascending_callback,
-		    void *context, void **return_value);
-
-acpi_status
-acpi_get_devices(const char *HID,
-		 acpi_walk_callback user_function,
-		 void *context, void **return_value);
-
-acpi_status
-acpi_get_name(acpi_handle object,
-	      u32 name_type, struct acpi_buffer *ret_path_ptr);
-
-acpi_status
-acpi_get_handle(acpi_handle parent,
-		acpi_string pathname, acpi_handle * ret_handle);
-
-acpi_status
-acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
-
-acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
-
-acpi_status
-acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
-
-acpi_status
-acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_walk_namespace(acpi_object_type type,
+						acpi_handle start_object,
+						u32 max_depth,
+						acpi_walk_callback
+						descending_callback,
+						acpi_walk_callback
+						ascending_callback,
+						void *context,
+						void **return_value))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_devices(const char *HID,
+					      acpi_walk_callback user_function,
+					      void *context,
+					      void **return_value))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_name(acpi_handle object, u32 name_type,
+					   struct acpi_buffer *ret_path_ptr))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_handle(acpi_handle parent,
+					     acpi_string pathname,
+					     acpi_handle * ret_handle))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_attach_data(acpi_handle object,
+					      acpi_object_handler handler,
+					      void *data))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_detach_data(acpi_handle object,
+					      acpi_object_handler handler))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_data(acpi_handle object,
+					   acpi_object_handler handler,
+					   void **data))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_debug_trace(char *name, u32 debug_level,
+					      u32 debug_layer, u32 flags))
 
 /*
  * Object manipulation and enumeration
  */
-acpi_status
-acpi_evaluate_object(acpi_handle object,
-		     acpi_string pathname,
-		     struct acpi_object_list *parameter_objects,
-		     struct acpi_buffer *return_object_buffer);
-
-acpi_status
-acpi_evaluate_object_typed(acpi_handle object,
-			   acpi_string pathname,
-			   struct acpi_object_list *external_params,
-			   struct acpi_buffer *return_buffer,
-			   acpi_object_type return_type);
-
-acpi_status
-acpi_get_object_info(acpi_handle object,
-		     struct acpi_device_info **return_buffer);
-
-acpi_status acpi_install_method(u8 *buffer);
-
-acpi_status
-acpi_get_next_object(acpi_object_type type,
-		     acpi_handle parent,
-		     acpi_handle child, acpi_handle * out_handle);
-
-acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_evaluate_object(acpi_handle object,
+						 acpi_string pathname,
+						 struct acpi_object_list
+						 *parameter_objects,
+						 struct acpi_buffer
+						 *return_object_buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_evaluate_object_typed(acpi_handle object,
+							acpi_string pathname,
+							struct acpi_object_list
+							*external_params,
+							struct acpi_buffer
+							*return_buffer,
+							acpi_object_type
+							return_type))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_object_info(acpi_handle object,
+						  struct acpi_device_info
+						  **return_buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_next_object(acpi_object_type type,
+						 acpi_handle parent,
+						 acpi_handle child,
+						 acpi_handle * out_handle))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_type(acpi_handle object,
+					  acpi_object_type * out_type))
 
 acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
 
-acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_parent(acpi_handle object,
+					    acpi_handle * out_handle))
 
 /*
  * Handler interfaces
  */
-acpi_status
-acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_install_initialization_handler
+			    (acpi_init_handler handler, u32 function))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
-				acpi_install_sci_handler(acpi_sci_handler
-							 address,
-							 void *context))
+				 acpi_install_sci_handler(acpi_sci_handler
+							  address,
+							  void *context))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 				 acpi_remove_sci_handler(acpi_sci_handler
@@ -483,30 +531,48 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 							 u32 gpe_number,
 							 acpi_gpe_handler
 							 address))
-acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type,
-					acpi_notify_handler handler,
-					void *context);
-
-acpi_status
-acpi_remove_notify_handler(acpi_handle device,
-			   u32 handler_type, acpi_notify_handler handler);
 
-acpi_status
-acpi_install_address_space_handler(acpi_handle device,
-				   acpi_adr_space_type space_id,
-				   acpi_adr_space_handler handler,
-				   acpi_adr_space_setup setup, void *context);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_install_notify_handler(acpi_handle device,
+							 u32 handler_type,
+							 acpi_notify_handler
+							 handler,
+							 void *context))
 
-acpi_status
-acpi_remove_address_space_handler(acpi_handle device,
-				  acpi_adr_space_type space_id,
-				  acpi_adr_space_handler handler);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_remove_notify_handler(acpi_handle device,
+							u32 handler_type,
+							acpi_notify_handler
+							handler))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_install_address_space_handler(acpi_handle
+								device,
+								acpi_adr_space_type
+								space_id,
+								acpi_adr_space_handler
+								handler,
+								acpi_adr_space_setup
+								setup,
+								void *context))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_remove_address_space_handler(acpi_handle
+							       device,
+							       acpi_adr_space_type
+							       space_id,
+							       acpi_adr_space_handler
+							       handler))
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_install_exception_handler
+			     (acpi_exception_handler handler))
 #endif
 
-acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_install_interface_handler
+			     (acpi_interface_handler handler))
 
 /*
  * Global Lock interfaces
@@ -521,10 +587,14 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 /*
  * Interfaces to AML mutex objects
  */
-acpi_status
-acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_acquire_mutex(acpi_handle handle,
+					       acpi_string pathname,
+					       u16 timeout))
 
-acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_release_mutex(acpi_handle handle,
+					       acpi_string pathname))
 
 /*
  * Fixed Event interfaces
@@ -610,57 +680,78 @@ typedef
 acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
 					   void *context);
 
-acpi_status
-acpi_get_vendor_resource(acpi_handle device,
-			 char *name,
-			 struct acpi_vendor_uuid *uuid,
-			 struct acpi_buffer *ret_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_vendor_resource(acpi_handle device,
+						     char *name,
+						     struct acpi_vendor_uuid
+						     *uuid,
+						     struct acpi_buffer
+						     *ret_buffer))
 
-acpi_status
-acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_current_resources(acpi_handle device,
+							struct acpi_buffer
+							*ret_buffer))
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_possible_resources(acpi_handle device,
+							 struct acpi_buffer
+							 *ret_buffer))
 #endif
 
-acpi_status
-acpi_get_event_resources(acpi_handle device_handle,
-			 struct acpi_buffer *ret_buffer);
-
-acpi_status
-acpi_walk_resource_buffer(struct acpi_buffer *buffer,
-			  acpi_walk_resource_callback user_function,
-			  void *context);
-
-acpi_status
-acpi_walk_resources(acpi_handle device,
-		    char *name,
-		    acpi_walk_resource_callback user_function, void *context);
-
-acpi_status
-acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer);
-
-acpi_status
-acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer);
-
-acpi_status
-acpi_resource_to_address64(struct acpi_resource *resource,
-			   struct acpi_resource_address64 *out);
-
-acpi_status
-acpi_buffer_to_resource(u8 *aml_buffer,
-			u16 aml_buffer_length,
-			struct acpi_resource **resource_ptr);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_event_resources(acpi_handle device_handle,
+						      struct acpi_buffer
+						      *ret_buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_walk_resource_buffer(struct acpi_buffer
+						       *buffer,
+						       acpi_walk_resource_callback
+						       user_function,
+						       void *context))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_walk_resources(acpi_handle device, char *name,
+						 acpi_walk_resource_callback
+						 user_function, void *context))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_set_current_resources(acpi_handle device,
+							struct acpi_buffer
+							*in_buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_get_irq_routing_table(acpi_handle device,
+							struct acpi_buffer
+							*ret_buffer))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_resource_to_address64(struct acpi_resource
+							*resource,
+							struct
+							acpi_resource_address64
+							*out))
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			     acpi_buffer_to_resource(u8 *aml_buffer,
+						     u16 aml_buffer_length,
+						     struct acpi_resource
+						     **resource_ptr))
 
 /*
  * Hardware (ACPI device) interfaces
  */
-acpi_status acpi_reset(void);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void))
 
-acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_read(u64 *value,
+				      struct acpi_generic_address *reg))
 
-acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_write(u64 value,
+				       struct acpi_generic_address *reg))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 				acpi_read_bit_register(u32 register_id,
@@ -673,18 +764,22 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 /*
  * Sleep/Wake interfaces
  */
-acpi_status
-acpi_get_sleep_type_data(u8 sleep_state, u8 *slp_typ_a, u8 *slp_typ_b);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_sleep_type_data(u8 sleep_state,
+						     u8 *slp_typ_a,
+						     u8 *slp_typ_b))
 
-acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_enter_sleep_state_prep(u8 sleep_state))
 
-acpi_status acpi_enter_sleep_state(u8 sleep_state);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void))
 
-acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_leave_sleep_state_prep(u8 sleep_state))
 
-acpi_status acpi_leave_sleep_state(u8 sleep_state);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
 				acpi_set_firmware_waking_vector(u32
-- 
1.7.10.4


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

* [RFC PATCH 09/15] ACPICA: Linux: Add stub support for Linux specific variables and functions.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (7 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 08/15] ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages " Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 10/15] ACPICA: Linux: Add architecture specific ACPICA headers in Linux Lv Zheng
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are global variables and functions not upstreamed to the ACPICA code
base.  Such symbols still can referenced by external users as they are
listed in the acpixf.h.  This patch uses ACPI_GLOBAL and
ACPI_EXTERNAL_RETURN_STATUS mechanism to add stub support for such symbols.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 arch/ia64/kernel/acpi.c         |    1 -
 arch/x86/kernel/acpi/boot.c     |    1 -
 drivers/acpi/bus.c              |    3 ---
 include/acpi/acpixf.h           |   23 ++++++++++++++---------
 include/acpi/platform/aclinux.h |    3 +++
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 59d52e3..28dc6ba 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -61,7 +61,6 @@
 
 #define PREFIX			"ACPI: "
 
-u32 acpi_rsdt_forced;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6c0b43b..c83a974 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -46,7 +46,6 @@
 
 #include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
 static int __initdata acpi_force = 0;
-u32 acpi_rsdt_forced;
 int acpi_disabled;
 EXPORT_SYMBOL(acpi_disabled);
 
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2c38ae2..68d3e70 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -429,9 +429,6 @@ static int __init acpi_bus_init_irq(void)
 	return 0;
 }
 
-u8 acpi_gbl_permanent_mmap;
-
-
 void __init acpi_early_init(void)
 {
 	acpi_status status;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 8f32dfe..1e93ef6 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -53,9 +53,6 @@
 #include <acpi/actbl.h>
 #include <acpi/acbuffer.h>
 
-extern u8 acpi_gbl_permanent_mmap;
-extern u32 acpi_rsdt_forced;
-
 /*
  * Ensure that the globals are actually defined and initialized only once.
  *
@@ -235,6 +232,10 @@ ACPI_GLOBAL(u8, acpi_gbl_reduced_hardware)
 ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE)
  ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE)
 #endif
+
+ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap)
+ACPI_GLOBAL(u32, acpi_rsdt_forced)
+
 /*
  * Hardware-reduced prototypes. All interfaces that use these macros will
  * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
@@ -361,7 +362,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
 			    acpi_find_root_pointer(acpi_size * rsdp_address))
 
-acpi_status acpi_unload_table_id(acpi_owner_id id);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			    acpi_get_table_header(acpi_string signature,
@@ -369,10 +370,12 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 						  struct acpi_table_header
 						  *out_table_header))
 
-acpi_status
-acpi_get_table_with_size(acpi_string signature,
-	       u32 instance, struct acpi_table_header **out_table,
-	       acpi_size *tbl_size);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_table_with_size(acpi_string signature,
+						     u32 instance,
+						     struct acpi_table_header
+						     **out_table,
+						     acpi_size *tbl_size))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			     acpi_get_table(acpi_string signature, u32 instance,
@@ -477,7 +480,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			    acpi_get_type(acpi_handle object,
 					  acpi_object_type * out_type))
 
-acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_id(acpi_handle object,
+					acpi_owner_id * out_type))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 			    acpi_get_parent(acpi_handle object,
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 12ef8be..b1ddf5c 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -133,6 +133,9 @@
 #define acpi_dbg_level                      ACPI_DEBUG_DEFAULT
 #define acpi_dbg_layer                      ACPI_COMPONENT_DEFAULT
 
+#define acpi_gbl_permanent_mmap             FALSE
+#define acpi_rsdt_forced                    FALSE
+
 /* Helpers to protect acpi_gbl_FADT accesses */
 
 #define acpi_get_fadt_revision()    0
-- 
1.7.10.4


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

* [RFC PATCH 10/15] ACPICA: Linux: Add architecture specific ACPICA headers in Linux.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (8 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 09/15] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:06 ` [RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

Our target is allowing inclusion of <acpi/acpi.h> for CONFIG_ACPI=n build.

This patch tries to achieve this by splitting architecture specific ACPICA
implementation from <asm/acpi.h> into <asm/acenv.h> to improve
maintainability.  Then <asm/acpi.h> could be treated as the architecture
specific part of <linux/acpi.h>, <acpi/acpi_bus.h>,
<acpi/acpi_drivers.h>.

We need to delete <asm/acpi.h> from aclinux.h to achieve our CONFIG_ACPI=n
build target, but in order not to affect Linux build process, it requires
further cleanup on <linux/acpi.h>, <acpi/acpi_bus.h>,
<acpi/acpi_drivers.h> inclusions be done before doing this.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 arch/ia64/include/asm/acenv.h   |   71 +++++++++++++++++++++++++++++++++++++++
 arch/ia64/include/asm/acpi.h    |   50 ---------------------------
 arch/x86/include/asm/acenv.h    |   66 ++++++++++++++++++++++++++++++++++++
 arch/x86/include/asm/acpi.h     |   45 -------------------------
 include/acpi/platform/aclinux.h |    1 +
 5 files changed, 138 insertions(+), 95 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..eb13318
--- /dev/null
+++ b/arch/ia64/include/asm/acenv.h
@@ -0,0 +1,71 @@
+#ifndef _ASM_IA64_ACENV_H
+#define _ASM_IA64_ACENV_H
+
+#include <asm/intrinsics.h>
+
+/*
+ * IA64 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2013, 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.
+ */
+
+#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 faa1bf0..84a6f04 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..2359989
--- /dev/null
+++ b/arch/x86/include/asm/acenv.h
@@ -0,0 +1,66 @@
+#ifndef _ASM_X86_ACENV_H
+#define _ASM_X86_ACENV_H
+
+/*
+ * X86 specific ACPICA environments and implementation
+ *
+ * Copyright (C) 2013, 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.
+ */
+
+#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 b1ddf5c..e9e6374 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -80,6 +80,7 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
+#include <asm/acenv.h>
 #include <asm/acpi.h>
 
 #ifdef CONFIG_ACPI
-- 
1.7.10.4


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

* [RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (9 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 10/15] ACPICA: Linux: Add architecture specific ACPICA headers in Linux Lv Zheng
@ 2013-12-18  9:06 ` Lv Zheng
  2013-12-18  9:07 ` [RFC PATCH 12/15] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch adds default 64-bit mathematics in aclinux.h using do_div.  As
do_div can be used for all Linux architectures, this can also be used as
stub macros for ACPICA 64-bit mathematics.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 arch/ia64/include/asm/acenv.h   |    2 ++
 arch/x86/include/asm/acenv.h    |    4 ++++
 include/acpi/platform/aclinux.h |   29 +++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index eb13318..f142a9d 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -66,6 +66,8 @@ ia64_acpi_release_global_lock (unsigned int *lock)
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
 	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 #endif
 
 #endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 2359989..a85b478 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -45,6 +45,8 @@ int __acpi_release_global_lock(unsigned int *lock);
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
 	((Acq) = __acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 /*
  * Math helper asm macros
  */
@@ -61,6 +63,8 @@ int __acpi_release_global_lock(unsigned int *lock);
 	    : "=r"(n_hi), "=r"(n_lo)	\
 	    : "0"(n_hi), "1"(n_lo))
 
+#define ARCH_HAS_ACPI_MATH64_HELPER 1
+
 #endif
 
 #endif /* _ASM_X86_ACENV_H */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e9e6374..8176181 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -221,6 +221,35 @@
 #define acpi_spinlock                       spinlock_t *
 #define acpi_cpu_flags                      unsigned long
 
+#if ACPI_MACHINE_WIDTH == 64
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+/* Default to ACPI_USE_NATIVE_DIVIDE support */
+
+#define ARCH_HAS_ACPI_MATH64_HELPER
+
+#endif
+
+#endif
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	do { \
+		u64 __dividend = (((u64)(n_hi) << 32) | (n_lo)); \
+		(r32) = do_div(__dividend, (d32)); \
+		(q32) = (u32)__dividend; \
+	} while (0)
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	do { \
+		(n_lo) = ((n_lo) >> 1) | (((n_hi) & 1) << 31); \
+		(n_hi) >>= 1; \
+	} while (0)
+
+#endif
+
 #else				/* !__KERNEL__ */
 
 #include <stdarg.h>
-- 
1.7.10.4


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

* [RFC PATCH 12/15] ACPICA: Linux: Add configuration item to indicate the architecture specific support.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (10 preceding siblings ...)
  2013-12-18  9:06 ` [RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
@ 2013-12-18  9:07 ` Lv Zheng
  2013-12-18  9:07 ` [RFC PATCH 13/15] ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers Lv Zheng
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch adds a kernel configuration item to indicate the presense of
the architecture specific support for ACPICA, so that <asm/acenv.h>
inclusion can be configured out.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 arch/ia64/Kconfig               |    1 +
 arch/x86/Kconfig                |    1 +
 drivers/acpi/Kconfig            |    4 ++++
 include/acpi/platform/aclinux.h |    2 ++
 4 files changed, 8 insertions(+)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 4e4119b..c38cc47 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -43,6 +43,7 @@ config IA64
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	select ARCH_USE_CMPXCHG_LOCKREF
+	select ARCH_SUPPORTS_ACPICA
 	default y
 	help
 	  The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e903c71..0fd5a4d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -124,6 +124,7 @@ config X86
 	select RTC_LIB
 	select HAVE_DEBUG_STACKOVERFLOW
 	select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
+	select ARCH_SUPPORTS_ACPICA
 
 config INSTRUCTION_DECODER
 	def_bool y
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d92485..22e5762 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -2,8 +2,12 @@
 # ACPI Configuration
 #
 
+config ARCH_SUPPORTS_ACPICA
+	bool
+
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
+	depends on ARCH_SUPPORTS_ACPICA
 	depends on !IA64_HP_SIM
 	depends on IA64 || X86
 	depends on PCI
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 8176181..b754bfa 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -80,7 +80,9 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
+#ifdef CONFIG_ARCH_SUPPORTS_ACPICA
 #include <asm/acenv.h>
+#endif
 #include <asm/acpi.h>
 
 #ifdef CONFIG_ACPI
-- 
1.7.10.4


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

* [RFC PATCH 13/15] ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (11 preceding siblings ...)
  2013-12-18  9:07 ` [RFC PATCH 12/15] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
@ 2013-12-18  9:07 ` Lv Zheng
  2013-12-18  9:07 ` [RFC PATCH 14/15] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch removes <asm/acpi.h> inclusion from <acpi/platform/aclinux.h> as
it no longer contains useful prototypes for ACPICA.
This patch also introduces a top level header <linux/acpica.h> to be
included by other kernel source code.
Note that this patch changes the logic so that ACPICA header files
inclusions are no longer dependent on CONFIG_ACPI=y environment.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h |    1 -
 include/linux/acpi.h            |   13 ++++---------
 include/linux/acpica.h          |   22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)
 create mode 100644 include/linux/acpica.h

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index b754bfa..8bdb773 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -83,7 +83,6 @@
 #ifdef CONFIG_ARCH_SUPPORTS_ACPICA
 #include <asm/acenv.h>
 #endif
-#include <asm/acpi.h>
 
 #ifdef CONFIG_ACPI
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 72c88f4..a197f64 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -28,22 +28,17 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>	/* for struct resource */
 #include <linux/device.h>
-
-#ifdef	CONFIG_ACPI
-
-#ifndef _LINUX
-#define _LINUX
-#endif
-
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
+#include <linux/acpica.h>
+
+#ifdef	CONFIG_ACPI
 
-#include <acpi/acpi.h>
+#include <asm/acpi.h>	/* Definitions in it can be used by <acpi/x.h> headers */
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_numa.h>
 #include <acpi/acpi_io.h>
-#include <asm/acpi.h>
 
 static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
 {
diff --git a/include/linux/acpica.h b/include/linux/acpica.h
new file mode 100644
index 0000000..a67d3cf
--- /dev/null
+++ b/include/linux/acpica.h
@@ -0,0 +1,22 @@
+#ifndef _LINUX_ACPICA_H
+#define _LINUX_ACPICA_H
+
+/*
+ * Top level ACPICA header for Linux kernel
+ *
+ * Copyright (C) 2013, 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.
+ */
+
+/* Support <acpi/platform/aclinux.h> inclusions for broken compilers */
+#ifndef _LINUX
+#define _LINUX
+#endif
+
+#include <acpi/acpi.h>
+
+#endif /* _LINUX_ACPICA_H */
-- 
1.7.10.4


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

* [RFC PATCH 14/15] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (12 preceding siblings ...)
  2013-12-18  9:07 ` [RFC PATCH 13/15] ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers Lv Zheng
@ 2013-12-18  9:07 ` Lv Zheng
  2013-12-18  9:07 ` [RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support Lv Zheng
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Bjorn Helgaas,
	Len Brown, sfi-devel, linux-pci

This patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as
<linux/acpi.h> has already included it for CONFIG_ACPI=n builds.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Len Brown <lenb@kernel.org>
Cc: sfi-devel@simplefirmware.org
Cc: linux-pci@vger.kernel.org
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/sfi_acpi.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbf..a6e555c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
 #include <linux/sfi.h>
 
 #ifdef CONFIG_SFI
-#include <acpi/acpi.h>	/* FIXME: inclusion should be removed */
-
 extern int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
 	return sfi_acpi_table_parse(signature, NULL, NULL, handler);
 }
 #else /* !CONFIG_SFI */
-
 static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *))
-- 
1.7.10.4


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

* [RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (13 preceding siblings ...)
  2013-12-18  9:07 ` [RFC PATCH 14/15] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
@ 2013-12-18  9:07 ` Lv Zheng
  2013-12-18 11:41   ` [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users Henrique de Moraes Holschuh
  2013-12-20  8:30 ` [UPDATE RFC " Lv Zheng
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2013-12-18  9:07 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This file can be used to detect ACPICA configurability/build issues in
CONFIG_ACPI=n environment.
This patch is only used for unit test purpose, do not merge it into
public linux kernel source trees.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 init/Makefile |    2 +-
 init/acpica.c |  318 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 319 insertions(+), 1 deletion(-)
 create mode 100644 init/acpica.c

diff --git a/init/Makefile b/init/Makefile
index 7bc47ee..0f655de 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y                          := main.o version.o mounts.o
+obj-y                          := main.o version.o mounts.o acpica.o
 ifneq ($(CONFIG_BLK_DEV_INITRD),y)
 obj-y                          += noinitramfs.o
 else
diff --git a/init/acpica.c b/init/acpica.c
new file mode 100644
index 0000000..ae9fc61
--- /dev/null
+++ b/init/acpica.c
@@ -0,0 +1,318 @@
+/*
+ * ACPICA build testing for CONFIG_ACPI=n
+ *
+ * Copyright (C) 2013, 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.
+ */
+
+#include <linux/init.h>
+#include <linux/acpica.h>
+
+#define FUNC_CONST_PTR_1(ptr, func, v1)				\
+	do {							\
+		ptr = func(v1);					\
+		printk("%s result is %p.\n", #func, ptr);	\
+	} while (0)
+#define FUNC_0(status, func)					\
+	do {							\
+		status = func();				\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_1(status, func, v1)				\
+	do {							\
+		status = func(v1);				\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_2(status, func, v1, v2)				\
+	do {							\
+		status = func(v1, v2);				\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_3(status, func, v1, v2, v3)			\
+	do {							\
+		status = func(v1, v2, v3);			\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_4(status, func, v1, v2, v3, v4)			\
+	do {							\
+		status = func(v1, v2, v3, v4);			\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_5(status, func, v1, v2, v3, v4, v5)		\
+	do {							\
+		status = func(v1, v2, v3, v4, v5);		\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_6(status, func, v1, v2, v3, v4, v5, v6)		\
+	do {							\
+		status = func(v1, v2, v3, v4, v5, v6);		\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+#define FUNC_7(status, func, v1, v2, v3, v4, v5, v6, v7)	\
+	do {							\
+		status = func(v1, v2, v3, v4, v5, v6, v7);	\
+		printk("%s result is %d.\n", #func, status);	\
+	} while (0)
+
+#define FUNC_VOID_3(func, v1, v2, v3)				\
+	do {							\
+		func(v1, v2, v3);				\
+	} while (0)
+#define FUNC_VOID_4(func, v1, v2, v3, v4)			\
+	do {							\
+		func(v1, v2, v3, v4);				\
+	} while (0)
+#define FUNC_VOID_6(func, v1, v2, v3, v4, v5, v6)		\
+	do {							\
+		func(v1, v2, v3, v4, v5, v6);			\
+	} while (0)
+
+#define ACCESS_GLOBAL(gbl, val)					\
+	do {							\
+		if ((gbl) == (val)) {				\
+			printk("%s global equals.\n", #gbl);	\
+		} else {					\
+			printk("%s global not equals.\n", #gbl);\
+		}						\
+	} while (0)
+#define ACCESS_FADT_FLAG(flg)					\
+	do {							\
+		if (acpi_test_fadt_flags(flg)) {		\
+			printk("%s flag set\n", #flg);		\
+		} else {					\
+			printk("%s flag cleared.\n", #flg);	\
+		}						\
+	} while (0)
+
+#define ACPI_SNAME(str)						\
+	((u16)((u16)((str)[0]) | ((u16)((str)[1]) << 8)))
+
+#define ACPI_LNAME(str)						\
+	((u32)((u32)ACPI_SNAME(str) | ((u32)ACPI_SNAME((str)+2) << 16)))
+
+#define ACPI_LLNAME(str)					\
+	((u64)((u64)ACPI_LNAME(str) | ((u64)ACPI_LNAME((str)+4) << 32)))
+
+static void test_macros(void)
+{
+	void *mem;
+	u64 a_u64 = ACPI_LLNAME("ABCDEFGH");
+	u32 a_u32 = ACPI_LNAME("ABCD");
+	u16 a_u16 = ACPI_SNAME("AB");
+	u8 a_u8 = 'A';
+
+	mem = ACPI_ALLOCATE(sizeof(u64));
+	ACPI_FREE(mem);
+	mem = ACPI_ALLOCATE_ZEROED(sizeof(u64));
+	ACPI_FREE(mem);
+
+	a_u32 = ACPI_LODWORD(a_u64) + ACPI_HIDWORD(a_u64);
+	a_u32 = ACPI_LODWORD(a_u32) + ACPI_HIDWORD(a_u32);
+	a_u32 = ACPI_LODWORD(a_u16) + ACPI_HIDWORD(a_u16);
+	a_u32 = ACPI_LODWORD(a_u8)  + ACPI_HIDWORD(a_u8);
+
+	a_u16 = ACPI_LOWORD(a_u64) + ACPI_HIWORD(a_u64);
+	a_u16 = ACPI_LOWORD(a_u32) + ACPI_HIWORD(a_u32);
+	a_u16 = ACPI_LOWORD(a_u16) + ACPI_HIWORD(a_u16);
+	a_u16 = ACPI_LOWORD(a_u8)  + ACPI_HIWORD(a_u8);
+
+	a_u8 = ACPI_LOBYTE(a_u64) + ACPI_HIBYTE(a_u64);
+	a_u8 = ACPI_LOBYTE(a_u32) + ACPI_HIBYTE(a_u32);
+	a_u8 = ACPI_LOBYTE(a_u16) + ACPI_HIBYTE(a_u16);
+	a_u8 = ACPI_LOBYTE(a_u8)  + ACPI_HIBYTE(a_u8);
+
+	ACPI_SET_BIT(a_u64, 1);
+	ACPI_SET_BIT(a_u32, 1);
+	ACPI_SET_BIT(a_u16, 1);
+	ACPI_SET_BIT(a_u8,  1);
+	ACPI_CLEAR_BIT(a_u64, 1);
+	ACPI_CLEAR_BIT(a_u32, 1);
+	ACPI_CLEAR_BIT(a_u16, 1);
+	ACPI_CLEAR_BIT(a_u8,  1);
+}
+
+static void test_globals(void)
+{
+	ACCESS_GLOBAL(acpi_current_gpe_count, 0);
+	ACCESS_GLOBAL(acpi_gbl_trace_flags, 0);
+	ACCESS_GLOBAL(acpi_gbl_trace_method_name, 0);
+	ACCESS_GLOBAL(acpi_gbl_system_awake_and_running, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_reduced_hardware, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_create_osi_method, TRUE);
+	ACCESS_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
+	ACCESS_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_osi_data, 0);
+	ACCESS_GLOBAL(acpi_dbg_level, ACPI_DEBUG_DEFAULT);
+	ACCESS_GLOBAL(acpi_dbg_layer, ACPI_COMPONENT_DEFAULT);
+#ifdef ACPI_DISASSEMBLER
+	ACCESS_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
+	ACCESS_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE);
+#endif
+	ACCESS_GLOBAL(acpi_gbl_permanent_mmap, FALSE);
+	ACCESS_GLOBAL(acpi_rsdt_forced, FALSE);
+
+	printk("FADT revision is %d.\n", acpi_get_fadt_revision());
+
+	ACCESS_FADT_FLAG(ACPI_FADT_WBINVD);
+}
+
+static void test_functions(void)
+{
+	acpi_status status;
+	const void *pointer;
+
+	FUNC_0(status, acpi_enable);
+	FUNC_0(status, acpi_disable);
+#ifdef ACPI_FUTURE_USAGE
+	FUNC_0(status, acpi_subsystem_status);
+	FUNC_1(status, acpi_get_system_info, NULL);
+#endif
+	FUNC_1(status, acpi_get_statistics, NULL);
+	FUNC_CONST_PTR_1(pointer, acpi_format_exception, 0);
+	FUNC_0(status, acpi_purge_cached_objects);
+	FUNC_1(status, acpi_install_interface, NULL);
+	FUNC_1(status, acpi_remove_interface, NULL);
+	FUNC_1(status, acpi_update_interfaces, 0);
+	FUNC_4(status, acpi_check_address_range, 0, 0, 0, false);
+	FUNC_3(status, acpi_decode_pld_buffer, NULL, 0, NULL);
+	FUNC_1(status, acpi_load_table, NULL);
+	FUNC_1(status, acpi_unload_parent_table, NULL);
+	FUNC_1(status, acpi_unload_table_id, 0);
+	FUNC_3(status, acpi_get_table_header, NULL, 0, NULL);
+	FUNC_4(status, acpi_get_table_with_size, NULL, 0, NULL, NULL);
+	FUNC_3(status, acpi_get_table, NULL, 0, NULL);
+	FUNC_2(status, acpi_get_table_by_index, 0, NULL);
+	FUNC_2(status, acpi_install_table_handler, NULL, NULL);
+	FUNC_1(status, acpi_remove_table_handler, NULL);
+	FUNC_7(status, acpi_walk_namespace, 0, NULL, 0, NULL, NULL, NULL, NULL);
+	FUNC_4(status, acpi_get_devices, NULL, NULL, NULL, NULL);
+	FUNC_3(status, acpi_get_name, NULL, 0, NULL);
+	FUNC_3(status, acpi_get_handle, NULL, NULL, NULL);
+	FUNC_3(status, acpi_attach_data, NULL, NULL, NULL);
+	FUNC_2(status, acpi_detach_data, NULL, NULL);
+	FUNC_3(status, acpi_get_data, NULL, NULL, NULL);
+	FUNC_4(status, acpi_debug_trace, NULL, 0, 0, 0);
+	FUNC_4(status, acpi_evaluate_object, NULL, NULL, NULL, NULL);
+	FUNC_5(status, acpi_evaluate_object_typed, NULL, NULL, NULL, NULL, 0);
+	FUNC_2(status, acpi_get_object_info, NULL, NULL);
+	FUNC_1(status, acpi_install_method, NULL);
+	FUNC_4(status, acpi_get_next_object, 0, NULL, NULL, NULL);
+	FUNC_2(status, acpi_get_type, NULL, NULL);
+	FUNC_2(status, acpi_get_id, NULL, NULL);
+	FUNC_2(status, acpi_get_parent, NULL, NULL);
+	FUNC_2(status, acpi_install_initialization_handler, NULL, 0);
+	FUNC_2(status, acpi_install_sci_handler, NULL, NULL);
+	FUNC_1(status, acpi_remove_sci_handler, NULL);
+	FUNC_2(status, acpi_install_global_event_handler, NULL, NULL);
+	FUNC_3(status, acpi_install_fixed_event_handler, 0, NULL, NULL);
+	FUNC_2(status, acpi_remove_fixed_event_handler, 0, NULL);
+	FUNC_5(status, acpi_install_gpe_handler, NULL, 0, 0, NULL, NULL);
+	FUNC_3(status, acpi_remove_gpe_handler, NULL, 0, NULL);
+	FUNC_4(status, acpi_install_notify_handler, NULL, 0, NULL, NULL);
+	FUNC_3(status, acpi_remove_notify_handler, NULL, 0, NULL);
+	FUNC_5(status, acpi_install_address_space_handler, NULL, 0, NULL, NULL, NULL);
+	FUNC_3(status, acpi_remove_address_space_handler, NULL, 0, NULL);
+#ifdef ACPI_FUTURE_USAGE
+	FUNC_1(status, acpi_install_exception_handler, NULL);
+#endif
+	FUNC_1(status, acpi_install_interface_handler, NULL);
+	FUNC_2(status, acpi_acquire_global_lock, 0, NULL);
+	FUNC_1(status, acpi_release_global_lock, 0);
+	FUNC_3(status, acpi_acquire_mutex, NULL, NULL, 0);
+	FUNC_2(status, acpi_release_mutex, NULL, NULL);
+	FUNC_2(status, acpi_enable_event, 0, 0);
+	FUNC_2(status, acpi_disable_event, 0, 0);
+	FUNC_1(status, acpi_clear_event, 0);
+	FUNC_2(status, acpi_get_event_status, 0, NULL);
+	FUNC_0(status, acpi_update_all_gpes);
+	FUNC_2(status, acpi_enable_gpe, NULL, 0);
+	FUNC_2(status, acpi_disable_gpe, NULL, 0);
+	FUNC_2(status, acpi_clear_gpe, NULL, 0);
+	FUNC_3(status, acpi_set_gpe, NULL, 0, 0);
+	FUNC_2(status, acpi_finish_gpe, NULL, 0);
+	FUNC_3(status, acpi_setup_gpe_for_wake, NULL, NULL, 0);
+	FUNC_3(status, acpi_set_gpe_wake_mask, NULL, 0, 0);
+	FUNC_3(status, acpi_get_gpe_status, NULL, 0, NULL);
+	FUNC_0(status, acpi_disable_all_gpes);
+	FUNC_0(status, acpi_enable_all_runtime_gpes);
+	FUNC_2(status, acpi_get_gpe_device, 0, NULL);
+	FUNC_4(status, acpi_install_gpe_block, NULL, NULL, 0, 0);
+	FUNC_1(status, acpi_remove_gpe_block, NULL);
+	FUNC_4(status, acpi_get_vendor_resource, NULL, NULL, NULL, NULL);
+	FUNC_2(status, acpi_get_current_resources, NULL, NULL);
+#ifdef ACPI_FUTURE_USAGE
+	FUNC_2(status, acpi_get_possible_resources, NULL, NULL);
+#endif
+	FUNC_2(status, acpi_get_event_resources, NULL, NULL);
+	FUNC_3(status, acpi_walk_resource_buffer, NULL, NULL, NULL);
+	FUNC_4(status, acpi_walk_resources, NULL, NULL, NULL, NULL);
+	FUNC_2(status, acpi_set_current_resources, NULL, NULL);
+	FUNC_2(status, acpi_get_irq_routing_table, NULL, NULL);
+	FUNC_2(status, acpi_resource_to_address64, NULL, NULL);
+	FUNC_3(status, acpi_buffer_to_resource, NULL, 0, NULL);
+	FUNC_0(status, acpi_reset);
+	FUNC_2(status, acpi_read, NULL, NULL);
+	FUNC_2(status, acpi_write, 0, NULL);
+	FUNC_2(status, acpi_read_bit_register, 0, NULL);
+	FUNC_2(status, acpi_write_bit_register, 0, 0);
+	FUNC_3(status, acpi_get_sleep_type_data, 0, NULL, NULL);
+	FUNC_1(status, acpi_enter_sleep_state_prep, 0);
+	FUNC_1(status, acpi_enter_sleep_state, 0);
+	FUNC_0(status, acpi_enter_sleep_state_s4bios);
+	FUNC_1(status, acpi_leave_sleep_state_prep, 0);
+	FUNC_1(status, acpi_leave_sleep_state, 0);
+	FUNC_1(status, acpi_set_firmware_waking_vector, 0);
+#if ACPI_MACHINE_WIDTH == 64
+	FUNC_1(status, acpi_set_firmware_waking_vector64, 0);
+#endif
+#ifdef ACPI_FUTURE_USAGE
+	FUNC_1(status, acpi_get_timer_resolution, NULL);
+	FUNC_1(status, acpi_get_timer, NULL);
+	FUNC_3(status, acpi_get_timer_duration, 0, 0, NULL);
+#endif
+
+	FUNC_VOID_3(acpi_error, NULL, 0, NULL);
+	FUNC_VOID_4(acpi_exception, NULL, 0, 0, NULL);
+	FUNC_VOID_3(acpi_warning, NULL, 0, NULL);
+	FUNC_VOID_3(acpi_info, NULL, 0, NULL);
+	FUNC_VOID_3(acpi_bios_error, NULL, 0, NULL);
+	FUNC_VOID_3(acpi_bios_warning, NULL, 0, NULL);
+	FUNC_VOID_6(acpi_debug_print, 0, 0, NULL, NULL, 0, NULL);
+	FUNC_VOID_6(acpi_debug_print_raw, 0, 0, NULL, NULL, 0, NULL);
+}
+
+static void __init test_init_functions(void)
+{
+	acpi_status status;
+
+	FUNC_3(status, acpi_initialize_tables, NULL, 0, false);
+	FUNC_0(status, acpi_initialize_subsystem);
+	FUNC_1(status, acpi_enable_subsystem, 0);
+	FUNC_1(status, acpi_initialize_objects, 0);
+	FUNC_0(status, acpi_terminate);
+	FUNC_0(status, acpi_load_tables);
+	FUNC_0(status, acpi_reallocate_root_table);
+	FUNC_1(status, acpi_find_root_pointer, NULL);
+}
+
+static int __init acpica_test_init(void)
+{
+	test_init_functions();
+	test_functions();
+	test_globals();
+	test_macros();
+
+	return 0;
+}
+
+fs_initcall(acpica_test_init);
-- 
1.7.10


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

* Re: [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-18  9:07 ` [RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support Lv Zheng
@ 2013-12-18 11:41   ` Henrique de Moraes Holschuh
  2013-12-18 13:06     ` [alsa-devel] " Takashi Iwai
  0 siblings, 1 reply; 50+ messages in thread
From: Henrique de Moraes Holschuh @ 2013-12-18 11:41 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Henrique de Moraes Holschuh, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, ibm-acpi-devel, platform-driver-x86

On Wed, 18 Dec 2013, Lv Zheng wrote:
> CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
> directly including <acpi/acpi.h>.  This patch cleans up such wrong
> inclusions for Thinkpad ACPI users.

...

>  drivers/platform/x86/thinkpad_acpi.c |    1 -
>  include/linux/thinkpad_acpi.h        |    2 ++
>  sound/pci/hda/patch_conexant.c       |    1 -
>  sound/pci/hda/patch_realtek.c        |    1 -

I'd prefer if you left the include outside of thinkpad_acpi.h, and just fix
the include in the two ALSA users.

We might add some extra stuff to thinkpad_acpi.h someday, and not everything
thinkpad_acpi does that might be useful to export to other areas of the
kernel would require acpi.h.

Looking at patch_conexant and patch_realtek, it might be better to actually
move the "am I running on a thinkpad" stuff they use acpi.h for into
thinkpad_acpi, and provide a prototype for that in thinkpad_acpi.h.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-18 11:41   ` [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users Henrique de Moraes Holschuh
@ 2013-12-18 13:06     ` Takashi Iwai
  2013-12-20  0:28       ` Zheng, Lv
  0 siblings, 1 reply; 50+ messages in thread
From: Takashi Iwai @ 2013-12-18 13:06 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Lv Zheng, Len Brown, alsa-devel, ibm-acpi-devel,
	Rafael J. Wysocki, Henrique de Moraes Holschuh, linux-kernel,
	Lv Zheng, linux-acpi, platform-driver-x86

At Wed, 18 Dec 2013 09:41:17 -0200,
Henrique de Moraes Holschuh wrote:
> 
> On Wed, 18 Dec 2013, Lv Zheng wrote:
> > CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
> > directly including <acpi/acpi.h>.  This patch cleans up such wrong
> > inclusions for Thinkpad ACPI users.
> 
> ...
> 
> >  drivers/platform/x86/thinkpad_acpi.c |    1 -
> >  include/linux/thinkpad_acpi.h        |    2 ++
> >  sound/pci/hda/patch_conexant.c       |    1 -
> >  sound/pci/hda/patch_realtek.c        |    1 -
> 
> I'd prefer if you left the include outside of thinkpad_acpi.h, and just fix
> the include in the two ALSA users.

Agreed.

> We might add some extra stuff to thinkpad_acpi.h someday, and not everything
> thinkpad_acpi does that might be useful to export to other areas of the
> kernel would require acpi.h.
> 
> Looking at patch_conexant and patch_realtek, it might be better to actually
> move the "am I running on a thinkpad" stuff they use acpi.h for into
> thinkpad_acpi, and provide a prototype for that in thinkpad_acpi.h.

True, but we don't want to bind with thinkpad_acpi before identified
that it's a thinkpad, so the code needs to be in hd-audio codec
driver.


thanks,

Takashi

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

* RE: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-18 13:06     ` [alsa-devel] " Takashi Iwai
@ 2013-12-20  0:28       ` Zheng, Lv
  2013-12-20  6:52         ` Takashi Iwai
  0 siblings, 1 reply; 50+ messages in thread
From: Zheng, Lv @ 2013-12-20  0:28 UTC (permalink / raw)
  To: Takashi Iwai, Henrique de Moraes Holschuh
  Cc: Brown, Len, alsa-devel, ibm-acpi-devel, Wysocki, Rafael J,
	Henrique de Moraes Holschuh, linux-kernel, Lv Zheng, linux-acpi,
	platform-driver-x86

Hi, Takashi and Henrique

Thanks for reviewing and commenting.

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Takashi Iwai
> Sent: Wednesday, December 18, 2013 9:06 PM
> 
> At Wed, 18 Dec 2013 09:41:17 -0200,
> Henrique de Moraes Holschuh wrote:
> >
> > On Wed, 18 Dec 2013, Lv Zheng wrote:
> > > CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
> > > directly including <acpi/acpi.h>.  This patch cleans up such wrong
> > > inclusions for Thinkpad ACPI users.
> >
> > ...
> >
> > >  drivers/platform/x86/thinkpad_acpi.c |    1 -
> > >  include/linux/thinkpad_acpi.h        |    2 ++
> > >  sound/pci/hda/patch_conexant.c       |    1 -
> > >  sound/pci/hda/patch_realtek.c        |    1 -
> >
> > I'd prefer if you left the include outside of thinkpad_acpi.h, and just fix
> > the include in the two ALSA users.
> 
> Agreed.
> 
> > We might add some extra stuff to thinkpad_acpi.h someday, and not everything
> > thinkpad_acpi does that might be useful to export to other areas of the
> > kernel would require acpi.h.
> >
> > Looking at patch_conexant and patch_realtek, it might be better to actually
> > move the "am I running on a thinkpad" stuff they use acpi.h for into
> > thinkpad_acpi, and provide a prototype for that in thinkpad_acpi.h.
> 
> True, but we don't want to bind with thinkpad_acpi before identified
> that it's a thinkpad, so the code needs to be in hd-audio codec
> driver.
> 

It looks to me like that there is a relationship between two Henrique's suggestions.
His opinion is all ACPI stuff should be bound into thinkpad_acpi.c, that's why he suggested not to include <linux/acpi.h> in <linux/thinkpad_acpi.h>.
So we might address both of them in order to follow.

I'm not sure if your opinion is: the hd-audio codec driver's needs cannot be met by addressing the second comment.
And I'm not the right person that is able to test such code restructuring work.
The target of this patchset is cleaning up wrong <acpi/acpi.h> inclusions, so let me focus on the first comment.

Can I just update this patch with <acpi/acpi.h> inclusions replaced by <linux/acpi.h> inclusions?

Thanks and best regards
-Lv

> 
> thanks,
> 
> Takashi
> --
> 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] 50+ messages in thread

* Re: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-20  0:28       ` Zheng, Lv
@ 2013-12-20  6:52         ` Takashi Iwai
  0 siblings, 0 replies; 50+ messages in thread
From: Takashi Iwai @ 2013-12-20  6:52 UTC (permalink / raw)
  To: Zheng, Lv
  Cc: Henrique de Moraes Holschuh, Brown, Len, alsa-devel,
	ibm-acpi-devel, Wysocki, Rafael J, Henrique de Moraes Holschuh,
	linux-kernel, Lv Zheng, linux-acpi, platform-driver-x86

At Fri, 20 Dec 2013 00:28:02 +0000,
Zheng, Lv wrote:
> 
> Hi, Takashi and Henrique
> 
> Thanks for reviewing and commenting.
> 
> > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Takashi Iwai
> > Sent: Wednesday, December 18, 2013 9:06 PM
> > 
> > At Wed, 18 Dec 2013 09:41:17 -0200,
> > Henrique de Moraes Holschuh wrote:
> > >
> > > On Wed, 18 Dec 2013, Lv Zheng wrote:
> > > > CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
> > > > directly including <acpi/acpi.h>.  This patch cleans up such wrong
> > > > inclusions for Thinkpad ACPI users.
> > >
> > > ...
> > >
> > > >  drivers/platform/x86/thinkpad_acpi.c |    1 -
> > > >  include/linux/thinkpad_acpi.h        |    2 ++
> > > >  sound/pci/hda/patch_conexant.c       |    1 -
> > > >  sound/pci/hda/patch_realtek.c        |    1 -
> > >
> > > I'd prefer if you left the include outside of thinkpad_acpi.h, and just fix
> > > the include in the two ALSA users.
> > 
> > Agreed.
> > 
> > > We might add some extra stuff to thinkpad_acpi.h someday, and not everything
> > > thinkpad_acpi does that might be useful to export to other areas of the
> > > kernel would require acpi.h.
> > >
> > > Looking at patch_conexant and patch_realtek, it might be better to actually
> > > move the "am I running on a thinkpad" stuff they use acpi.h for into
> > > thinkpad_acpi, and provide a prototype for that in thinkpad_acpi.h.
> > 
> > True, but we don't want to bind with thinkpad_acpi before identified
> > that it's a thinkpad, so the code needs to be in hd-audio codec
> > driver.
> > 
> 
> It looks to me like that there is a relationship between two Henrique's suggestions.
> His opinion is all ACPI stuff should be bound into thinkpad_acpi.c, that's why he suggested not to include <linux/acpi.h> in <linux/thinkpad_acpi.h>.
> So we might address both of them in order to follow.
> 
> I'm not sure if your opinion is: the hd-audio codec driver's needs cannot be met by addressing the second comment.

My position is that some acpi code is needed in hd-audio codec driver
because we need to probe thinkpad before binding with thinkpad_acpi.
The codec driver is used by all machines with the same codec chips,
and only few are thinkpads, so it's better not to bind statically for
the rest others.

> And I'm not the right person that is able to test such code restructuring work.
> The target of this patchset is cleaning up wrong <acpi/acpi.h> inclusions, so let me focus on the first comment.
> 
> Can I just update this patch with <acpi/acpi.h> inclusions replaced by <linux/acpi.h> inclusions?

Yes, that suffices.


Takashi

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

* [UPDATE RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (14 preceding siblings ...)
  2013-12-18  9:07 ` [RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support Lv Zheng
@ 2013-12-20  8:30 ` Lv Zheng
  2013-12-20  9:15   ` Takashi Iwai
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  17 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2013-12-20  8:30 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi,
	Henrique de Moraes Holschuh, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, ibm-acpi-devel, platform-driver-x86

CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
directly including <acpi/acpi.h>.  This patch cleans up such wrong
inclusions for Thinkpad ACPI users.

Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Cc: ibm-acpi-devel@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 sound/pci/hda/patch_conexant.c |    2 +-
 sound/pci/hda/patch_realtek.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 3fbf288..6df4c35 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3243,7 +3243,7 @@ enum {
 #if IS_ENABLED(CONFIG_THINKPAD_ACPI)
 
 #include <linux/thinkpad_acpi.h>
-#include <acpi/acpi.h>
+#include <linux/acpi.h>
 
 static int (*led_set_func)(int, bool);
 
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 34de5dc..5dca90e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3726,7 +3726,7 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec,
 #if IS_ENABLED(CONFIG_THINKPAD_ACPI)
 
 #include <linux/thinkpad_acpi.h>
-#include <acpi/acpi.h>
+#include <linux/acpi.h>
 
 static int (*led_set_func)(int, bool);
 
-- 
1.7.10


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

* Re: [UPDATE RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
  2013-12-20  8:30 ` [UPDATE RFC " Lv Zheng
@ 2013-12-20  9:15   ` Takashi Iwai
  0 siblings, 0 replies; 50+ messages in thread
From: Takashi Iwai @ 2013-12-20  9:15 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Henrique de Moraes Holschuh, Jaroslav Kysela, alsa-devel,
	ibm-acpi-devel, platform-driver-x86

At Fri, 20 Dec 2013 16:30:42 +0800,
Lv Zheng wrote:
> 
> CONFIG_ACPI dependent code should include <linux/acpi.h> instead of
> directly including <acpi/acpi.h>.  This patch cleans up such wrong
> inclusions for Thinkpad ACPI users.
> 
> Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: alsa-devel@alsa-project.org
> Cc: ibm-acpi-devel@lists.sourceforge.net
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>

Applied to sound git tree (with a different subject suffix), thanks.


Takashi

> ---
>  sound/pci/hda/patch_conexant.c |    2 +-
>  sound/pci/hda/patch_realtek.c  |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
> index 3fbf288..6df4c35 100644
> --- a/sound/pci/hda/patch_conexant.c
> +++ b/sound/pci/hda/patch_conexant.c
> @@ -3243,7 +3243,7 @@ enum {
>  #if IS_ENABLED(CONFIG_THINKPAD_ACPI)
>  
>  #include <linux/thinkpad_acpi.h>
> -#include <acpi/acpi.h>
> +#include <linux/acpi.h>
>  
>  static int (*led_set_func)(int, bool);
>  
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 34de5dc..5dca90e 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -3726,7 +3726,7 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec,
>  #if IS_ENABLED(CONFIG_THINKPAD_ACPI)
>  
>  #include <linux/thinkpad_acpi.h>
> -#include <acpi/acpi.h>
> +#include <linux/acpi.h>
>  
>  static int (*led_set_func)(int, bool);
>  
> -- 
> 1.7.10
> 

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

* [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (15 preceding siblings ...)
  2013-12-20  8:30 ` [UPDATE RFC " Lv Zheng
@ 2014-07-07  4:16 ` Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
                     ` (6 more replies)
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  17 siblings, 7 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:16 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, x86, linux-ia64,
	sfi-devel, alsa-devel

This is the last series for ACPICA header inclusion cleanups.
The whole story can be found below:
  1. Unsafe inclusions:
     origin: https://lkml.org/lkml/2013/11/22/510
     merged: https://lkml.org/lkml/2013/12/6/79
  2. Header orders:
     origin: https://lkml.org/lkml/2014/4/8/57
     merged: https://lkml.org/lkml/2014/5/12/111
  3. Header stubs:
     origin: https://lkml.org/lkml/2014/12/18/149
     merged: https://lkml.org/lkml/2014/4/29/716

This patchset contains patches that are parts of the last series sent
before, so it is marked as v2 belonging to the same thread as this series:
  https://lkml.org/lkml/2014/12/18/149

Now we have cleaned up all mis-ordered ACPICA headers and implemented stubs
for ACPICA prototypes (functions, global variables, macros), we finally can
enable ACPICA headers for CONFIG_ACPI=n builds so that all ACPICA defined
types are visible to all kernel source files.

After exposing ACPICA types to all kernel sources, we can also sort the
final wrong <acpi/acpi.h> inclusion out of <linux/sfi_acpi.h>.

This patchset also includes a rule enforcement patch to avoid future
inclusion mistakes.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
  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
They are tested twice with CONFIG_ACPI enabled/disabled.

Also allyes/allno/allmod tests are done for ARCH=i386 and ARCH=x86_64.

A boot test has been done to ARCH=x86_64 default configuration and it is
confirmed that the ACPI devices are successfully created under
/sys/bus/acpi/devices when CONFIG_ACPI is enabled.

Lv Zheng (7):
  ACPICA: Linux: Add stub support for Linux specific variables and
    functions.
  ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  ACPICA: Linux: Add configuration item to indicate the architecture
    specific support.
  ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
  ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper -
    table definitions.
  ACPI: Cleanup useless ACPI inclusion.
  ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.

 arch/ia64/Kconfig                 |    1 +
 arch/x86/Kconfig                  |    1 +
 drivers/acpi/Kconfig              |    4 ++++
 drivers/acpi/acpica/Makefile      |    2 +-
 drivers/acpi/bus.c                |    3 ---
 include/acpi/acpixf.h             |   28 +++++++++++++++++-----------
 include/acpi/platform/aclinux.h   |   12 ++++++++++++
 include/acpi/platform/aclinuxex.h |   22 ++++++++++++++++++++++
 include/linux/acpi.h              |    6 +++---
 include/linux/sfi_acpi.h          |    3 ---
 sound/soc/intel/sst-haswell-dsp.c |    3 ---
 11 files changed, 61 insertions(+), 24 deletions(-)

-- 
1.7.10


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

* [PATCH v2 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are global variables and functions not upstreamed to the ACPICA code
base.  Such symbols still can be referenced by external users as they are
listed in the acpixf.h.  This patch uses ACPI_GLOBAL and
ACPI_EXTERNAL_RETURN_STATUS mechanism to add stub support for such symbols.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/bus.c    |    3 ---
 include/acpi/acpixf.h |   28 +++++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index c5bc8cf..8581f5b 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -477,9 +477,6 @@ static int __init acpi_bus_init_irq(void)
 	return 0;
 }
 
-u8 acpi_gbl_permanent_mmap;
-
-
 void __init acpi_early_init(void)
 {
 	acpi_status status;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 35b525c..bdbb145 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -53,8 +53,6 @@
 #include <acpi/actbl.h>
 #include <acpi/acbuffer.h>
 
-extern u8 acpi_gbl_permanent_mmap;
-
 /*****************************************************************************
  *
  * Macros used for ACPICA globals and configuration
@@ -865,17 +863,25 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
 /*
  * Divergences
  */
-acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
+ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap);
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_id(acpi_handle object,
+					acpi_owner_id * out_type))
 
-acpi_status acpi_unload_table_id(acpi_owner_id id);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
 
-acpi_status
-acpi_get_table_with_size(acpi_string signature,
-	       u32 instance, struct acpi_table_header **out_table,
-	       acpi_size *tbl_size);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_table_with_size(acpi_string signature,
+						     u32 instance,
+						     struct acpi_table_header
+						     **out_table,
+						     acpi_size *tbl_size))
 
-acpi_status
-acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data,
-		   void (*callback)(void *));
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_data_full(acpi_handle object,
+					       acpi_object_handler handler,
+					       void **data,
+					       void (*callback)(void *)))
 
 #endif				/* __ACXFACE_H__ */
-- 
1.7.10


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

* [PATCH v2 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 3/7] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch adds default 64-bit mathematics in aclinux.h using do_div(). As
do_div() can be used for all Linux architectures, this can also be used as
stub macros for ACPICA 64-bit mathematics.

But this is not a performance friendly way, as ACPICA's architecture
specific division OSL only requires a dividing 64-bit number with a 32-bit
number implementation, while Linux __div64_32() is not available for all
build environments. So currently, if an architecture really wants to
support ACPICA, it must implement its own division OSL.

This is required by the ACPICA header stub support. ACPICA header stubs are
useful to protect CONFIG_ACPI=n Linux kernel builds where ACPICA headers
are included. Lv Zheng.

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

diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
index 191e741..568d4b8 100644
--- a/include/acpi/platform/aclinuxex.h
+++ b/include/acpi/platform/aclinuxex.h
@@ -46,6 +46,28 @@
 
 #ifdef __KERNEL__
 
+#ifndef ACPI_USE_NATIVE_DIVIDE
+
+#ifndef ACPI_DIV_64_BY_32
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	do { \
+		u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \
+		(r32) = do_div ((__n), (d32)); \
+		(q32) = (u32) (__n); \
+	} while (0)
+#endif
+
+#ifndef ACPI_SHIFT_RIGHT_64
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	do { \
+		(n_lo) >>= 1; \
+		(n_lo) |= (((n_hi) & 1) << 31); \
+		(n_hi) >>= 1; \
+	} while (0)
+#endif
+
+#endif
+
 /*
  * Overrides for in-kernel ACPICA
  */
-- 
1.7.10


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

* [PATCH v2 3/7] ACPICA: Linux: Add configuration item to indicate the architecture specific support.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Tony Luck, Fenghua Yu,
	linux-ia64

This patch adds a kernel configuration item to indicate the presense of
the architecture specific support for ACPICA, so that <asm/acenv.h>
inclusion can be configured out.

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

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2f3abcf..a822dd1 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -47,6 +47,7 @@ config IA64
 	select MODULES_USE_ELF_RELA
 	select ARCH_USE_CMPXCHG_LOCKREF
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_ACPICA
 	default y
 	help
 	  The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a8f749e..16f3197 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -131,6 +131,7 @@ config X86
 	select HAVE_CC_STACKPROTECTOR
 	select GENERIC_CPU_AUTOPROBE
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_ACPICA
 
 config INSTRUCTION_DECODER
 	def_bool y
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a34a228..0cd63af4 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -2,8 +2,12 @@
 # ACPI Configuration
 #
 
+config HAVE_ARCH_ACPICA
+	bool
+
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
+	depends on HAVE_ARCH_ACPICA
 	depends on !IA64_HP_SIM
 	depends on IA64 || X86
 	depends on PCI
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index cd1f052..d63a54b4 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -70,7 +70,9 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
+#ifdef CONFIG_HAVE_ARCH_ACPICA
 #include <asm/acenv.h>
+#endif
 
 #ifndef CONFIG_ACPI
 
-- 
1.7.10


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

* [PATCH v2 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (2 preceding siblings ...)
  2014-07-07  4:17   ` [PATCH v2 3/7] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch moves <acpi/acpi.h> out of CONFIG_ACPI condition so that all
ACPICA prototypes can be seen by the CONFIG_ACPI=n Linux kernel builds.
Note that we can do this because ACPICA has implemented stubs for all
ACPICA prototypes that are currently referenced by the Linux kernel.

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

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 358c01b..5320153 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -29,17 +29,17 @@
 #include <linux/ioport.h>	/* for struct resource */
 #include <linux/device.h>
 
-#ifdef	CONFIG_ACPI
-
 #ifndef _LINUX
 #define _LINUX
 #endif
+#include <acpi/acpi.h>
+
+#ifdef	CONFIG_ACPI
 
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 #include <linux/dynamic_debug.h>
 
-#include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_numa.h>
-- 
1.7.10


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

* [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (3 preceding siblings ...)
  2014-07-07  4:17   ` [PATCH v2 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07 21:25     ` Rafael J. Wysocki
  2014-07-07  4:17   ` [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
  2014-07-07  4:17   ` [PATCH v2 7/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
  6 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Len Brown, sfi-devel

This patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as
<linux/acpi.h> has already included it for CONFIG_ACPI=n builds.

Cc: Len Brown <lenb@kernel.org>
Cc: sfi-devel@simplefirmware.org
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/sfi_acpi.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbf..a6e555c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
 #include <linux/sfi.h>
 
 #ifdef CONFIG_SFI
-#include <acpi/acpi.h>	/* FIXME: inclusion should be removed */
-
 extern int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
 	return sfi_acpi_table_parse(signature, NULL, NULL, handler);
 }
 #else /* !CONFIG_SFI */
-
 static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *))
-- 
1.7.10


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

* [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (4 preceding siblings ...)
  2014-07-07  4:17   ` [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  2014-07-07 21:24     ` Rafael J. Wysocki
  2014-07-07  4:17   ` [PATCH v2 7/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
  6 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Liam Girdwood,
	Mark Brown, alsa-devel

The sst-haswell-dsp.c is an ACPI independent file, this patch removes
ACPI header files for it.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
---
 sound/soc/intel/sst-haswell-dsp.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index 535f517..ecc5057 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -28,9 +28,6 @@
 #include <linux/firmware.h>
 #include <linux/pm_runtime.h>
 
-#include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-
 #include "sst-dsp.h"
 #include "sst-dsp-priv.h"
 #include "sst-haswell-ipc.h"
-- 
1.7.10


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

* [PATCH v2 7/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (5 preceding siblings ...)
  2014-07-07  4:17   ` [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
@ 2014-07-07  4:17   ` Lv Zheng
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-07  4:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

As there is only CONFIG_ACPI=n processing in the <linux/acpi.h>, it is not
safe to include <acpi/acpi.h> directly for source out of Linux ACPI
subsystems.

This patch adds error messaging to warn developers of such wrong
inclusions.

In order not to be bisected and reverted as a wrong commit, warning
messages are carefully split into a seperate patch other than the wrong
inclusion cleanups.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/Makefile    |    2 +-
 include/acpi/platform/aclinux.h |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 8bb43f0..87a24ac 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -2,7 +2,7 @@
 # Makefile for ACPICA Core interpreter
 #
 
-ccflags-y			:= -Os
+ccflags-y			:= -Os -DBUILDING_ACPICA
 ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT
 
 # use acpi.o to put all files here into acpi.o modparam namespace
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index d63a54b4..6107483 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -44,6 +44,16 @@
 #ifndef __ACLINUX_H__
 #define __ACLINUX_H__
 
+#ifdef __KERNEL__
+
+/* ACPICA external files should not include ACPICA headers directly. */
+
+#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H)
+#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead."
+#endif
+
+#endif
+
 /* Common (in-kernel/user-space) ACPICA configuration */
 
 #define ACPI_USE_SYSTEM_CLIBRARY
-- 
1.7.10


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

* Re: [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-07  4:17   ` [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
@ 2014-07-07 21:24     ` Rafael J. Wysocki
  2014-07-08  0:05       ` Zheng, Lv
  0 siblings, 1 reply; 50+ messages in thread
From: Rafael J. Wysocki @ 2014-07-07 21:24 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Liam Girdwood, Mark Brown, alsa-devel

On Monday, July 07, 2014 12:17:40 PM Lv Zheng wrote:
> The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> ACPI header files for it.

This appears to be independent of the rest of the series.  Is that correct?

> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: alsa-devel@alsa-project.org
> ---
>  sound/soc/intel/sst-haswell-dsp.c |    3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
> index 535f517..ecc5057 100644
> --- a/sound/soc/intel/sst-haswell-dsp.c
> +++ b/sound/soc/intel/sst-haswell-dsp.c
> @@ -28,9 +28,6 @@
>  #include <linux/firmware.h>
>  #include <linux/pm_runtime.h>
>  
> -#include <linux/acpi.h>
> -#include <acpi/acpi_bus.h>
> -
>  #include "sst-dsp.h"
>  #include "sst-dsp-priv.h"
>  #include "sst-haswell-ipc.h"
> 

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

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

* Re: [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
  2014-07-07  4:17   ` [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
@ 2014-07-07 21:25     ` Rafael J. Wysocki
  2014-07-08  0:08       ` Zheng, Lv
  0 siblings, 1 reply; 50+ messages in thread
From: Rafael J. Wysocki @ 2014-07-07 21:25 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Len Brown, sfi-devel

On Monday, July 07, 2014 12:17:28 PM Lv Zheng wrote:
> This patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as
> <linux/acpi.h> has already included it for CONFIG_ACPI=n builds.

So are patches [1-4/5] only needed to fix this particular issue?

> Cc: Len Brown <lenb@kernel.org>
> Cc: sfi-devel@simplefirmware.org
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
>  include/linux/sfi_acpi.h |    3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
> index 4723bbf..a6e555c 100644
> --- a/include/linux/sfi_acpi.h
> +++ b/include/linux/sfi_acpi.h
> @@ -63,8 +63,6 @@
>  #include <linux/sfi.h>
>  
>  #ifdef CONFIG_SFI
> -#include <acpi/acpi.h>	/* FIXME: inclusion should be removed */
> -
>  extern int sfi_acpi_table_parse(char *signature, char *oem_id,
>  				char *oem_table_id,
>  				int (*handler)(struct acpi_table_header *));
> @@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
>  	return sfi_acpi_table_parse(signature, NULL, NULL, handler);
>  }
>  #else /* !CONFIG_SFI */
> -
>  static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
>  				char *oem_table_id,
>  				int (*handler)(struct acpi_table_header *))
> 

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

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

* RE: [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-07 21:24     ` Rafael J. Wysocki
@ 2014-07-08  0:05       ` Zheng, Lv
  0 siblings, 0 replies; 50+ messages in thread
From: Zheng, Lv @ 2014-07-08  0:05 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Liam Girdwood, Mark Brown, alsa-devel

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

Hi,

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Rafael J. Wysocki
> Sent: Tuesday, July 08, 2014 5:24 AM
> 
> On Monday, July 07, 2014 12:17:40 PM Lv Zheng wrote:
> > The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> > ACPI header files for it.
> 
> This appears to be independent of the rest of the series.  Is that correct?

Yes.
Now the <acpi/acpi_bus.h> inclusion in this file is the only one after we've cleaned up the others.

Best regards
-Lv

> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > Cc: Liam Girdwood <lgirdwood@gmail.com>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: alsa-devel@alsa-project.org
> > ---
> >  sound/soc/intel/sst-haswell-dsp.c |    3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
> > index 535f517..ecc5057 100644
> > --- a/sound/soc/intel/sst-haswell-dsp.c
> > +++ b/sound/soc/intel/sst-haswell-dsp.c
> > @@ -28,9 +28,6 @@
> >  #include <linux/firmware.h>
> >  #include <linux/pm_runtime.h>
> >
> > -#include <linux/acpi.h>
> > -#include <acpi/acpi_bus.h>
> > -
> >  #include "sst-dsp.h"
> >  #include "sst-dsp-priv.h"
> >  #include "sst-haswell-ipc.h"
> >
> 
> --
> 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] 50+ messages in thread

* RE: [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
  2014-07-07 21:25     ` Rafael J. Wysocki
@ 2014-07-08  0:08       ` Zheng, Lv
  0 siblings, 0 replies; 50+ messages in thread
From: Zheng, Lv @ 2014-07-08  0:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Len Brown, sfi-devel

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

Hi,

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Tuesday, July 08, 2014 5:25 AM
> 
> On Monday, July 07, 2014 12:17:28 PM Lv Zheng wrote:
> > This patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as
> > <linux/acpi.h> has already included it for CONFIG_ACPI=n builds.
> 
> So are patches [1-4/5] only needed to fix this particular issue?

To fix this issue, we only need patch 1-5.
After applying these patches, all ACPICA structures are visible to the entire linux kernel.

Thanks and best regards
-Lv

> 
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: sfi-devel@simplefirmware.org
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/linux/sfi_acpi.h |    3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
> > index 4723bbf..a6e555c 100644
> > --- a/include/linux/sfi_acpi.h
> > +++ b/include/linux/sfi_acpi.h
> > @@ -63,8 +63,6 @@
> >  #include <linux/sfi.h>
> >
> >  #ifdef CONFIG_SFI
> > -#include <acpi/acpi.h>	/* FIXME: inclusion should be removed */
> > -
> >  extern int sfi_acpi_table_parse(char *signature, char *oem_id,
> >  				char *oem_table_id,
> >  				int (*handler)(struct acpi_table_header *));
> > @@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
> >  	return sfi_acpi_table_parse(signature, NULL, NULL, handler);
> >  }
> >  #else /* !CONFIG_SFI */
> > -
> >  static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
> >  				char *oem_table_id,
> >  				int (*handler)(struct acpi_table_header *))
> >
> 
> --
> 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] 50+ messages in thread

* [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds.
  2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
                   ` (16 preceding siblings ...)
  2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
@ 2014-07-16  8:57 ` Lv Zheng
  2014-07-16  8:57   ` [PATCH v3 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
                     ` (6 more replies)
  17 siblings, 7 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, alsa-devel

v3:
 PATCH 3/7 updated to remove new Kconfig item.

This is the last series for ACPICA header inclusion cleanups.
The whole story can be found below:
  1. Unsafe inclusions:
     origin: https://lkml.org/lkml/2013/11/22/510
     merged: https://lkml.org/lkml/2013/12/6/79
  2. Header orders:
     origin: https://lkml.org/lkml/2014/4/8/57
     merged: https://lkml.org/lkml/2014/5/12/111
  3. Header stubs:
     origin: https://lkml.org/lkml/2014/12/18/149
     merged: https://lkml.org/lkml/2014/4/29/716

This patchset contains patches that are parts of the last series sent
before, so it is marked as v2 belonging to the same thread as this series:
  https://lkml.org/lkml/2014/12/18/149

Now we have cleaned up all mis-ordered ACPICA headers and implemented stubs
for ACPICA prototypes (functions, global variables, macros), we finally can
enable ACPICA headers for CONFIG_ACPI=n builds so that all ACPICA defined
types are visible to all kernel source files.

After exposing ACPICA types to all kernel sources, we can also sort the
final wrong <acpi/acpi.h> inclusion out of <linux/sfi_acpi.h>.

This patchset also includes a rule enforcement patch to avoid future
inclusion mistakes.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
  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
They are tested twice with CONFIG_ACPI enabled/disabled.

Also allyes/allno/allmod tests are done for ARCH=i386 and ARCH=x86_64.

A boot test has been done to ARCH=x86_64 default configuration and it is
confirmed that the ACPI devices are successfully created under
/sys/bus/acpi/devices when CONFIG_ACPI is enabled.

Lv Zheng (7):
  ACPICA: Linux: Add stub support for Linux specific variables and
    functions.
  ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion.
  ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
  ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper -
    table definitions.
  ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
  ACPI: Cleanup useless ACPI inclusion.

 arch/ia64/include/asm/acenv.h     |    4 ----
 arch/x86/include/asm/acenv.h      |    4 ----
 drivers/acpi/acpica/Makefile      |    2 +-
 drivers/acpi/bus.c                |    3 ---
 include/acpi/acpixf.h             |   28 +++++++++++++++++-----------
 include/acpi/platform/aclinux.h   |   12 ++++++++++++
 include/acpi/platform/aclinuxex.h |   22 ++++++++++++++++++++++
 include/linux/acpi.h              |    6 +++---
 include/linux/sfi_acpi.h          |    3 ---
 sound/soc/intel/sst-haswell-dsp.c |    3 ---
 10 files changed, 55 insertions(+), 32 deletions(-)

-- 
1.7.10


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

* [PATCH v3 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
@ 2014-07-16  8:57   ` Lv Zheng
  2014-07-16  8:58   ` [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:57 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

There are global variables and functions not upstreamed to the ACPICA code
base.  Such symbols still can be referenced by external users as they are
listed in the acpixf.h.  This patch uses ACPI_GLOBAL and
ACPI_EXTERNAL_RETURN_STATUS mechanism to add stub support for such symbols.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/bus.c    |    3 ---
 include/acpi/acpixf.h |   28 +++++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index c5bc8cf..8581f5b 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -477,9 +477,6 @@ static int __init acpi_bus_init_irq(void)
 	return 0;
 }
 
-u8 acpi_gbl_permanent_mmap;
-
-
 void __init acpi_early_init(void)
 {
 	acpi_status status;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 3f6e14f..854dd01 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -53,8 +53,6 @@
 #include <acpi/actbl.h>
 #include <acpi/acbuffer.h>
 
-extern u8 acpi_gbl_permanent_mmap;
-
 /*****************************************************************************
  *
  * Macros used for ACPICA globals and configuration
@@ -885,17 +883,25 @@ ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
 /*
  * Divergences
  */
-acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
+ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap);
+
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_id(acpi_handle object,
+					acpi_owner_id * out_type))
 
-acpi_status acpi_unload_table_id(acpi_owner_id id);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_unload_table_id(acpi_owner_id id))
 
-acpi_status
-acpi_get_table_with_size(acpi_string signature,
-	       u32 instance, struct acpi_table_header **out_table,
-	       acpi_size *tbl_size);
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_table_with_size(acpi_string signature,
+						     u32 instance,
+						     struct acpi_table_header
+						     **out_table,
+						     acpi_size *tbl_size))
 
-acpi_status
-acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data,
-		   void (*callback)(void *));
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+			    acpi_get_data_full(acpi_handle object,
+					       acpi_object_handler handler,
+					       void **data,
+					       void (*callback)(void *)))
 
 #endif				/* __ACXFACE_H__ */
-- 
1.7.10


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

* [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  2014-07-16  8:57   ` [PATCH v3 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
@ 2014-07-16  8:58   ` Lv Zheng
  2014-07-19 23:46     ` Rafael J. Wysocki
  2014-07-16  8:58   ` [PATCH v3 3/7] ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion Lv Zheng
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:58 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch adds default 64-bit mathematics in aclinux.h using do_div(). As
do_div() can be used for all Linux architectures, this can also be used as
stub macros for ACPICA 64-bit mathematics.

But this is not a performance friendly way, as ACPICA's architecture
specific division OSL only requires a dividing 64-bit number with a 32-bit
number implementation, while Linux __div64_32() is not available for all
build environments. So currently, if an architecture really wants to
support ACPICA, it must implement its own division OSL.

This is required by the ACPICA header stub support. ACPICA header stubs are
useful to protect CONFIG_ACPI=n Linux kernel builds where ACPICA headers
are included. Lv Zheng.

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

diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
index 191e741..568d4b8 100644
--- a/include/acpi/platform/aclinuxex.h
+++ b/include/acpi/platform/aclinuxex.h
@@ -46,6 +46,28 @@
 
 #ifdef __KERNEL__
 
+#ifndef ACPI_USE_NATIVE_DIVIDE
+
+#ifndef ACPI_DIV_64_BY_32
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	do { \
+		u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \
+		(r32) = do_div ((__n), (d32)); \
+		(q32) = (u32) (__n); \
+	} while (0)
+#endif
+
+#ifndef ACPI_SHIFT_RIGHT_64
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	do { \
+		(n_lo) >>= 1; \
+		(n_lo) |= (((n_hi) & 1) << 31); \
+		(n_hi) >>= 1; \
+	} while (0)
+#endif
+
+#endif
+
 /*
  * Overrides for in-kernel ACPICA
  */
-- 
1.7.10


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

* [PATCH v3 3/7] ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
  2014-07-16  8:57   ` [PATCH v3 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
  2014-07-16  8:58   ` [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
@ 2014-07-16  8:58   ` Lv Zheng
  2014-07-16  8:58   ` [PATCH v3 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:58 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

The forthcoming patch will make <acpi/acpi.h> to be visible to all kernel
source code. Thus for the architectures that do not support ACPI and
haven't implemented <asm/acenv.h>, we need to make it excluded.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 arch/ia64/include/asm/acenv.h   |    4 ----
 arch/x86/include/asm/acenv.h    |    4 ----
 include/acpi/platform/aclinux.h |    2 ++
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index 3f9eaee..35ff13a 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -19,8 +19,6 @@
 
 /* Asm macros */
 
-#ifdef CONFIG_ACPI
-
 static inline int
 ia64_acpi_acquire_global_lock(unsigned int *lock)
 {
@@ -51,6 +49,4 @@ ia64_acpi_release_global_lock(unsigned int *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/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 6687329..1b010a8 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -18,8 +18,6 @@
 
 #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);
 
@@ -44,6 +42,4 @@ int __acpi_release_global_lock(unsigned int *lock);
 	    : "=r"(n_hi), "=r"(n_lo)	\
 	    : "0"(n_hi), "1"(n_lo))
 
-#endif
-
 #endif /* _ASM_X86_ACENV_H */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index cd1f052..dfba354 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -70,7 +70,9 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
+#ifdef CONFIG_ACPI
 #include <asm/acenv.h>
+#endif
 
 #ifndef CONFIG_ACPI
 
-- 
1.7.10


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

* [PATCH v3 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (2 preceding siblings ...)
  2014-07-16  8:58   ` [PATCH v3 3/7] ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion Lv Zheng
@ 2014-07-16  8:58   ` Lv Zheng
  2014-07-16  8:58   ` [PATCH v3 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:58 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This patch moves <acpi/acpi.h> out of CONFIG_ACPI condition so that all
ACPICA prototypes can be seen by the CONFIG_ACPI=n Linux kernel builds.
Note that we can do this because ACPICA has implemented stubs for all
ACPICA prototypes that are currently referenced by the Linux kernel.

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

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 358c01b..5320153 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -29,17 +29,17 @@
 #include <linux/ioport.h>	/* for struct resource */
 #include <linux/device.h>
 
-#ifdef	CONFIG_ACPI
-
 #ifndef _LINUX
 #define _LINUX
 #endif
+#include <acpi/acpi.h>
+
+#ifdef	CONFIG_ACPI
 
 #include <linux/list.h>
 #include <linux/mod_devicetable.h>
 #include <linux/dynamic_debug.h>
 
-#include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_numa.h>
-- 
1.7.10


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

* [PATCH v3 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (3 preceding siblings ...)
  2014-07-16  8:58   ` [PATCH v3 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
@ 2014-07-16  8:58   ` Lv Zheng
  2014-07-16  8:58   ` [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
  2014-07-16  8:59   ` [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
  6 siblings, 0 replies; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:58 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Len Brown, sfi-devel

This patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as
<linux/acpi.h> has already included it for CONFIG_ACPI=n builds.

Cc: Len Brown <lenb@kernel.org>
Cc: sfi-devel@simplefirmware.org
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/linux/sfi_acpi.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
index 4723bbf..a6e555c 100644
--- a/include/linux/sfi_acpi.h
+++ b/include/linux/sfi_acpi.h
@@ -63,8 +63,6 @@
 #include <linux/sfi.h>
 
 #ifdef CONFIG_SFI
-#include <acpi/acpi.h>	/* FIXME: inclusion should be removed */
-
 extern int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *));
@@ -78,7 +76,6 @@ static inline int __init acpi_sfi_table_parse(char *signature,
 	return sfi_acpi_table_parse(signature, NULL, NULL, handler);
 }
 #else /* !CONFIG_SFI */
-
 static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *))
-- 
1.7.10


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

* [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (4 preceding siblings ...)
  2014-07-16  8:58   ` [PATCH v3 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
@ 2014-07-16  8:58   ` Lv Zheng
  2014-07-23  3:53     ` Hanjun Guo
  2014-07-16  8:59   ` [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
  6 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:58 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

As there is only CONFIG_ACPI=n processing in the <linux/acpi.h>, it is not
safe to include <acpi/acpi.h> directly for source out of Linux ACPI
subsystems.

This patch adds error messaging to warn developers of such wrong
inclusions.

In order not to be bisected and reverted as a wrong commit, warning
messages are carefully split into a seperate patch other than the wrong
inclusion cleanups.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/Makefile    |    2 +-
 include/acpi/platform/aclinux.h |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 6b9ec23..4be4cc94 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -2,7 +2,7 @@
 # Makefile for ACPICA Core interpreter
 #
 
-ccflags-y			:= -Os
+ccflags-y			:= -Os -DBUILDING_ACPICA
 ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT
 
 # use acpi.o to put all files here into acpi.o modparam namespace
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index dfba354..1ba7c19 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -44,6 +44,16 @@
 #ifndef __ACLINUX_H__
 #define __ACLINUX_H__
 
+#ifdef __KERNEL__
+
+/* ACPICA external files should not include ACPICA headers directly. */
+
+#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H)
+#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead."
+#endif
+
+#endif
+
 /* Common (in-kernel/user-space) ACPICA configuration */
 
 #define ACPI_USE_SYSTEM_CLIBRARY
-- 
1.7.10


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

* [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
                     ` (5 preceding siblings ...)
  2014-07-16  8:58   ` [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
@ 2014-07-16  8:59   ` Lv Zheng
  2014-07-16 12:07     ` Mark Brown
  6 siblings, 1 reply; 50+ messages in thread
From: Lv Zheng @ 2014-07-16  8:59 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Liam Girdwood,
	Mark Brown, alsa-devel

The sst-haswell-dsp.c is an ACPI independent file, this patch removes
ACPI header files for it.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
---
 sound/soc/intel/sst-haswell-dsp.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index 535f517..ecc5057 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -28,9 +28,6 @@
 #include <linux/firmware.h>
 #include <linux/pm_runtime.h>
 
-#include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-
 #include "sst-dsp.h"
 #include "sst-dsp-priv.h"
 #include "sst-haswell-ipc.h"
-- 
1.7.10


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

* Re: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-16  8:59   ` [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
@ 2014-07-16 12:07     ` Mark Brown
  2014-07-16 21:46       ` Rafael J. Wysocki
  0 siblings, 1 reply; 50+ messages in thread
From: Mark Brown @ 2014-07-16 12:07 UTC (permalink / raw)
  To: Lv Zheng
  Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi,
	Liam Girdwood, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Wed, Jul 16, 2014 at 04:59:02PM +0800, Lv Zheng wrote:
> The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> ACPI header files for it.

Applied, thanks.  Please use subject lines matching the style for the
subsystem and send at least the cover letter for the series to everyone
so that they know what's going on with dependencies and so on.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-16 21:46       ` Rafael J. Wysocki
@ 2014-07-16 21:34         ` Mark Brown
  2014-07-17  1:29           ` Zheng, Lv
  0 siblings, 1 reply; 50+ messages in thread
From: Mark Brown @ 2014-07-16 21:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lv Zheng, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel,
	linux-acpi, Liam Girdwood, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

On Wed, Jul 16, 2014 at 11:46:14PM +0200, Rafael J. Wysocki wrote:
> On Wednesday, July 16, 2014 01:07:50 PM Mark Brown wrote:
> > On Wed, Jul 16, 2014 at 04:59:02PM +0800, Lv Zheng wrote:

> > > The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> > > ACPI header files for it.

> > Applied, thanks.  Please use subject lines matching the style for the
> > subsystem and send at least the cover letter for the series to everyone
> > so that they know what's going on with dependencies and so on.

> Lv thought that this would go through the ACPI tree I suppose.

Even so the subject line should still line up (it's part of how some of
us pick out which mail to read).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-16 12:07     ` Mark Brown
@ 2014-07-16 21:46       ` Rafael J. Wysocki
  2014-07-16 21:34         ` Mark Brown
  0 siblings, 1 reply; 50+ messages in thread
From: Rafael J. Wysocki @ 2014-07-16 21:46 UTC (permalink / raw)
  To: Mark Brown
  Cc: Lv Zheng, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel,
	linux-acpi, Liam Girdwood, alsa-devel

On Wednesday, July 16, 2014 01:07:50 PM Mark Brown wrote:
> 
> --5me2qT3T17SWzdxI
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Wed, Jul 16, 2014 at 04:59:02PM +0800, Lv Zheng wrote:
> > The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> > ACPI header files for it.
> 
> Applied, thanks.  Please use subject lines matching the style for the
> subsystem and send at least the cover letter for the series to everyone
> so that they know what's going on with dependencies and so on.

Lv thought that this would go through the ACPI tree I suppose.

Rafael


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

* RE: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
  2014-07-16 21:34         ` Mark Brown
@ 2014-07-17  1:29           ` Zheng, Lv
  0 siblings, 0 replies; 50+ messages in thread
From: Zheng, Lv @ 2014-07-17  1:29 UTC (permalink / raw)
  To: Mark Brown, Rafael J. Wysocki
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Liam Girdwood, alsa-devel

Hi,

> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Thursday, July 17, 2014 5:35 AM
> 
> On Wed, Jul 16, 2014 at 11:46:14PM +0200, Rafael J. Wysocki wrote:
> > On Wednesday, July 16, 2014 01:07:50 PM Mark Brown wrote:
> > > On Wed, Jul 16, 2014 at 04:59:02PM +0800, Lv Zheng wrote:
> 
> > > > The sst-haswell-dsp.c is an ACPI independent file, this patch removes
> > > > ACPI header files for it.
> 
> > > Applied, thanks.  Please use subject lines matching the style for the
> > > subsystem and send at least the cover letter for the series to everyone
> > > so that they know what's going on with dependencies and so on.
> 
> > Lv thought that this would go through the ACPI tree I suppose.
> 
> Even so the subject line should still line up (it's part of how some of
> us pick out which mail to read).

I just didn't notice this. :-)
I'll take care next time.

Thanks and best regards
-Lv

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

* Re: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2014-07-16  8:58   ` [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
@ 2014-07-19 23:46     ` Rafael J. Wysocki
  2014-07-21  1:26       ` Zheng, Lv
  0 siblings, 1 reply; 50+ messages in thread
From: Rafael J. Wysocki @ 2014-07-19 23:46 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel, linux-acpi

On Wednesday, July 16, 2014 04:58:00 PM Lv Zheng wrote:
> This patch adds default 64-bit mathematics in aclinux.h using do_div(). As
> do_div() can be used for all Linux architectures, this can also be used as
> stub macros for ACPICA 64-bit mathematics.
> 
> But this is not a performance friendly way, as ACPICA's architecture
> specific division OSL only requires a dividing 64-bit number with a 32-bit
> number implementation, while Linux __div64_32() is not available for all
> build environments. So currently, if an architecture really wants to
> support ACPICA, it must implement its own division OSL.

What does this mean for i386, in particular?

> This is required by the ACPICA header stub support. ACPICA header stubs are
> useful to protect CONFIG_ACPI=n Linux kernel builds where ACPICA headers
> are included. Lv Zheng.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
>  include/acpi/platform/aclinuxex.h |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
> index 191e741..568d4b8 100644
> --- a/include/acpi/platform/aclinuxex.h
> +++ b/include/acpi/platform/aclinuxex.h
> @@ -46,6 +46,28 @@
>  
>  #ifdef __KERNEL__
>  
> +#ifndef ACPI_USE_NATIVE_DIVIDE
> +
> +#ifndef ACPI_DIV_64_BY_32
> +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> +	do { \
> +		u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \
> +		(r32) = do_div ((__n), (d32)); \
> +		(q32) = (u32) (__n); \
> +	} while (0)
> +#endif
> +
> +#ifndef ACPI_SHIFT_RIGHT_64
> +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> +	do { \
> +		(n_lo) >>= 1; \
> +		(n_lo) |= (((n_hi) & 1) << 31); \
> +		(n_hi) >>= 1; \
> +	} while (0)
> +#endif
> +
> +#endif
> +
>  /*
>   * Overrides for in-kernel ACPICA
>   */
> 

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

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

* RE: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2014-07-19 23:46     ` Rafael J. Wysocki
@ 2014-07-21  1:26       ` Zheng, Lv
  2014-07-22 23:42         ` Rafael J. Wysocki
  0 siblings, 1 reply; 50+ messages in thread
From: Zheng, Lv @ 2014-07-21  1:26 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: 4624 bytes --]

Hi, Rafael

> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> Sent: Sunday, July 20, 2014 7:46 AM
> To: Zheng, Lv
> 
> On Wednesday, July 16, 2014 04:58:00 PM Lv Zheng wrote:
> > This patch adds default 64-bit mathematics in aclinux.h using do_div(). As
> > do_div() can be used for all Linux architectures, this can also be used as
> > stub macros for ACPICA 64-bit mathematics.
> >
> > But this is not a performance friendly way, as ACPICA's architecture
> > specific division OSL only requires a dividing 64-bit number with a 32-bit
> > number implementation, while Linux __div64_32() is not available for all
> > build environments. So currently, if an architecture really wants to
> > support ACPICA, it must implement its own division OSL.
> 
> What does this mean for i386, in particular?

All ACPICA environment macros have defaults in actypes.h or acenv.h, these macros are the only ones do not have defaults.
Because their defaults should be provided by OSPMs.
This patch just adds their default implementation for __KERNEL__ surrounded code for Linux kernel.
It only provides build protection and demonstrations of the functionality, no one actually uses it now.

Let me figure out the possible users below:

These macros are required by drivers/acpi/utmath.c when ACPI_USE_NATIVE_DIVIDE is not defined.
It is used by ACPICA, so currently this is only meaningful to CONFIG_ACPI builds.
So kernel will not use these macros unless CONFIG_ACPI is defined and ACPI_USE_DIVIDE is not defined.

For 64-bit kernels: 
In include/acpi/actypes.h, for ACPI_MACHINE_WIDTH=64, ACPI_USE_NATIVE_DIVIDE will be defined, thus these macros are not used.
In include/acpi/platform/aclinux.h, for __KERNEL__ surrounded code, ACPI_MACHINE_WIDTH is defined to be BITS_PER_LONG.
So all 64-bit kernels do not use these macros.

For 32-bit kernels:
As mentioned above, these macros will be used when BITS_PER_LONG is 32.
Thus currently the i328 kernels are the only users for these macros.
But they won't use this default implementation provided by this patch because:
In arch/x86/include/asm/acenv.h, there are already overrides implemented.
So these default macros are not used by 32-bit x86 (i386) kernels.

These macros will only be used by future non x86 32-bit architectures that try to support ACPI in Linux kernel.
During the period they do not have arch specific implementations of such macros, we can avoid build errors for them.
And since they can see ACPICA functioning without implementing any arch specific environment tunings, we  can also avoid function errors for them.
As this implementation is not performance friendly, those architectures still need to implement real support in the end.

As a conclusion, IMO:
1. This default implementation just fill an ACPICA default environment gap.
1. There are no users and will be no users of this default implementation in the kernel.
3. Though this default implementation is not performance friendly, it functions correctly, so it can be a demo for future 32-bit architectures that try to support ACPI.
4. We can use this default implementation to avoid build troubles.

Thanks and best regards
-Lv

> 
> > This is required by the ACPICA header stub support. ACPICA header stubs are
> > useful to protect CONFIG_ACPI=n Linux kernel builds where ACPICA headers
> > are included. Lv Zheng.
> >
> > Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> > ---
> >  include/acpi/platform/aclinuxex.h |   22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
> > index 191e741..568d4b8 100644
> > --- a/include/acpi/platform/aclinuxex.h
> > +++ b/include/acpi/platform/aclinuxex.h
> > @@ -46,6 +46,28 @@
> >
> >  #ifdef __KERNEL__
> >
> > +#ifndef ACPI_USE_NATIVE_DIVIDE
> > +
> > +#ifndef ACPI_DIV_64_BY_32
> > +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
> > +	do { \
> > +		u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \
> > +		(r32) = do_div ((__n), (d32)); \
> > +		(q32) = (u32) (__n); \
> > +	} while (0)
> > +#endif
> > +
> > +#ifndef ACPI_SHIFT_RIGHT_64
> > +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
> > +	do { \
> > +		(n_lo) >>= 1; \
> > +		(n_lo) |= (((n_hi) & 1) << 31); \
> > +		(n_hi) >>= 1; \
> > +	} while (0)
> > +#endif
> > +
> > +#endif
> > +
> >  /*
> >   * Overrides for in-kernel ACPICA
> >   */
> >
> 
> --
> 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] 50+ messages in thread

* Re: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
  2014-07-21  1:26       ` Zheng, Lv
@ 2014-07-22 23:42         ` Rafael J. Wysocki
  0 siblings, 0 replies; 50+ messages in thread
From: Rafael J. Wysocki @ 2014-07-22 23:42 UTC (permalink / raw)
  To: Zheng, Lv
  Cc: Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel, linux-acpi

On Monday, July 21, 2014 01:26:10 AM Zheng, Lv wrote:
> Hi, Rafael
> 
> > From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> > Sent: Sunday, July 20, 2014 7:46 AM
> > To: Zheng, Lv
> > 
> > On Wednesday, July 16, 2014 04:58:00 PM Lv Zheng wrote:
> > > This patch adds default 64-bit mathematics in aclinux.h using do_div(). As
> > > do_div() can be used for all Linux architectures, this can also be used as
> > > stub macros for ACPICA 64-bit mathematics.
> > >
> > > But this is not a performance friendly way, as ACPICA's architecture
> > > specific division OSL only requires a dividing 64-bit number with a 32-bit
> > > number implementation, while Linux __div64_32() is not available for all
> > > build environments. So currently, if an architecture really wants to
> > > support ACPICA, it must implement its own division OSL.
> > 
> > What does this mean for i386, in particular?
> 
> All ACPICA environment macros have defaults in actypes.h or acenv.h, these macros are the only ones do not have defaults.
> Because their defaults should be provided by OSPMs.
> This patch just adds their default implementation for __KERNEL__ surrounded code for Linux kernel.
> It only provides build protection and demonstrations of the functionality, no one actually uses it now.
> 
> Let me figure out the possible users below:
> 
> These macros are required by drivers/acpi/utmath.c when ACPI_USE_NATIVE_DIVIDE is not defined.
> It is used by ACPICA, so currently this is only meaningful to CONFIG_ACPI builds.
> So kernel will not use these macros unless CONFIG_ACPI is defined and ACPI_USE_DIVIDE is not defined.
> 
> For 64-bit kernels: 
> In include/acpi/actypes.h, for ACPI_MACHINE_WIDTH=64, ACPI_USE_NATIVE_DIVIDE will be defined, thus these macros are not used.
> In include/acpi/platform/aclinux.h, for __KERNEL__ surrounded code, ACPI_MACHINE_WIDTH is defined to be BITS_PER_LONG.
> So all 64-bit kernels do not use these macros.
> 
> For 32-bit kernels:
> As mentioned above, these macros will be used when BITS_PER_LONG is 32.
> Thus currently the i328 kernels are the only users for these macros.
> But they won't use this default implementation provided by this patch because:
> In arch/x86/include/asm/acenv.h, there are already overrides implemented.
> So these default macros are not used by 32-bit x86 (i386) kernels.
> 
> These macros will only be used by future non x86 32-bit architectures that try to support ACPI in Linux kernel.
> During the period they do not have arch specific implementations of such macros, we can avoid build errors for them.
> And since they can see ACPICA functioning without implementing any arch specific environment tunings, we  can also avoid function errors for them.
> As this implementation is not performance friendly, those architectures still need to implement real support in the end.
> 
> As a conclusion, IMO:
> 1. This default implementation just fill an ACPICA default environment gap.
> 1. There are no users and will be no users of this default implementation in the kernel.
> 3. Though this default implementation is not performance friendly, it functions correctly, so it can be a demo for future 32-bit architectures that try to support ACPI.
> 4. We can use this default implementation to avoid build troubles.

Good analysis, thanks!

I copied the most useful part of it to the changelog of this patch and queued
up the whole series for 3.17.

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

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

* Re: [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
  2014-07-16  8:58   ` [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
@ 2014-07-23  3:53     ` Hanjun Guo
  0 siblings, 0 replies; 50+ messages in thread
From: Hanjun Guo @ 2014-07-23  3:53 UTC (permalink / raw)
  To: Lv Zheng, Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, linux-kernel, linux-acpi

Hi Lv,

On 2014-7-16 16:58, Lv Zheng wrote:
> As there is only CONFIG_ACPI=n processing in the <linux/acpi.h>, it is not
> safe to include <acpi/acpi.h> directly for source out of Linux ACPI
> subsystems.
> 
> This patch adds error messaging to warn developers of such wrong
> inclusions.

Thanks for doing this, it makes life much easier for people who want to
use ACPI but not so familiar with ACPI.

Best Regards
Hanjun


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

end of thread, other threads:[~2014-07-23  3:54 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-18  9:05 [RFC PATCH 00/15] ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files Lv Zheng
2013-12-18  9:05 ` [RFC PATCH 01/15] ACPICA: OSL: Add configurability mechanism for global variables Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 02/15] ACPICA: Linux: Add configurability for external globals Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 03/15] ACPICA: Linux: Add configurability for OSL APIs Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 04/15] ACPICA: OSL: Cleanup external macros and add stubs for macros Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 05/15] ACPICA: OSL: Add configurability to error message functions Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 06/15] ACPICA: OSL: Add configurability to debug output functions Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 07/15] ACPICA: OSL: Add configurability mechanism for external APIs Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 08/15] ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages " Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 09/15] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 10/15] ACPICA: Linux: Add architecture specific ACPICA headers in Linux Lv Zheng
2013-12-18  9:06 ` [RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
2013-12-18  9:07 ` [RFC PATCH 12/15] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
2013-12-18  9:07 ` [RFC PATCH 13/15] ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers Lv Zheng
2013-12-18  9:07 ` [RFC PATCH 14/15] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
2013-12-18  9:07 ` [RFC DBG PATCH] ACPICA: Add CONFIG_ACPI=n build test support Lv Zheng
2013-12-18 11:41   ` [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users Henrique de Moraes Holschuh
2013-12-18 13:06     ` [alsa-devel] " Takashi Iwai
2013-12-20  0:28       ` Zheng, Lv
2013-12-20  6:52         ` Takashi Iwai
2013-12-20  8:30 ` [UPDATE RFC " Lv Zheng
2013-12-20  9:15   ` Takashi Iwai
2014-07-07  4:16 ` [PATCH v2 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
2014-07-07  4:17   ` [PATCH v2 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
2014-07-07  4:17   ` [PATCH v2 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
2014-07-07  4:17   ` [PATCH v2 3/7] ACPICA: Linux: Add configuration item to indicate the architecture specific support Lv Zheng
2014-07-07  4:17   ` [PATCH v2 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
2014-07-07  4:17   ` [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
2014-07-07 21:25     ` Rafael J. Wysocki
2014-07-08  0:08       ` Zheng, Lv
2014-07-07  4:17   ` [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
2014-07-07 21:24     ` Rafael J. Wysocki
2014-07-08  0:05       ` Zheng, Lv
2014-07-07  4:17   ` [PATCH v2 7/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
2014-07-16  8:57 ` [PATCH v3 0/7] ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds Lv Zheng
2014-07-16  8:57   ` [PATCH v3 1/7] ACPICA: Linux: Add stub support for Linux specific variables and functions Lv Zheng
2014-07-16  8:58   ` [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics Lv Zheng
2014-07-19 23:46     ` Rafael J. Wysocki
2014-07-21  1:26       ` Zheng, Lv
2014-07-22 23:42         ` Rafael J. Wysocki
2014-07-16  8:58   ` [PATCH v3 3/7] ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion Lv Zheng
2014-07-16  8:58   ` [PATCH v3 4/7] ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds Lv Zheng
2014-07-16  8:58   ` [PATCH v3 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions Lv Zheng
2014-07-16  8:58   ` [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h> Lv Zheng
2014-07-23  3:53     ` Hanjun Guo
2014-07-16  8:59   ` [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion Lv Zheng
2014-07-16 12:07     ` Mark Brown
2014-07-16 21:46       ` Rafael J. Wysocki
2014-07-16 21:34         ` Mark Brown
2014-07-17  1:29           ` Zheng, Lv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).