From 5ae74f2cc2f150c1a5cee54cabbd71dd0661285a Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Mon, 11 Apr 2016 10:13:18 +0800 Subject: ACPI / tables: Move table override mechanisms to tables.c This patch moves acpi_os_table_override() and acpi_os_physical_table_override() to tables.c. Along with the mechanisms, acpi_initrd_initialize_tables() is also moved to tables.c to form a static function. The following functions are renamed according to this change: 1. acpi_initrd_override() -> renamed to early_acpi_table_init(), which invokes acpi_table_initrd_init() 2. acpi_os_physical_table_override() -> which invokes acpi_table_initrd_override() 3. acpi_initialize_initrd_tables() -> renamed to acpi_table_initrd_scan() Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/linux/acpi.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'include/linux/acpi.h') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 06ed7e5..7718c04 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -190,14 +190,6 @@ static inline int acpi_debugger_notify_command_complete(void) } #endif -#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE -void acpi_initrd_override(void *data, size_t size); -#else -static inline void acpi_initrd_override(void *data, size_t size) -{ -} -#endif - #define BAD_MADT_ENTRY(entry, end) ( \ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) @@ -216,6 +208,7 @@ void acpi_boot_table_init (void); int acpi_mps_check (void); int acpi_numa_init (void); +void early_acpi_table_init(void *data, size_t size); int acpi_table_init (void); int acpi_table_parse(char *id, acpi_tbl_table_handler handler); int __init acpi_parse_entries(char *id, unsigned long table_size, @@ -596,6 +589,7 @@ static inline const char *acpi_dev_name(struct acpi_device *adev) return NULL; } +static inline void early_acpi_table_init(void *data, size_t size) { } static inline void acpi_early_init(void) { } static inline void acpi_subsystem_init(void) { } -- cgit v1.1 From e10cfdc33a0f23dc8449be7267f0a642e96a2a24 Mon Sep 17 00:00:00 2001 From: Chen Yu Date: Tue, 3 May 2016 16:48:39 +0800 Subject: ACPI / osi: Fix default _OSI(Darwin) support The following commit always reports positive value when Apple hardware queries _OSI("Darwin"): Commit: 7bc5a2bad0b8d9d1ac9f7b8b33150e4ddf197334 Subject: ACPI: Support _OSI("Darwin") correctly However since this implementation places the judgement in runtime, it breaks acpi_osi=!Darwin and cannot return unsupported for _OSI("WinXXX") invoked before invoking _OSI("Darwin"). This patch fixes the issues by reverting the wrong support and implementing the default behavior of _OSI("Darwin")/_OSI("WinXXX") on Apple hardware via DMI matching. Fixes: 7bc5a2bad0b8 (ACPI: Support _OSI("Darwin") correctly) Link: https://bugzilla.kernel.org/show_bug.cgi?id=92111 Reported-and-tested-by: Lukas Wunner Signed-off-by: Chen Yu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/linux/acpi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/acpi.h') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 06ed7e5..6c7176e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -360,6 +360,7 @@ extern char acpi_video_backlight_string[]; extern long acpi_is_video_device(acpi_handle handle); extern int acpi_blacklisted(void); extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); +extern void acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d); extern void acpi_osi_setup(char *str); extern bool acpi_osi_is_win8(void); -- cgit v1.1 From dc45eb20a83d11ed649169fbe9159ed6bf586c88 Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Tue, 3 May 2016 16:48:46 +0800 Subject: ACPI / osi: Cleanup OSI handling code to use bool This patch changes "int/unsigned int" to "bool" to simplify the code. Tested-by: Lukas Wunner Tested-by: Chen Yu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/linux/acpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux/acpi.h') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6c7176e..0ccfeba 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -359,8 +359,8 @@ extern bool wmi_has_guid(const char *guid); extern char acpi_video_backlight_string[]; extern long acpi_is_video_device(acpi_handle handle); extern int acpi_blacklisted(void); -extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); -extern void acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d); +extern void acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d); +extern void acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d); extern void acpi_osi_setup(char *str); extern bool acpi_osi_is_win8(void); -- cgit v1.1 From d5a91d74c6d7da2cebadbb9f2d03e56f84d7be62 Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Tue, 3 May 2016 16:48:53 +0800 Subject: ACPI / osi: Cleanup coding style issues before creating a separate OSI source file This patch performs necessary cleanups before moving OSI support to another file. 1. Change printk into pr_xxx 2. Do not initialize values to 0 3. Do not append additional "return" at the end of the function 4. Remove useless comments which may easily break line breaking rule After fixing the coding style issues, rename functions to make them looking like acpi_osi_xxx. No functional changes. Tested-by: Lukas Wunner Tested-by: Chen Yu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/linux/acpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux/acpi.h') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 0ccfeba..bf0adc6 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -359,8 +359,8 @@ extern bool wmi_has_guid(const char *guid); extern char acpi_video_backlight_string[]; extern long acpi_is_video_device(acpi_handle handle); extern int acpi_blacklisted(void); -extern void acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d); -extern void acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d); +extern void acpi_osi_dmi_linux(bool enable, const struct dmi_system_id *d); +extern void acpi_osi_dmi_darwin(bool enable, const struct dmi_system_id *d); extern void acpi_osi_setup(char *str); extern bool acpi_osi_is_win8(void); -- cgit v1.1 From e5f660ebef68e3ed1a988ad06ba23562153cee5c Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Tue, 3 May 2016 16:49:01 +0800 Subject: ACPI / osi: Collect _OSI handling into one single file _OSI handling code grows giant and it's time to move them into one file. This patch collects all _OSI handling code into one single file. So that we only have the following functions to be used externally: early_acpi_osi_init(): Used by DMI detections; acpi_osi_init(): Used to initialize OSI command line settings and install Linux specific _OSI handler; acpi_osi_setup(): The API that should be used by the external quirks. acpi_osi_is_win8(): The API is used by the external drivers to determine if BIOS supports Win8. CONFIG_DMI is not useful as stub dmi_check_system() can make everything stub because of strip. No functional changes. Tested-by: Lukas Wunner Tested-by: Chen Yu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/linux/acpi.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux/acpi.h') diff --git a/include/linux/acpi.h b/include/linux/acpi.h index bf0adc6..58f707a 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -359,8 +359,6 @@ extern bool wmi_has_guid(const char *guid); extern char acpi_video_backlight_string[]; extern long acpi_is_video_device(acpi_handle handle); extern int acpi_blacklisted(void); -extern void acpi_osi_dmi_linux(bool enable, const struct dmi_system_id *d); -extern void acpi_osi_dmi_darwin(bool enable, const struct dmi_system_id *d); extern void acpi_osi_setup(char *str); extern bool acpi_osi_is_win8(void); -- cgit v1.1