ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files.
cover ACPICA: Add CONFIG_ACPI=n build support for ACPICA header files.
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
Signature · 1 line
1.7.10.4
RFC PATCH 1/15 ACPICA: OSL: Add configurability mechanism for global variables.
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.
--- drivers/acpi/acpica/acglobal.h | 123 ----------------------------- drivers/acpi/acpica/utglobal.c | 6 -- include/acpi/acpixf.h | 170 ++++++++++++++++++++++++++++++++-------- 3 files changed, 138 insertions(+), 161 deletions(-)
drivers/acpi/acpica/acglobal.h +0 -123
@@ -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;
drivers/acpi/acpica/utglobal.c +0 -6
@@ -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 */
include/acpi/acpixf.h +138 -32
197 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC PATCH 2/15 ACPICA: Linux: Add configurability for external globals.
In reply to Lv ZhengOSPMs 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.
--- include/acpi/acpixf.h | 11 ++++++++ include/acpi/platform/aclinux.h | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
include/acpi/acpixf.h +11 -0
@@ -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
include/acpi/platform/aclinux.h +53 -0
59 lines not on this page · raw message
Signature · 1 line
1.7.10.4
RFC PATCH 3/15 ACPICA: Linux: Add configurability for OSL APIs.
In reply to Lv ZhengOSPMs 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.
--- include/acpi/platform/aclinux.h | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
include/acpi/platform/aclinux.h +63 -0
@@ -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__ */
Signature · 1 line
1.7.10.4
RFC PATCH 4/15 ACPICA: OSL: Cleanup external macros and add stubs for macros.
In reply to Lv ZhengOSPMs 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.
--- include/acpi/actypes.h | 21 +++++++++++++++++++++ include/acpi/platform/aclinux.h | 12 ++++++++++++ 2 files changed, 33 insertions(+)
include/acpi/actypes.h +21 -0
@@ -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 */
include/acpi/platform/aclinux.h +12 -0
@@ -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>
Signature · 1 line
1.7.10.4
RFC PATCH 5/15 ACPICA: OSL: Add configurability to error message functions.
In reply to Lv ZhengThis 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.
--- drivers/acpi/acpica/utxferror.c | 2 ++ include/acpi/acpixf.h | 75 +++++++++++++++++++++++++-------------- include/acpi/platform/aclinux.h | 4 +++ 3 files changed, 54 insertions(+), 27 deletions(-)
drivers/acpi/acpica/utxferror.c +2 -0
@@ -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 */
include/acpi/acpixf.h +48 -27
92 lines not on this page · raw message
include/acpi/platform/aclinux.h +4 -0
@@ -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>
Signature · 1 line
1.7.10.4
RFC PATCH 6/15 ACPICA: OSL: Add configurability to debug output functions.
In reply to Lv ZhengThis 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.
--- include/acpi/acpixf.h | 45 ++++++++++++++++++++++++--------------- include/acpi/platform/aclinux.h | 1 + 2 files changed, 29 insertions(+), 17 deletions(-)
include/acpi/acpixf.h +28 -17
@@ -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__ */
include/acpi/platform/aclinux.h +1 -0
@@ -65,6 +65,7 @@/* Generating stubs for configurable ACPICA functions */ #define ACPI_NO_ERROR_MESSAGES +#undef ACPI_DEBUG_OUTPUT#endif
Signature · 1 line
1.7.10.4
RFC PATCH 7/15 ACPICA: OSL: Add configurability mechanism for external APIs.
In reply to Lv ZhengOSPMs 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.
--- include/acpi/acpixf.h | 33 ++++++++++++++++++++++++++++++--- include/acpi/platform/aclinux.h | 13 +++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-)
include/acpi/acpixf.h +30 -3
@@ -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);}
include/acpi/platform/aclinux.h +13 -0
@@ -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
Signature · 1 line
1.7.10.4
RFC PATCH 8/15 ACPICA: OSL: Updates ACPI_EXTERNAL_RETURN_x usages for external APIs.
In reply to Lv ZhengOSPMs 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.
--- include/acpi/acpixf.h | 429 ++++++++++++++++++++++++++++++------------------- 1 file changed, 262 insertions(+), 167 deletions(-)
include/acpi/acpixf.h +262 -167
@@ -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 @@ typedefacpi_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
Signature · 1 line
1.7.10.4
RFC PATCH 9/15 ACPICA: Linux: Add stub support for Linux specific variables and functions.
In reply to Lv ZhengThere 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.
--- 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(-)
arch/ia64/kernel/acpi.c +0 -1
@@ -61,7 +61,6 @@#define PREFIX "ACPI: " -u32 acpi_rsdt_forced;unsigned int acpi_cpei_override;unsigned int acpi_cpei_phys_cpuid;
arch/x86/kernel/acpi/boot.c +0 -1
@@ -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);
drivers/acpi/bus.c +0 -3
@@ -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;
include/acpi/acpixf.h +14 -9
@@ -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,
include/acpi/platform/aclinux.h +3 -0
@@ -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
Signature · 1 line
1.7.10.4
RFC PATCH 10/15 ACPICA: Linux: Add architecture specific ACPICA headers in Linux.
In reply to Lv ZhengOur 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.
--- 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
arch/ia64/include/asm/acenv.h new file +71 -0
@@ -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 <[email protected]> +* +* 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 */
arch/ia64/include/asm/acpi.h +0 -50
56 lines not on this page · raw message
arch/x86/include/asm/acenv.h new file +66 -0
66 lines not on this page · raw message
arch/x86/include/asm/acpi.h +0 -45
51 lines not on this page · raw message
include/acpi/platform/aclinux.h +1 -0
@@ -80,6 +80,7 @@#ifdef EXPORT_ACPI_INTERFACES #include <linux/export.h> #endif +#include <asm/acenv.h> #include <asm/acpi.h> #ifdef CONFIG_ACPI
Signature · 1 line
1.7.10.4
RFC PATCH 11/15 ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
In reply to Lv ZhengThis 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.
--- 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(+)
arch/ia64/include/asm/acenv.h +2 -0
@@ -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 */
arch/x86/include/asm/acenv.h +4 -0
@@ -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 */
include/acpi/platform/aclinux.h +29 -0
@@ -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>
Signature · 1 line
1.7.10.4
RFC PATCH 12/15 ACPICA: Linux: Add configuration item to indicate the architecture specific support.
In reply to Lv ZhengThis 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.
--- arch/ia64/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/Kconfig | 4 ++++ include/acpi/platform/aclinux.h | 2 ++ 4 files changed, 8 insertions(+)
arch/ia64/Kconfig +1 -0
@@ -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
arch/x86/Kconfig +1 -0
@@ -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
drivers/acpi/Kconfig +4 -0
@@ -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
include/acpi/platform/aclinux.h +2 -0
@@ -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
Signature · 1 line
1.7.10.4
RFC PATCH 13/15 ACPICA: Linux: Remove <asm/acpi.h> inclusion from ACPICA headers.
In reply to Lv ZhengThis 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.
--- 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
include/acpi/platform/aclinux.h +0 -1
@@ -83,7 +83,6 @@#ifdef CONFIG_ARCH_SUPPORTS_ACPICA #include <asm/acenv.h> #endif -#include <asm/acpi.h> #ifdef CONFIG_ACPI
include/linux/acpi.h +4 -9
@@ -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) {
include/linux/acpica.h new file +22 -0
@@ -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 <[email protected]> +* +* 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 */
Signature · 1 line
1.7.10.4
RFC PATCH 14/15 ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
In reply to Lv ZhengThis patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as <linux/acpi.h> has already included it for CONFIG_ACPI=n builds.
--- include/linux/sfi_acpi.h | 3 --- 1 file changed, 3 deletions(-)
include/linux/sfi_acpi.h +0 -3
@@ -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 *))
Signature · 1 line
1.7.10.4
RFC PATCH 15/15 ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
In reply to Lv ZhengCONFIG_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 - 4 files changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +0 -1
@@ -76,7 +76,6 @@#include <linux/dmi.h> #include <linux/jiffies.h> #include <linux/workqueue.h> -#include <linux/acpi.h> #include <linux/pci_ids.h> #include <linux/thinkpad_acpi.h> #include <sound/core.h>
include/linux/thinkpad_acpi.h +2 -0
@@ -1,6 +1,8 @@#ifndef __THINKPAD_ACPI_H__#define __THINKPAD_ACPI_H__ +#include <linux/acpi.h> +/* These two functions return 0 if success, or negative error code (e g -ENODEV if no led present) */
sound/pci/hda/patch_conexant.c +0 -1
@@ -3243,7 +3243,6 @@ enum {#if IS_ENABLED (CONFIG_THINKPAD_ACPI )#include <linux/thinkpad_acpi.h> -#include <acpi/acpi.h> static int (*led_set_func)(int ,bool );
sound/pci/hda/patch_realtek.c +0 -1
@@ -3726,7 +3726,6 @@ 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> static int (*led_set_func)(int ,bool );
Signature · 1 line
1.7.10.4
RFC PATCH 15/15 ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
In reply to Lv ZhengCONFIG_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 - 4 files changed, 2 insertions(+), 3 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +0 -1
@@ -76,7 +76,6 @@#include <linux/dmi.h> #include <linux/jiffies.h> #include <linux/workqueue.h> -#include <linux/acpi.h> #include <linux/pci_ids.h> #include <linux/thinkpad_acpi.h> #include <sound/core.h>
include/linux/thinkpad_acpi.h +2 -0
@@ -1,6 +1,8 @@#ifndef __THINKPAD_ACPI_H__#define __THINKPAD_ACPI_H__ +#include <linux/acpi.h> +/* These two functions return 0 if success, or negative error code (e g -ENODEV if no led present) */
sound/pci/hda/patch_conexant.c +0 -1
@@ -3243,7 +3243,6 @@ enum {#if IS_ENABLED (CONFIG_THINKPAD_ACPI )#include <linux/thinkpad_acpi.h> -#include <acpi/acpi.h> static int (*led_set_func)(int ,bool );
sound/pci/hda/patch_realtek.c +0 -1
@@ -3726,7 +3726,6 @@ 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> static int (*led_set_func)(int ,bool );
Signature · 1 line
1.7.10.4
RFC PATCH 1/1 ACPICA: Add CONFIG_ACPI=n build test support.
In reply to Lv ZhengThis 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.
--- init/Makefile | 2 +- init/acpica.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 init/acpica.c
init/Makefile +1 -1
@@ -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
init/acpica.c new file +318 -0
318 lines not on this page · raw message
Signature · 1 line
1.7.10
Re: [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
Quoted 3 lines · Lv Zheng
CONFIG_ACPIdependent code should include <linux/acpi.h> instead of directly including <acpi/acpi.h>. This patch cleans up such wrong inclusions for Thinkpad ACPI users.
...
Quoted 4 lines
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.
Signature · 4 lines
"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
Re: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
At Wed, 18 Dec 2013 09:41:17 -0200,
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Lv Zheng
CONFIG_ACPIdependent code should include <linux/acpi.h> instead of directly including <acpi/acpi.h>. This patch cleans up such wrong inclusions for Thinkpad ACPI users....
Quoted 7 lines
Quoted 4 lines
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.
Quoted 7 lines
We might add some extra stuff to
thinkpad_acpi.hsomeday, and not everythingthinkpad_acpidoes that might be useful to export to other areas of the kernel would requireacpi.h.Looking at
patch_conexantandpatch_realtek, it might be better to actually move the "am I running on a thinkpad" stuff they useacpi.hfor intothinkpad_acpi, and provide a prototype for that inthinkpad_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
RE: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
Hi, Takashi and Henrique
Thanks for reviewing and commenting.
Quoted 27 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Takashi Iwai
Sent: Wednesday, December 18, 2013 9:06 PMAt Wed, 18 Dec 2013 09:41:17 -0200,
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Lv Zheng
CONFIG_ACPIdependent code should include <linux/acpi.h> instead of directly including <acpi/acpi.h>. This patch cleans up such wrong inclusions for Thinkpad ACPI users....
Quoted 7 lines
Quoted 4 lines
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.
Quoted 4 lines
We might add some extra stuff to
thinkpad_acpi.hsomeday, and not everythingthinkpad_acpidoes that might be useful to export to other areas of the kernel would requireacpi.h.
Quoted 8 lines
Quoted 3 lines
Looking at
patch_conexantandpatch_realtek, it might be better to actually move the "am I running on a thinkpad" stuff they useacpi.hfor intothinkpad_acpi, and provide a prototype for that inthinkpad_acpi.h.True, but we don't want to bind with
thinkpad_acpibefore 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
Quoted 8 lines
thanks,
Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [alsa-devel] [RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
At Fri, 20 Dec 2013 00:28:02 +0000,
Quoted 41 lines · Lv
Hi, Takashi and Henrique
Thanks for reviewing and commenting.
Quoted 27 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Takashi Iwai
Sent: Wednesday, December 18, 2013 9:06 PMAt Wed, 18 Dec 2013 09:41:17 -0200,
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Lv Zheng
CONFIG_ACPIdependent code should include <linux/acpi.h> instead of directly including <acpi/acpi.h>. This patch cleans up such wrong inclusions for Thinkpad ACPI users....
Quoted 7 lines
Quoted 4 lines
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.
Quoted 4 lines
We might add some extra stuff to
thinkpad_acpi.hsomeday, and not everythingthinkpad_acpidoes that might be useful to export to other areas of the kernel would requireacpi.h.Quoted 8 lines
Quoted 3 lines
Looking at
patch_conexantandpatch_realtek, it might be better to actually move the "am I running on a thinkpad" stuff they useacpi.hfor intothinkpad_acpi, and provide a prototype for that inthinkpad_acpi.h.True, but we don't want to bind with
thinkpad_acpibefore identified that it's a thinkpad, so the code needs to be in hd-audio codec driver.
Quoted 5 lines
It looks to me like that there is a relationship between two Henrique's suggestions.
His opinion is all ACPI stuff should be bound intothinkpad_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.
Quoted 4 lines
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
RFC PATCH 15/15 ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
In reply to Lv ZhengCONFIG_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.
--- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_realtek.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_conexant.c +1 -1
@@ -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 );
sound/pci/hda/patch_realtek.c +1 -1
@@ -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 );
Signature · 1 line
1.7.10
Takashi Iwai
AppliedRe: [UPDATE RFC PATCH 15/15] ACPI/thinkpad: Fix wrong <acpi/acpi.h> inclusion in Thinkpad ACPI users.
At Fri, 20 Dec 2013 16:30:42 +0800,
Quoted 5 lines · Lv Zheng
CONFIG_ACPIdependent code should include <linux/acpi.h> instead of directly including <acpi/acpi.h>. This patch cleans up such wrong inclusions for Thinkpad ACPI users.
Quoted 7 lines
Cc Henrique de Moraes Holschuh <[email protected]>Cc Jaroslav Kysela <[email protected]>Cc Takashi Iwai <[email protected]>Signed-off-by Lv Zheng <[email protected]>
Applied to sound git tree (with a different subject suffix), thanks.
Takashi
Quoted 34 lines
--- sound/pci/hda/patch_conexant.c | 2 +- sound/pci/hda/patch_realtek.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)sound/pci/hda/patch_conexant.c +1
-1@@ -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 );sound/pci/hda/patch_realtek.c +1
-1@@ -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 );Signature · 1 line
1.7.10
v2 cover ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds.
In reply to Lv ZhengThis 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(-)
Signature · 1 line
1.7.10
PATCH v2 1/7 ACPICA: Linux: Add stub support for Linux specific variables and functions.
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.
--- drivers/acpi/bus.c | 3 --- include/acpi/acpixf.h | 28 +++++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/acpi/bus.c +0 -3
@@ -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;
include/acpi/acpixf.h +17 -11
@@ -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__ */
Signature · 1 line
1.7.10
PATCH v2 2/7 ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
In reply to Lv ZhengThis 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.
--- include/acpi/platform/aclinuxex.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
include/acpi/platform/aclinuxex.h +22 -0
@@ -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 */
Signature · 1 line
1.7.10
PATCH v2 3/7 ACPICA: Linux: Add configuration item to indicate the architecture specific support.
In reply to Lv ZhengThis 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.
--- arch/ia64/Kconfig | 1 + arch/x86/Kconfig | 1 + drivers/acpi/Kconfig | 4 ++++ include/acpi/platform/aclinux.h | 2 ++ 4 files changed, 8 insertions(+)
arch/ia64/Kconfig +1 -0
@@ -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
arch/x86/Kconfig +1 -0
@@ -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
drivers/acpi/Kconfig +4 -0
@@ -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
include/acpi/platform/aclinux.h +2 -0
@@ -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
Signature · 1 line
1.7.10
PATCH v2 4/7 ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
In reply to Lv ZhengThis 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.
--- include/linux/acpi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/acpi.h +3 -3
@@ -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>
Signature · 1 line
1.7.10
PATCH v2 5/7 ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
In reply to Lv ZhengThis patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as <linux/acpi.h> has already included it for CONFIG_ACPI=n builds.
--- include/linux/sfi_acpi.h | 3 --- 1 file changed, 3 deletions(-)
include/linux/sfi_acpi.h +0 -3
@@ -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 *))
Signature · 1 line
1.7.10
Re: [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
Quoted 2 lines · Lv Zheng
This patch removes <
acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as <linux/acpi.h> has already included it forCONFIG_ACPI=nbuilds.
So are patches [1-4/5] only needed to fix this particular issue?
Quoted 29 lines
--- include/linux/sfi_acpi.h | 3 --- 1 file changed, 3 deletions(-)include/linux/sfi_acpi.h +0
-3@@ -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 *))
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
RE: [PATCH v2 5/7] ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
Hi,
Quoted 8 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Tuesday, July 08, 2014 5:25 AMQuoted 2 lines · Lv Zheng
This patch removes <
acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as <linux/acpi.h> has already included it forCONFIG_ACPI=nbuilds.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
Quoted 34 lines
Quoted 23 lines
--- include/linux/sfi_acpi.h | 3 --- 1 file changed, 3 deletions(-)include/linux/sfi_acpi.h +0
-2@@ -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 *));include/linux/sfi_acpi.h static inline int __init acpi_sfi_table_parse(char *signature, · line 81
Quoted 7 lines
include/linux/sfi_acpi.h +0
-1@@ -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.
PATCH v2 6/7 ACPI: Cleanup useless ACPI inclusion.
In reply to Lv ZhengThe sst-haswell-dsp.c is an ACPI independent file, this patch removes ACPI header files for it.
--- sound/soc/intel/sst-haswell-dsp.c | 3 --- 1 file changed, 3 deletions(-)
sound/soc/intel/sst-haswell-dsp.c +0 -3
@@ -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"
Signature · 1 line
1.7.10
Re: [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion.
Quoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis 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?
Quoted 23 lines
Signed-off-by Lv Zheng <[email protected]>Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>--- sound/soc/intel/sst-haswell-dsp.c | 3 --- 1 file changed, 3 deletions(-)sound/soc/intel/sst-haswell-dsp.c +0
-3@@ -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"
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
RE: [PATCH v2 6/7] ACPI: Cleanup useless ACPI inclusion.
Hi,
Quoted 8 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Rafael J. Wysocki
Sent: Tuesday, July 08, 2014 5:24 AMQuoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis 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
Quoted 31 lines
Quoted 14 lines
Signed-off-by Lv Zheng <[email protected]>Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>--- sound/soc/intel/sst-haswell-dsp.c | 3 --- 1 file changed, 3 deletions(-)sound/soc/intel/sst-haswell-dsp.c +0
-0sound/soc/intel/sst-haswell-dsp.c line 33
Quoted 9 lines
sound/soc/intel/sst-haswell-dsp.c +0
-3@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/7 ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
In reply to Lv ZhengAs 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.
--- drivers/acpi/acpica/Makefile | 2 +- include/acpi/platform/aclinux.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/acpi/acpica/Makefile +1 -1
@@ -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
include/acpi/platform/aclinux.h +10 -0
@@ -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
Signature · 1 line
1.7.10
v3 cover ACPICA: Enable ACPICA prototypes for CONFIG_ACPI=n builds.
In reply to Lv Zhengv3:
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(-)
Signature · 1 line
1.7.10
PATCH v3 1/7 ACPICA: Linux: Add stub support for Linux specific variables and functions.
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.
--- drivers/acpi/bus.c | 3 --- include/acpi/acpixf.h | 28 +++++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/acpi/bus.c +0 -3
@@ -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;
include/acpi/acpixf.h +17 -11
@@ -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__ */
Signature · 1 line
1.7.10
PATCH v3 2/7 ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
In reply to Lv ZhengThis 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.
--- include/acpi/platform/aclinuxex.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
include/acpi/platform/aclinuxex.h +22 -0
@@ -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 */
Signature · 1 line
1.7.10
Re: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
Quoted 9 lines · Lv Zheng
This patch adds default 64-bit mathematics in
aclinux.husingdo_div(). Asdo_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?
Quoted 43 lines
This is required by the ACPICA header stub support. ACPICA header stubs are useful to protect
CONFIG_ACPI=nLinux kernel builds where ACPICA headers are included. Lv Zheng.Signed-off-by Lv Zheng <[email protected]>--- include/acpi/platform/aclinuxex.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)include/acpi/platform/aclinuxex.h +22
-0@@ -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 */
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
RE: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
Hi, Rafael
Quoted 9 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Sunday, July 20, 2014 7:46 AM
To: Zheng, LvQuoted 4 lines · Lv Zheng
This patch adds default 64-bit mathematics in
aclinux.husingdo_div(). Asdo_div()can be used for all Linux architectures, this can also be used as stub macros for ACPICA 64-bit mathematics.
Quoted 7 lines
Quoted 5 lines
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
Quoted 48 lines
Quoted 34 lines
This is required by the ACPICA header stub support. ACPICA header stubs are useful to protect
CONFIG_ACPI=nLinux kernel builds where ACPICA headers are included. Lv Zheng.Signed-off-by Lv Zheng <[email protected]>--- include/acpi/platform/aclinuxex.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)include/acpi/platform/aclinuxex.h +15
-0@@ -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; \include/acpi/platform/aclinuxex.h line 73
Quoted 10 lines
include/acpi/platform/aclinuxex.h +7
-0+ (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.
Re: [PATCH v3 2/7] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.
Quoted 47 lines · Lv
Hi, Rafael
Quoted 9 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Sunday, July 20, 2014 7:46 AM
To: Zheng, LvQuoted 4 lines · Lv Zheng
This patch adds default 64-bit mathematics in
aclinux.husingdo_div(). Asdo_div()can be used for all Linux architectures, this can also be used as stub macros for ACPICA 64-bit mathematics.Quoted 7 lines
Quoted 5 lines
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.horacenv.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.cwhenACPI_USE_NATIVE_DIVIDEis not defined. It is used by ACPICA, so currently this is only meaningful toCONFIG_ACPIbuilds.
So kernel will not use these macros unlessCONFIG_ACPIis defined andACPI_USE_DIVIDEis not defined.For 64-bit kernels:
Ininclude/acpi/actypes.h, for ACPI_MACHINE_WIDTH=64,ACPI_USE_NATIVE_DIVIDEwill be defined, thus these macros are not used. Ininclude/acpi/platform/aclinux.h, for__KERNEL__surrounded code,ACPI_MACHINE_WIDTHis defined to beBITS_PER_LONG. So all 64-bit kernels do not use these macros.For 32-bit kernels:
As mentioned above, these macros will be used whenBITS_PER_LONGis 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:
Inarch/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.
Quoted 5 lines
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.
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
PATCH v3 3/7 ACPICA: Linux: Add support to exclude <asm/acenv.h> inclusion.
In reply to Lv ZhengThe 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.
--- 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(-)
arch/ia64/include/asm/acenv.h +0 -4
@@ -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 */
arch/x86/include/asm/acenv.h +0 -4
@@ -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 */
include/acpi/platform/aclinux.h +2 -0
@@ -70,7 +70,9 @@#ifdef EXPORT_ACPI_INTERFACES #include <linux/export.h> #endif +#ifdef CONFIG_ACPI #include <asm/acenv.h> +#endif #ifndef CONFIG_ACPI
Signature · 1 line
1.7.10
PATCH v3 4/7 ACPICA: Linux: Allow ACPICA inclusion for CONFIG_ACPI=n builds.
In reply to Lv ZhengThis 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.
--- include/linux/acpi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/acpi.h +3 -3
@@ -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>
Signature · 1 line
1.7.10
PATCH v3 5/7 ACPI/SFI: Fix wrong <acpi/acpi.h> inclusion in SFI/ACPI wrapper - table definitions.
In reply to Lv ZhengThis patch removes <acpi/acpi.h> inclusions from <linux/sfi_acpi.h> as <linux/acpi.h> has already included it for CONFIG_ACPI=n builds.
--- include/linux/sfi_acpi.h | 3 --- 1 file changed, 3 deletions(-)
include/linux/sfi_acpi.h +0 -3
@@ -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 *))
Signature · 1 line
1.7.10
PATCH v3 6/7 ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
In reply to Lv ZhengAs 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.
--- drivers/acpi/acpica/Makefile | 2 +- include/acpi/platform/aclinux.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/acpi/acpica/Makefile +1 -1
@@ -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
include/acpi/platform/aclinux.h +10 -0
@@ -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
Signature · 1 line
1.7.10
Re: [PATCH v3 6/7] ACPI: Add support to force header inclusion rules for <acpi/acpi.h>.
Hi Lv,
Quoted 6 lines · Lv Zheng
As there is only
CONFIG_ACPI=nprocessing 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
PATCH v3 7/7 ACPI: Cleanup useless ACPI inclusion.
In reply to Lv ZhengThe sst-haswell-dsp.c is an ACPI independent file, this patch removes ACPI header files for it.
--- sound/soc/intel/sst-haswell-dsp.c | 3 --- 1 file changed, 3 deletions(-)
sound/soc/intel/sst-haswell-dsp.c +0 -3
@@ -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"
Signature · 1 line
1.7.10
Re: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
Quoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis 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.
Re: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
Quoted 5 lines · Mark Brown
--5me2qT3T17SWzdxI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Quoted 7 lines
Quoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis 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
Mark Brown
maintainerRe: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Mark Brown
Quoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis 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).
RE: [PATCH v3 7/7] ACPI: Cleanup useless ACPI inclusion.
Hi,
Quoted 10 lines
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, July 17, 2014 5:35 AMQuoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Mark Brown
Quoted 2 lines · Lv Zheng
The
sst-haswell-dsp.cis an ACPI independent file, this patch removes ACPI header files for it.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
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