ACPI / osi: Fix several issues in _OSI handling
Subsystems (2)
cover ACPI / osi: Fix several issues in _OSI handling
This patchset cleans up _OSI handling code and fixes several issues in it.
Chen Yu (1):
ACPI / osi: Change default _OSI(Darwin) support
Lv Zheng (3):
ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA
internal strings
ACPI / osi: Cleanup _OSI("Linux") related code before introducing new
support
ACPI / osi: Collect _OSI handling into one single file
Documentation/kernel-parameters.txt | 2 + drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 196 +------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 521 +++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 228 +-------------- include/linux/acpi.h | 1 - 7 files changed, 533 insertions(+), 419 deletions(-) create mode 100644 drivers/acpi/osi.c
Signature · 1 line
1.7.10
PATCH 1/4 ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
The order of the _OSI related functionalities is as follows:
acpi_blacklisted()
acpi_dmi_osi_linux()
acpi_osi_setup()
acpi_osi_setup()
acpi_update_interfaces() if "!*" <<<<<<<<<<<<<<<<<<<<<<<<
parse_args()
__setup("acpi_osi=")
acpi_osi_setup_linux()
acpi_update_interfaces() if "!*"
<<<<<<<<<<<<<<<<<<<<<<<<
acpi_early_init()
acpi_initialize_subsystem()
acpi_ut_initialize_interfaces()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ acpi_bus_init()
acpi_os_initialize1()
acpi_install_interface_handler(acpi_osi_handler) acpi_osi_setup_late()
acpi_update_interfaces() for "!" >>>>>>>>>>>>>>>>>>>>>>>>
acpi_osi_handler()
Since acpi_osi_setup_linux() can override acpi_dmi_osi_linux(), the command line setting can override the DMI detection. That's why acpi_blacklisted() is put before __setup("acpi_osi=").
Then we can notice the following wrong invocation order. There are acpi_update_interfaces() (marked by <<<<) calls invoked before acpi_ut_initialize_interfaces() (marked by ^^^^). This makes it impossible to use acpi_osi=!* correctly from OSI DMI table or from the command line. The use of acpi_osi=!* is meant to disable both ACPICA (acpi_gbl_supported_interfaces) and Linux specific strings (osi_setup_entries) while the ACPICA part should have stopped working because of the order issue.
This patch fixes this issue by moving acpi_update_interfaces() to where it is invoked for acpi_osi=! (marked by >>>>) as this is ensured to be invoked after acpi_ut_initialize_interfaces() (marked by ^^^^). Linux specific strings are still handled in the original place in order to make the following command line working: acpi_osi=!* acpi_osi="Module Device".
Note that since acpi_osi=!* is meant to further disable linux specific string comparing to the acpi_osi=!, there is no such use case in our bug fixing work and hence there is no one using acpi_osi=!* either from the command line or from the DMI quirks, this issue is just a theoretical issue.
--- drivers/acpi/osl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/acpi/osl.c +11 -5
@@ -135,7 +135,7 @@ static struct osi_linux { unsigned int enable:1; unsigned int dmi:1; unsigned int cmdline:1; - unsigned int default_disabling:1; +u8 default_disabling; } osi_linux = {0, 0, 0, 0};static u32 acpi_osi_handler (acpi_string interface,u32 supported)
@@ -1477,10 +1477,13 @@ void __init acpi_osi_setup(char *str)if (*str =='!' ) { str++;if (*str =='\0' ) { - osi_linux.default_disabling =1 ; +/* Do not override acpi_osi=!* */ +if (!osi_linux.default_disabling) + osi_linux.default_disabling = +ACPI_DISABLE_ALL_VENDOR_STRINGS ;return ; }else if (*str =='*' ) { -acpi_update_interfaces (ACPI_DISABLE_ALL_STRINGS ); + osi_linux.default_disabling =ACPI_DISABLE_ALL_STRINGS ;for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) { osi = &osi_setup_entries[i]; osi->enable = false;
@@ -1553,10 +1556,13 @@ static void __init acpi_osi_setup_late(void)acpi_status status;if (osi_linux.default_disabling) { - status =acpi_update_interfaces (ACPI_DISABLE_ALL_VENDOR_STRINGS ); + status =acpi_update_interfaces (osi_linux.default_disabling);if (ACPI_SUCCESS (status)) - printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n"); + printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", + osi_linux.default_disabling == +ACPI_DISABLE_ALL_STRINGS ? +" and feature groups" :"" ); }for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) {
Signature · 1 line
1.7.10
PATCH 2/4 ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
In reply to Lv ZhengThis patch cleans up OSI code in osl.c in order to make osi_linux not _OSI("Linux") specific to allow new features to reuse this structure.
--- drivers/acpi/blacklist.c | 2 +- drivers/acpi/osl.c | 83 +++++++++++++++++++--------------------------- include/linux/acpi.h | 2 +- 3 files changed, 36 insertions(+), 51 deletions(-)
drivers/acpi/blacklist.c +1 -1
@@ -135,7 +135,7 @@ int __init acpi_blacklisted(void)#ifdef CONFIG_DMI static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) { -acpi_dmi_osi_linux (1 , d);/* enable */ +acpi_dmi_osi_linux (true, d);/* enable */ return 0 ; }static int __init dmi_disable_osi_vista (const struct dmi_system_id *d)
drivers/acpi/osl.c +34 -49
157 lines not on this page · raw message
include/linux/acpi.h +1 -1
@@ -353,7 +353,7 @@ 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_linux (bool enable,const struct dmi_system_id *d);extern void acpi_osi_setup (char *str);extern bool acpi_osi_is_win8 (void );
Signature · 1 line
1.7.10
Rafael J. Wysocki
maintainerRe: [PATCH 2/4] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
Quoted 2 lines · Lv Zheng
This patch cleans up OSI code in
osl.cin order to makeosi_linuxnot_OSI("Linux")specific to allow new features to reuse this structure.
I guess what you mean here is something like:
Clean up OSI code in osl.c to make osi_linux work for OSI strings other than "Linux", so it can be re-used for other purposes.
Is that correct?
RE: [PATCH 2/4] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
Hi, Rafael
Quoted 10 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Rafael J. Wysocki
Sent: Wednesday, April 27, 2016 4:11 AM
Subject: Re: [PATCH 2/4] ACPI / osi: Cleanup_OSI("Linux")related code before introducing new supportQuoted 2 lines · Lv Zheng
This patch cleans up OSI code in
osl.cin order to makeosi_linuxnot_OSI("Linux")specific to allow new features to reuse this structure.
Quoted 6 lines
I guess what you mean here is something like:
Clean up OSI code in
osl.cto makeosi_linuxwork for OSI strings other than "Linux", so it can be re-used for other purposes.Is that correct?
[Lv Zheng]
Exactly!
Thanks
-Lv
PATCH 3/4 ACPI / osi: Change default _OSI(Darwin) support
In reply to Lv ZhengFrom: Chen Yu <[email protected]>
Commit 7bc5a2bad0b8 ("ACPI: Support _OSI("Darwin") correctly") always reports positive value when Apple hardware queries _OSI("Darwin"). 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.
--- Documentation/kernel-parameters.txt | 2 ++ drivers/acpi/blacklist.c | 23 ++++++++++++++++ drivers/acpi/osl.c | 49 ++++++++++++++++++++++++++++++----- include/linux/acpi.h | 1 + 4 files changed, 68 insertions(+), 7 deletions(-)
Documentation/kernel-parameters.txt +2 -0
@@ -312,6 +312,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. acpi_osi=!* # remove all strings acpi_osi=! # disable all built-in OS vendor strings + acpi_osi=!! # enable all built-in OS vendor + strings acpi_osi= # disable all strings 'acpi_osi=!' can be used in combination with single or
drivers/acpi/blacklist.c +23 -0
@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (true, d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (true, d);/* enable */
@@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."), + }, + }, + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE /* * DELL XPS 13 (2015) switches sound between HDA and I2S
drivers/acpi/osl.c +42 -7
79 lines not on this page · raw message
include/linux/acpi.h +1 -0
@@ -354,6 +354,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 (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 );
Signature · 1 line
1.7.10
Rafael J. Wysocki
maintainerRe: [PATCH 3/4] ACPI / osi: Change default _OSI(Darwin) support
Quoted 8 lines · Lv Zheng
From: Chen Yu <[email protected]>
Commit
7bc5a2bad0b8("ACPI: Support_OSI("Darwin")correctly") always reports positive value when Apple hardware queries_OSI("Darwin"). 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").
Quoted 8 lines
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.
Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>
Why don't you add a Fixes tag pointing to the problematic commit?
RE: [PATCH 3/4] ACPI / osi: Change default _OSI(Darwin) support
Hi,
Quoted 17 lines
From: [email protected] [mailto:[email protected]] On Behalf Of Rafael J. Wysocki
Sent: Wednesday, April 27, 2016 4:13 AM
Subject: Re: [PATCH 3/4] ACPI / osi: Change default_OSI(Darwin)supportQuoted 10 lines · Lv Zheng
From: Chen Yu <[email protected]>
Commit
7bc5a2bad0b8("ACPI: Support_OSI("Darwin")correctly") always reports positive value when Apple hardware queries_OSI("Darwin"). 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
Quoted 8 lines
Quoted 6 lines
DMI matching.
Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>Why don't you add a Fixes tag pointing to the problematic commit?
[Lv Zheng]
OK, I'll help to add it and re-send an UPDATE for this patch.
Thanks
-Lv
PATCH 4/4 ACPI / osi: Collect _OSI handling into one single file
In reply to Lv Zheng_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.
--- drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 219 +------------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 521 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 252 +--------------------- include/linux/acpi.h | 2 - 6 files changed, 530 insertions(+), 468 deletions(-) create mode 100644 drivers/acpi/osi.c
drivers/acpi/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_ACPI) += acpi.o \ acpica/ # All the builtin files are in the "acpi." module_param namespace. -acpi-y += osl.o utils.o reboot.o +acpi-y += osi.o osl.o utils.o reboot.o acpi-y += nvs.o # Power management related files
drivers/acpi/blacklist.c +5 -214
247 lines not on this page · raw message
drivers/acpi/internal.h +2 -0
@@ -20,6 +20,8 @@#define PREFIX "ACPI: " +int early_acpi_osi_init (void ); +int acpi_osi_init (void );acpi_status acpi_os_initialize1 (void );void init_acpi_device_notify (void );int acpi_scan_init (void );
drivers/acpi/osi.c new file +521 -0
521 lines not on this page · raw message
drivers/acpi/osl.c +1 -251
276 lines not on this page · raw message
include/linux/acpi.h +0 -2
@@ -353,8 +353,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_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 );
Signature · 1 line
1.7.10
v2 cover ACPI / osi: Fix several issues in _OSI handling
In reply to Lv ZhengThis patchset cleans up _OSI handling code and fixes several issues in it.
In the v2 version, as one fix has been changed to be a stable material, patches originally put before it need to be rebased. The necessary changes that are required by this fix are still kept before the fix patch, and the unnecessary changes that are not required by this fix are moved after the fix patch. So that the back porting of the stable materials could be easier. The coding style in the stable materials is kept wrong to be consistent to the coding style used by the old code, so checkpatch.pl may report warnings on the stable materials.
Chen Yu (1):
ACPI / osi: Fix default _OSI(Darwin) support
Lv Zheng (5):
ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA
internal strings
ACPI / osi: Cleanup _OSI("Linux") related code before introducing new
support
ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! ACPI / osi: Cleanup coding style issues before creating a separate
OSI source file
ACPI / osi: Collect _OSI handling into one single file
Documentation/kernel-parameters.txt | 2 + drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 196 +------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 518 +++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 228 +-------------- include/linux/acpi.h | 1 - 7 files changed, 530 insertions(+), 419 deletions(-) create mode 100644 drivers/acpi/osi.c
Signature · 1 line
1.7.10
PATCH v2 1/6 ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
The order of the _OSI related functionalities is as follows:
acpi_blacklisted()
acpi_dmi_osi_linux()
acpi_osi_setup()
acpi_osi_setup()
acpi_update_interfaces() if "!*" <<<<<<<<<<<<<<<<<<<<<<<<
parse_args()
__setup("acpi_osi=")
acpi_osi_setup_linux()
acpi_update_interfaces() if "!*"
<<<<<<<<<<<<<<<<<<<<<<<<
acpi_early_init()
acpi_initialize_subsystem()
acpi_ut_initialize_interfaces()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ acpi_bus_init()
acpi_os_initialize1()
acpi_install_interface_handler(acpi_osi_handler) acpi_osi_setup_late()
acpi_update_interfaces() for "!" >>>>>>>>>>>>>>>>>>>>>>>>
acpi_osi_handler()
Since acpi_osi_setup_linux() can override acpi_dmi_osi_linux(), the command line setting can override the DMI detection. That's why acpi_blacklisted() is put before __setup("acpi_osi=").
Then we can notice the following wrong invocation order. There are acpi_update_interfaces() (marked by <<<<) calls invoked before acpi_ut_initialize_interfaces() (marked by ^^^^). This makes it impossible to use acpi_osi=!* correctly from OSI DMI table or from the command line. The use of acpi_osi=!* is meant to disable both ACPICA (acpi_gbl_supported_interfaces) and Linux specific strings (osi_setup_entries) while the ACPICA part should have stopped working because of the order issue.
This patch fixes this issue by moving acpi_update_interfaces() to where it is invoked for acpi_osi=! (marked by >>>>) as this is ensured to be invoked after acpi_ut_initialize_interfaces() (marked by ^^^^). Linux specific strings are still handled in the original place in order to make the following command line working: acpi_osi=!* acpi_osi="Module Device".
Note that since acpi_osi=!* is meant to further disable linux specific string comparing to the acpi_osi=!, there is no such use case in our bug fixing work and hence there is no one using acpi_osi=!* either from the command line or from the DMI quirks, this issue is just a theoretical issue.
--- drivers/acpi/osl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/acpi/osl.c +11 -5
@@ -135,7 +135,7 @@ static struct osi_linux { unsigned int enable:1; unsigned int dmi:1; unsigned int cmdline:1; - unsigned int default_disabling:1; +u8 default_disabling; } osi_linux = {0, 0, 0, 0};static u32 acpi_osi_handler (acpi_string interface,u32 supported)
@@ -1477,10 +1477,13 @@ void __init acpi_osi_setup(char *str)if (*str =='!' ) { str++;if (*str =='\0' ) { - osi_linux.default_disabling =1 ; +/* Do not override acpi_osi=!* */ +if (!osi_linux.default_disabling) + osi_linux.default_disabling = +ACPI_DISABLE_ALL_VENDOR_STRINGS ;return ; }else if (*str =='*' ) { -acpi_update_interfaces (ACPI_DISABLE_ALL_STRINGS ); + osi_linux.default_disabling =ACPI_DISABLE_ALL_STRINGS ;for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) { osi = &osi_setup_entries[i]; osi->enable = false;
@@ -1553,10 +1556,13 @@ static void __init acpi_osi_setup_late(void)acpi_status status;if (osi_linux.default_disabling) { - status =acpi_update_interfaces (ACPI_DISABLE_ALL_VENDOR_STRINGS ); + status =acpi_update_interfaces (osi_linux.default_disabling);if (ACPI_SUCCESS (status)) - printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n"); + printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", + osi_linux.default_disabling == +ACPI_DISABLE_ALL_STRINGS ? +" and feature groups" :"" ); }for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) {
Signature · 1 line
1.7.10
PATCH v2 2/6 ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
In reply to Lv ZhengThis patch cleans up OSI code in osl.c to make osi_linux work for OSI strings other than "Linux", so it can be re-used for other purposes.
--- drivers/acpi/osl.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
drivers/acpi/osl.c +22 -20
@@ -131,12 +131,12 @@ static void __init acpi_osi_setup_late(void);* or boot with "acpi_osi=Linux" */ -static struct osi_linux { -unsigned int enable:1 ; -unsigned int dmi:1 ; -unsigned int cmdline:1 ; +static struct acpi_osi_config { +unsigned int linux_enable:1 ; +unsigned int linux_dmi:1 ; +unsigned int linux_cmdline:1 ;u8 default_disabling; -} osi_linux = {0 ,0 ,0 ,0 }; +} osi_config = {0 ,0 ,0 ,0 };static u32 acpi_osi_handler (acpi_string interface,u32 supported) {
@@ -144,9 +144,9 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported) printk_once(KERN_NOTICE FW_BUG PREFIX"BIOS _OSI(Linux) query %s%s\n" , - osi_linux.enable ?"honored" :"ignored" , - osi_linux.cmdline ?" via cmdline" : - osi_linux.dmi ? " via DMI" : ""); + osi_config.linux_enable ?"honored" :"ignored" , + osi_config.linux_cmdline ?" via cmdline" : + osi_config.linux_dmi ? " via DMI" : ""); }if (!strcmp ("Darwin" , interface)) {
@@ -1478,12 +1478,12 @@ void __init acpi_osi_setup(char *str) str++;if (*str =='\0' ) {/* Do not override acpi_osi=!* */ -if (!osi_linux.default_disabling) - osi_linux.default_disabling = +if (!osi_config.default_disabling) + osi_config.default_disabling =ACPI_DISABLE_ALL_VENDOR_STRINGS ;return ; }else if (*str =='*' ) { - osi_linux.default_disabling =ACPI_DISABLE_ALL_STRINGS ; + osi_config.default_disabling =ACPI_DISABLE_ALL_STRINGS ;for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) { osi = &osi_setup_entries[i]; osi->enable = false;
@@ -1508,10 +1508,10 @@ void __init acpi_osi_setup(char *str)static void __init set_osi_linux (unsigned int enable) { -if (osi_linux.enable != enable) - osi_linux.enable = enable; +if (osi_config.linux_enable != enable) + osi_config.linux_enable = enable; -if (osi_linux.enable) +if (osi_config.linux_enable)acpi_osi_setup ("Linux" );else acpi_osi_setup ("!Linux" );
@@ -1521,8 +1521,9 @@ static void __init set_osi_linux(unsigned int enable)static void __init acpi_cmdline_osi_linux (unsigned int enable) { - osi_linux.cmdline =1 ;/* cmdline set the default and override DMI */ - osi_linux.dmi =0 ; +/* cmdline set the default and override DMI */ + osi_config.linux_cmdline =1 ; + osi_config.linux_dmi =0 ;set_osi_linux (enable);return ;
@@ -1535,7 +1536,8 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)if (enable ==-1 )return ; - osi_linux.dmi =1 ;/* DMI knows that this box asks OSI(Linux) */ +/* DMI knows that this box asks OSI(Linux) */ + osi_config.linux_dmi =1 ;set_osi_linux (enable);return ;
@@ -1555,12 +1557,12 @@ static void __init acpi_osi_setup_late(void)int i;acpi_status status; -if (osi_linux.default_disabling) { - status =acpi_update_interfaces (osi_linux.default_disabling); +if (osi_config.default_disabling) { + status =acpi_update_interfaces (osi_config.default_disabling);if (ACPI_SUCCESS (status)) printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", - osi_linux.default_disabling == + osi_config.default_disabling ==ACPI_DISABLE_ALL_STRINGS ?" and feature groups" :"" ); }
Signature · 1 line
1.7.10
PATCH v2 3/6 ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=!
In reply to Lv ZhengThis patch introduces acpi_osi=!! so that quirks may use it to revert acpi_osi=!.
--- Documentation/kernel-parameters.txt | 2 ++ drivers/acpi/osl.c | 3 +++ 2 files changed, 5 insertions(+)
Documentation/kernel-parameters.txt +2 -0
@@ -312,6 +312,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. acpi_osi=!* # remove all strings acpi_osi=! # disable all built-in OS vendor strings + acpi_osi=!! # enable all built-in OS vendor + strings acpi_osi= # disable all strings 'acpi_osi=!' can be used in combination with single or
drivers/acpi/osl.c +3 -0
@@ -1489,6 +1489,9 @@ void __init acpi_osi_setup(char *str) osi->enable = false; }return ; + }else if (*str =='!' ) { + osi_config.default_disabling =0 ; +return ; } enable = false; }
Signature · 1 line
1.7.10
PATCH v2 4/6 ACPI / osi: Fix default _OSI(Darwin) support
In reply to Lv ZhengFrom: Chen Yu <[email protected]>
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.
--- drivers/acpi/blacklist.c | 23 ++++++++++++++++++ drivers/acpi/osl.c | 58 ++++++++++++++++++++++++++++++++++++++++------ include/linux/acpi.h | 1 + 3 files changed, 75 insertions(+), 7 deletions(-)
drivers/acpi/blacklist.c +23 -0
@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (1 , d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (1 , d);/* enable */
@@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."), + }, + }, + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE /* * DELL XPS 13 (2015) switches sound between HDA and I2S
drivers/acpi/osl.c +51 -7
82 lines not on this page · raw message
include/linux/acpi.h +1 -0
@@ -354,6 +354,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 );
Signature · 1 line
1.7.10
RE: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Hi Lv,
Quoted 63 lines
-----Original Message-----
From: Zheng, Lv
Sent: Wednesday, April 27, 2016 4:55 PM
To: Wysocki, Rafael J; Rafael J. Wysocki; Brown, Len
Cc: Zheng, Lv; Lv Zheng; [email protected]; linux- [email protected]; Chen, Yu C
Subject: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportFrom: Chen Yu <[email protected]>
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")Cc <[email protected]> # 3.18+Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>--- drivers/acpi/blacklist.c | 23 ++++++++++++++++++ drivers/acpi/osl.c | 58 ++++++++++++++++++++++++++++++++++++++++--- --- include/linux/acpi.h | 1 + 3 files changed, 75 insertions(+), 7 deletions(-)drivers/acpi/blacklist.c index renamed from drivers/acpi/blacklist.c +0
-096809cd..e947d3e 100644
drivers/acpi/blacklist.c +13
-0@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (1 , d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (1 , d);/* enable */ @@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."),
drivers/acpi/blacklist.c static struct dmi_system_id acpi_osi_dmi_table[] · line 357
Quoted 10 lines
drivers/acpi/blacklist.c +10
-0+ }, + }, + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, +
The vendor id should be 'Apple Inc.' and 'Apple Computer, Inc.' instead.
thanks,
yu
Re: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Quoted 68 lines · Yu C
Hi Lv,
Quoted 66 lines
-----Original Message-----
From: Zheng, Lv
Sent: Wednesday, April 27, 2016 4:55 PM
To: Wysocki, Rafael J; Rafael J. Wysocki; Brown, Len
Cc: Zheng, Lv; Lv Zheng; [email protected]; linux- [email protected]; Chen, Yu C
Subject: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportFrom: Chen Yu <[email protected]>
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")Cc <[email protected]> # 3.18+Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>--- drivers/acpi/blacklist.c | 23 ++++++++++++++++++ drivers/acpi/osl.c | 58 ++++++++++++++++++++++++++++++++++++++++--- --- include/linux/acpi.h | 1 + 3 files changed, 75 insertions(+), 7 deletions(-)drivers/acpi/blacklist.c index renamed from drivers/acpi/blacklist.c +0
-096809cd..e947d3e 100644
drivers/acpi/blacklist.c +16
-0@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (1 , d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (1 , d);/* enable */ @@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."), + }, + }, + {
Quoted 8 lines
drivers/acpi/blacklist.c static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { · line 356
Quoted 7 lines
drivers/acpi/blacklist.c +7
-0+ .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, +The vendor id should be 'Apple Inc.' and 'Apple Computer, Inc.' instead.
If this is the only problem with this patch, I can fix it up. No need to resend.
Thanks,
Rafael
RE: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Hi,
Quoted 80 lines
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Rafael J. Wysocki
Subject: Re: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportQuoted 12 lines · Yu C
Hi Lv,
Quoted 10 lines
From: Zheng, Lv
Subject: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportFrom: Chen Yu <[email protected]>
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 breaksacpi_osi=!Darwin
Quoted 5 lines
Quoted 5 lines
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
Quoted 11 lines
Quoted 11 lines
DMI matching.
Fixes 7bc5a2bad0b8 ("ACPI: Support _OSI("Darwin") correctly")Cc <[email protected]> # 3.18+Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>--- drivers/acpi/blacklist.c | 23 ++++++++++++++++++ drivers/acpi/osl.c | 58++++++++++++++++++++++++++++++++++++++++---
Quoted 35 lines
Quoted 35 lines
--- include/linux/acpi.h | 1 + 3 files changed, 75 insertions(+), 7 deletions(-)drivers/acpi/blacklist.c index renamed from drivers/acpi/blacklist.c +0
-096809cd..e947d3e 100644
drivers/acpi/blacklist.c +16
-0@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (1 , d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (1 , d);/* enable */ @@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."), + }, + }, + {Quoted 8 lines
drivers/acpi/blacklist.c static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { · line 356
Quoted 7 lines
drivers/acpi/blacklist.c +7
-0+ .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, +The vendor id should be 'Apple Inc.' and 'Apple Computer, Inc.' instead.
Quoted 1 line
If this is the only problem with this patch, I can fix it up. No need to resend.
[Lv Zheng]
This is the only problem.
Thanks for the help.
Best regards
-Lv
Quoted 8 lines
Thanks,
Rafael--
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: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Hi, Rafael
Quoted 4 lines
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Zheng, Lv
Subject: RE: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)support
[Lv Zheng]
Skip.
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 13 lines
drivers/acpi/blacklist.c +8
-0@@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple INC."),drivers/acpi/blacklist.c static struct dmi_system_id acpi_osi_dmi_table[] · line 357
Quoted 10 lines
drivers/acpi/blacklist.c +10
-0+ }, + }, + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, INC."), + }, + }, +The vendor id should be 'Apple Inc.' and 'Apple Computer, Inc.' instead.
Quoted 5 lines
Quoted 1 line
If this is the only problem with this patch, I can fix it up. No need to resend.
[Lv Zheng]
This is the only problem.
Thanks for the help.
[Lv Zheng]
I just sent UPDATE of PATCH 4/6 and PATCH 6/6 to the mailing list with this corrected.
I was hoping they could update patchwork content so that the Bugzilla reporters might use the updated patches for confirmation. The Message-Id(s) of the 2 patches were kept as same as the old ones.
Thanks and best regards
-Lv
Re: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Hi Lv Zheng,
Quoted 5 lines · Lv
I just sent UPDATE of PATCH 4/6 and PATCH 6/6 to the mailing list with this corrected.
I was hoping they could update patchwork content so that the Bugzilla reporters might use the updated patches for confirmation.
The Message-Id(s) of the 2 patches were kept as same as the old ones.
As promised on Bugzilla I've tested v2 of this series (with the "INC" manually fixed up) on a MacBookPro9,1.
I only reviewed the patches in a superficial fashion, but one issue I've noticed is that
#define pr_fmt(fmt) "ACPI: " fmt
is missing in osi.c (patch [6/6]).
Without command line arguments, Linux responds yay to _OSI("Darwin") and nothing else and the Thunderbolt controller is powered up.
With "acpi_osi=!Darwin", Linux responds nay to everything and the Thunderbolt controller is powered down.
So it seems to work as intended. If you want me to test anything else please let me know.
Thanks,
Lukas
RE: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
Hi, Lukas
First, thanks for the test. :)
Quoted 15 lines
From: Lukas Wunner [mailto:[email protected]]
Subject: Re: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportHi Lv Zheng,
Quoted 5 lines · Lv
I just sent UPDATE of PATCH 4/6 and PATCH 6/6 to the mailing list with this corrected.
I was hoping they could update patchwork content so that the Bugzilla reporters might use the updated patches for confirmation.
The Message-Id(s) of the 2 patches were kept as same as the old ones.As promised on Bugzilla I've tested v2 of this series (with the "INC" manually fixed up) on a MacBookPro9,1.
Quoted 6 lines
I only reviewed the patches in a superficial fashion, but one issue I've noticed is that
#define
pr_fmt(fmt)"ACPI: " fmtis missing in
osi.c(patch [6/6]).
[Lv Zheng]
This is a bug of internal.h.
I've been suffering from this in several my patches.
And people working for ACPI subsystem have been suffering from this for decades... Sometimes we have to use printk(KERN_xxx PREFIX) here while checkpatch.pl complains coding style issues. You comment makes it a good chance to escalate this issue to the maintainers.
This is a bug of internal.h because:
1. checkpatch.pl enforces pr_xxx() instead of printk(KERN_xxx...)
2. pr_xxx() macro is meant to eliminate KERN_xxx prefixes.
3. kernel provides pr_fmt(fmt) to allow drivers to add their own prefixes when pr_xxx() macros are used.
4. internal.h defines PREFIX for all ACPI drivers but doesn't provide the mean for the drivers to hide this prefix in pr_xxx() macros. So this becomes a trap where developers can easily make mistakes.
Concluded from the point 1, 2, 3, the following code is wrong:
In drivers/acpi/osl.c:
printk(KERN_ERR PREFIX "Cannot map memory that high\n");
printk(KERN_ERR PREFIX should be replaced by pr_fmt(
Concluded from the point 2, 3, the following code is wrong:
In drivers/acpi/osl.c:
pr_info("ACPI: static SSDT installation disabled\n");
pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);The PREFIX should be handled by pr_fmt().
Concluded from the point 3, 4, the following code is wrong:
In drivers/acpi/tables.c:
#define pr_fmt(fmt) "ACPI: " fmt
This should be handled by internal.h by default.
So in fact, my patch is written correctly on top of the assumption that the PREFIX have already been handled by internal.h not osi.c...
IMO, there are several ways to fix this long term issue:
1. Fix it with post-override:
This might be done in internal.h
We may
#ifndef PREFIX
#define PREFIX "ACPI: "
#endif
#undef pr_fmt
#define pr_fmt(fmt) PREFIX fmt
This enforces ec.c to be changed to define PREFIX instead of pr_fmt() which is not developers friendly as developers are trained to use pre-override for pr_fmt().
2. Fix it using pre-override:
The above fix looks a little bit confusing because the pr_fmt() is meant to be defined before including <linux/printk.h> In internal.h:
#ifndef pr_fmt
#define pr_fmt(fmt) "ACPI: " fmt
#endif
#include <linux/xxxx.h>
...
In drivers/acpi/xxx.c, making internal.h the first one included by these files, so that they can override pr_fmt. For example, in ec.c:
#define pr_fmt(fmt) "ACPI: EC: " fmt
#include "internal.h"
#include <linux/xxx.h>
It's hard for me to make a decision.
So I probably still have to work with this code quality issue and refresh this patchset. Possibly I will still make same mistakes in the future.
Anyway, this is a chance for me to add your "Reported-and-tested-by:". :-)
Quoted 9 lines
Without command line arguments, Linux responds yay to
_OSI("Darwin")and nothing else and the Thunderbolt controller is powered up.With "acpi_osi=!Darwin", Linux responds nay to everything and the Thunderbolt controller is powered down.
So it seems to work as intended. If you want me to test anything else please let me know.
[Lv Zheng]
Sounds good.
Thanks for the test.
Thanks and best regards
-Lv
RE: [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support
In reply to Rafael J. WysockiHi
Quoted 39 lines
-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, April 28, 2016 5:25 AM
To: Chen, Yu C; Zheng, Lv
Cc: Lv Zheng; [email protected]; [email protected]; Wysocki, Rafael J; Brown, Len
Subject: Re: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportQuoted 30 lines · Yu C
Hi Lv,
Quoted 28 lines
-----Original Message-----
From: Zheng, Lv
Sent: Wednesday, April 27, 2016 4:55 PM
To: Wysocki, Rafael J; Rafael J. Wysocki; Brown, Len
Cc: Zheng, Lv; Lv Zheng; [email protected]; linux- [email protected]; Chen, Yu C
Subject: [PATCH v2 4/6] ACPI / osi: Fix default_OSI(Darwin)supportFrom: Chen Yu <[email protected]>
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")Cc <[email protected]> # 3.18+Reported-by Lukas Wunner <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>
Quoted 3 lines
Quoted 1 line
The vendor id should be 'Apple Inc.' and 'Apple Computer, Inc.' instead.
If this is the only problem with this patch, I can fix it up. No need to resend.
Yes, this is the only problem, please help fix it, thanks!
Quoted 3 lines
Thanks,
Rafael
PATCH v2 5/6 ACPI / osi: Cleanup coding style issues before creating a separate OSI source file
In reply to Lv ZhengThis patch performs necessary cleanups before moving OSI support to another file.
1. Change int/unsigned int to bool
2. Change printk into pr_xxx
3. Do not initialize values to 0
4. Do not append additional "return" at the end of the function
5. Remove useless comments which may easily break line breaking rule
6. Rename functions to make them looking like acpi_osi_xxx No functional changes.
--- drivers/acpi/blacklist.c | 10 ++--- drivers/acpi/osl.c | 93 ++++++++++++++++------------------------------ include/linux/acpi.h | 4 +- 3 files changed, 40 insertions(+), 67 deletions(-)
drivers/acpi/blacklist.c +5 -5
@@ -135,17 +135,17 @@ int __init acpi_blacklisted(void)#ifdef CONFIG_DMI static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) { -acpi_dmi_osi_darwin (1 , d);/* enable */ +acpi_osi_dmi_darwin (true, d);return 0 ; }static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) { -acpi_dmi_osi_linux (1 , d);/* enable */ +acpi_osi_dmi_linux (true, d);return 0 ; }static int __init dmi_disable_osi_vista (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice ("DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2006" );acpi_osi_setup ("!Windows 2006 SP1" );acpi_osi_setup ("!Windows 2006 SP2" );
@@ -153,13 +153,13 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) }static int __init dmi_disable_osi_win7 (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice ("DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2009" );return 0 ; }static int __init dmi_disable_osi_win8 (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice ("DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2012" );return 0 ; }
drivers/acpi/osl.c +33 -60
205 lines not on this page · raw message
include/linux/acpi.h +2 -2
@@ -353,8 +353,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_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 );
Signature · 1 line
1.7.10
PATCH v2 6/6 ACPI / osi: Collect _OSI handling into one single file
In reply to Lv Zheng_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.
--- drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 219 +------------------- drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 518 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 254 +---------------------- include/linux/acpi.h | 2 - 6 files changed, 527 insertions(+), 470 deletions(-) create mode 100644 drivers/acpi/osi.c
drivers/acpi/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_ACPI) += acpi.o \ acpica/ # All the builtin files are in the "acpi." module_param namespace. -acpi-y += osl.o utils.o reboot.o +acpi-y += osi.o osl.o utils.o reboot.o acpi-y += nvs.o # Power management related files
drivers/acpi/blacklist.c +5 -214
247 lines not on this page · raw message
drivers/acpi/internal.h +2 -0
@@ -20,6 +20,8 @@#define PREFIX "ACPI: " +int early_acpi_osi_init (void ); +int acpi_osi_init (void );acpi_status acpi_os_initialize1 (void );void init_acpi_device_notify (void );int acpi_scan_init (void );
drivers/acpi/osi.c new file +518 -0
518 lines not on this page · raw message
drivers/acpi/osl.c +1 -253
278 lines not on this page · raw message
include/linux/acpi.h +0 -2
@@ -353,8 +353,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 );
Signature · 1 line
1.7.10
v3 cover ACPI / osi: Fix several issues in _OSI handling
In reply to Lv ZhengThis patchset cleans up _OSI handling code and fixes several issues in it.
In the v2 version, as one fix has been changed to be a stable material, patches originally put before it need to be rebased. The necessary changes that are required by this fix are still kept before the fix patch, and the unnecessary changes that are not required by this fix are moved after the fix patch. So that the back porting of the stable materials could be easier. The coding style in the stable materials is kept wrong to be consistent to the coding style used by the old code, so checkpatch.pl may report warnings on the stable materials.
In the v3 version, SOB blocks are updated with the tester's information. Some pr_xxx(PREFIX) related wrong stuffs are corrected. One bool cleanup patch is split out.
Chen Yu (1):
ACPI / osi: Fix default _OSI(Darwin) support
Lv Zheng (6):
ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA
internal strings
ACPI / osi: Cleanup _OSI("Linux") related code before introducing new
support
ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! ACPI / osi: Cleanup OSI handling code to use bool
ACPI / osi: Cleanup coding style issues before creating a separate
OSI source file
ACPI / osi: Collect _OSI handling into one single file
Documentation/kernel-parameters.txt | 2 + drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 196 +------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 522 +++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 225 +-------------- include/linux/acpi.h | 1 - 7 files changed, 533 insertions(+), 417 deletions(-) create mode 100644 drivers/acpi/osi.c
Signature · 1 line
1.7.10
PATCH v3 1/7 ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
The order of the _OSI related functionalities is as follows:
acpi_blacklisted()
acpi_dmi_osi_linux()
acpi_osi_setup()
acpi_osi_setup()
acpi_update_interfaces() if "!*" <<<<<<<<<<<<<<<<<<<<<<<<
parse_args()
__setup("acpi_osi=")
acpi_osi_setup_linux()
acpi_update_interfaces() if "!*"
<<<<<<<<<<<<<<<<<<<<<<<<
acpi_early_init()
acpi_initialize_subsystem()
acpi_ut_initialize_interfaces()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ acpi_bus_init()
acpi_os_initialize1()
acpi_install_interface_handler(acpi_osi_handler) acpi_osi_setup_late()
acpi_update_interfaces() for "!" >>>>>>>>>>>>>>>>>>>>>>>>
acpi_osi_handler()
Since acpi_osi_setup_linux() can override acpi_dmi_osi_linux(), the command line setting can override the DMI detection. That's why acpi_blacklisted() is put before __setup("acpi_osi=").
Then we can notice the following wrong invocation order. There are acpi_update_interfaces() (marked by <<<<) calls invoked before acpi_ut_initialize_interfaces() (marked by ^^^^). This makes it impossible to use acpi_osi=!* correctly from OSI DMI table or from the command line. The use of acpi_osi=!* is meant to disable both ACPICA (acpi_gbl_supported_interfaces) and Linux specific strings (osi_setup_entries) while the ACPICA part should have stopped working because of the order issue.
This patch fixes this issue by moving acpi_update_interfaces() to where it is invoked for acpi_osi=! (marked by >>>>) as this is ensured to be invoked after acpi_ut_initialize_interfaces() (marked by ^^^^). Linux specific strings are still handled in the original place in order to make the following command line working: acpi_osi=!* acpi_osi="Module Device".
Note that since acpi_osi=!* is meant to further disable linux specific string comparing to the acpi_osi=!, there is no such use case in our bug fixing work and hence there is no one using acpi_osi=!* either from the command line or from the DMI quirks, this issue is just a theoretical issue.
--- drivers/acpi/osl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/acpi/osl.c +11 -5
@@ -135,7 +135,7 @@ static struct osi_linux { unsigned int enable:1; unsigned int dmi:1; unsigned int cmdline:1; - unsigned int default_disabling:1; +u8 default_disabling; } osi_linux = {0, 0, 0, 0};static u32 acpi_osi_handler (acpi_string interface,u32 supported)
@@ -1477,10 +1477,13 @@ void __init acpi_osi_setup(char *str)if (*str =='!' ) { str++;if (*str =='\0' ) { - osi_linux.default_disabling =1 ; +/* Do not override acpi_osi=!* */ +if (!osi_linux.default_disabling) + osi_linux.default_disabling = +ACPI_DISABLE_ALL_VENDOR_STRINGS ;return ; }else if (*str =='*' ) { -acpi_update_interfaces (ACPI_DISABLE_ALL_STRINGS ); + osi_linux.default_disabling =ACPI_DISABLE_ALL_STRINGS ;for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) { osi = &osi_setup_entries[i]; osi->enable = false;
@@ -1553,10 +1556,13 @@ static void __init acpi_osi_setup_late(void)acpi_status status;if (osi_linux.default_disabling) { - status =acpi_update_interfaces (ACPI_DISABLE_ALL_VENDOR_STRINGS ); + status =acpi_update_interfaces (osi_linux.default_disabling);if (ACPI_SUCCESS (status)) - printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n"); + printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", + osi_linux.default_disabling == +ACPI_DISABLE_ALL_STRINGS ? +" and feature groups" :"" ); }for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) {
Signature · 1 line
1.7.10
PATCH v3 2/7 ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
In reply to Lv ZhengThis patch cleans up OSI code in osl.c to make osi_linux work for OSI strings other than "Linux", so it can be re-used for other purposes.
--- drivers/acpi/osl.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
drivers/acpi/osl.c +22 -20
@@ -131,12 +131,12 @@ static void __init acpi_osi_setup_late(void);* or boot with "acpi_osi=Linux" */ -static struct osi_linux { -unsigned int enable:1 ; -unsigned int dmi:1 ; -unsigned int cmdline:1 ; +static struct acpi_osi_config { +unsigned int linux_enable:1 ; +unsigned int linux_dmi:1 ; +unsigned int linux_cmdline:1 ;u8 default_disabling; -} osi_linux = {0 ,0 ,0 ,0 }; +} osi_config = {0 ,0 ,0 ,0 };static u32 acpi_osi_handler (acpi_string interface,u32 supported) {
@@ -144,9 +144,9 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported) printk_once(KERN_NOTICE FW_BUG PREFIX"BIOS _OSI(Linux) query %s%s\n" , - osi_linux.enable ?"honored" :"ignored" , - osi_linux.cmdline ?" via cmdline" : - osi_linux.dmi ? " via DMI" : ""); + osi_config.linux_enable ?"honored" :"ignored" , + osi_config.linux_cmdline ?" via cmdline" : + osi_config.linux_dmi ? " via DMI" : ""); }if (!strcmp ("Darwin" , interface)) {
@@ -1478,12 +1478,12 @@ void __init acpi_osi_setup(char *str) str++;if (*str =='\0' ) {/* Do not override acpi_osi=!* */ -if (!osi_linux.default_disabling) - osi_linux.default_disabling = +if (!osi_config.default_disabling) + osi_config.default_disabling =ACPI_DISABLE_ALL_VENDOR_STRINGS ;return ; }else if (*str =='*' ) { - osi_linux.default_disabling =ACPI_DISABLE_ALL_STRINGS ; + osi_config.default_disabling =ACPI_DISABLE_ALL_STRINGS ;for (i =0 ; i <OSI_STRING_ENTRIES_MAX ; i++) { osi = &osi_setup_entries[i]; osi->enable = false;
@@ -1508,10 +1508,10 @@ void __init acpi_osi_setup(char *str)static void __init set_osi_linux (unsigned int enable) { -if (osi_linux.enable != enable) - osi_linux.enable = enable; +if (osi_config.linux_enable != enable) + osi_config.linux_enable = enable; -if (osi_linux.enable) +if (osi_config.linux_enable)acpi_osi_setup ("Linux" );else acpi_osi_setup ("!Linux" );
@@ -1521,8 +1521,9 @@ static void __init set_osi_linux(unsigned int enable)static void __init acpi_cmdline_osi_linux (unsigned int enable) { - osi_linux.cmdline =1 ;/* cmdline set the default and override DMI */ - osi_linux.dmi =0 ; +/* cmdline set the default and override DMI */ + osi_config.linux_cmdline =1 ; + osi_config.linux_dmi =0 ;set_osi_linux (enable);return ;
@@ -1535,7 +1536,8 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)if (enable ==-1 )return ; - osi_linux.dmi =1 ;/* DMI knows that this box asks OSI(Linux) */ +/* DMI knows that this box asks OSI(Linux) */ + osi_config.linux_dmi =1 ;set_osi_linux (enable);return ;
@@ -1555,12 +1557,12 @@ static void __init acpi_osi_setup_late(void)int i;acpi_status status; -if (osi_linux.default_disabling) { - status =acpi_update_interfaces (osi_linux.default_disabling); +if (osi_config.default_disabling) { + status =acpi_update_interfaces (osi_config.default_disabling);if (ACPI_SUCCESS (status)) printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", - osi_linux.default_disabling == + osi_config.default_disabling ==ACPI_DISABLE_ALL_STRINGS ?" and feature groups" :"" ); }
Signature · 1 line
1.7.10
PATCH v3 3/7 ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=!
In reply to Lv ZhengThis patch introduces acpi_osi=!! so that quirks may use it to revert acpi_osi=!.
--- Documentation/kernel-parameters.txt | 2 ++ drivers/acpi/osl.c | 3 +++ 2 files changed, 5 insertions(+)
Documentation/kernel-parameters.txt +2 -0
@@ -312,6 +312,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. acpi_osi=!* # remove all strings acpi_osi=! # disable all built-in OS vendor strings + acpi_osi=!! # enable all built-in OS vendor + strings acpi_osi= # disable all strings 'acpi_osi=!' can be used in combination with single or
drivers/acpi/osl.c +3 -0
@@ -1489,6 +1489,9 @@ void __init acpi_osi_setup(char *str) osi->enable = false; }return ; + }else if (*str =='!' ) { + osi_config.default_disabling =0 ; +return ; } enable = false; }
Signature · 1 line
1.7.10
PATCH v3 4/7 ACPI / osi: Fix default _OSI(Darwin) support
In reply to Lv ZhengFrom: Chen Yu <[email protected]>
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.
--- drivers/acpi/blacklist.c | 23 ++++++++++++++++++ drivers/acpi/osl.c | 58 ++++++++++++++++++++++++++++++++++++++++------ include/linux/acpi.h | 1 + 3 files changed, 75 insertions(+), 7 deletions(-)
drivers/acpi/blacklist.c +23 -0
@@ -133,6 +133,11 @@ int __init acpi_blacklisted(void)return blacklisted; }#ifdef CONFIG_DMI +static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) +{ +acpi_dmi_osi_darwin (1 , d);/* enable */ +return 0 ; +}static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) {acpi_dmi_osi_linux (1 , d);/* enable */
@@ -331,6 +336,24 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, }, +/* +* Enable _OSI("Darwin") for all apple platforms. +*/ + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), + }, + }, + { + .callback = dmi_enable_osi_darwin, + .ident = "Apple hardware", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."), + }, + }, + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE /* * DELL XPS 13 (2015) switches sound between HDA and I2S
drivers/acpi/osl.c +51 -7
82 lines not on this page · raw message
include/linux/acpi.h +1 -0
@@ -354,6 +354,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 );
Signature · 1 line
1.7.10
PATCH v3 5/7 ACPI / osi: Cleanup OSI handling code to use bool
In reply to Lv ZhengThis patch changes "int/unsigned int" to "bool" to simplify the code.
--- drivers/acpi/blacklist.c | 4 ++-- drivers/acpi/osl.c | 36 +++++++++++++----------------------- include/linux/acpi.h | 4 ++-- 3 files changed, 17 insertions(+), 27 deletions(-)
drivers/acpi/blacklist.c +2 -2
@@ -135,12 +135,12 @@ int __init acpi_blacklisted(void)#ifdef CONFIG_DMI static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) { -acpi_dmi_osi_darwin (1 , d);/* enable */ +acpi_dmi_osi_darwin (true, d);/* enable */ return 0 ; }static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) { -acpi_dmi_osi_linux (1 , d);/* enable */ +acpi_dmi_osi_linux (true, d);/* enable */ return 0 ; }static int __init dmi_disable_osi_vista (const struct dmi_system_id *d)
drivers/acpi/osl.c +13 -23
@@ -1511,11 +1511,9 @@ void __init acpi_osi_setup(char *str) } } -static void __init set_osi_darwin (unsigned int enable) +static void __init set_osi_darwin (bool enable) { -if (osi_config.darwin_enable != enable) - osi_config.darwin_enable = enable; - + osi_config.darwin_enable = !!enable;if (enable) {acpi_osi_setup ("!" );acpi_osi_setup ("Darwin" );
@@ -1525,7 +1523,7 @@ static void __init set_osi_darwin(unsigned int enable) } } -static void __init acpi_cmdline_osi_darwin (unsigned int enable) +static void __init acpi_cmdline_osi_darwin (bool enable) {/* cmdline set the default and override DMI */ osi_config.darwin_cmdline =1 ;
@@ -1535,13 +1533,10 @@ static void __init acpi_cmdline_osi_darwin(unsigned int enable)return ; } -void __init acpi_dmi_osi_darwin (int enable,const struct dmi_system_id *d) +void __init acpi_dmi_osi_darwin (bool enable,const struct dmi_system_id *d) { printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); -if (enable ==-1 ) -return ; -/* DMI knows that this box asks OSI(Darwin) */ osi_config.darwin_dmi =1 ;set_osi_darwin (enable);
@@ -1549,12 +1544,10 @@ void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d)return ; } -static void __init set_osi_linux (unsigned int enable) +static void __init set_osi_linux (bool enable) { -if (osi_config.linux_enable != enable) - osi_config.linux_enable = enable; - -if (osi_config.linux_enable) + osi_config.linux_enable = !!enable; +if (enable)acpi_osi_setup ("Linux" );else acpi_osi_setup ("!Linux" );
@@ -1562,7 +1555,7 @@ static void __init set_osi_linux(unsigned int enable)return ; } -static void __init acpi_cmdline_osi_linux (unsigned int enable) +static void __init acpi_cmdline_osi_linux (bool enable) {/* cmdline set the default and override DMI */ osi_config.linux_cmdline =1 ;
@@ -1572,13 +1565,10 @@ static void __init acpi_cmdline_osi_linux(unsigned int enable)return ; } -void __init acpi_dmi_osi_linux (int enable,const struct dmi_system_id *d) +void __init acpi_dmi_osi_linux (bool enable,const struct dmi_system_id *d) { printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); -if (enable ==-1 ) -return ; -/* DMI knows that this box asks OSI(Linux) */ osi_config.linux_dmi =1 ;set_osi_linux (enable);
@@ -1633,13 +1623,13 @@ static void __init acpi_osi_setup_late(void)static int __init osi_setup (char *str) {if (str && !strcmp ("Linux" , str)) -acpi_cmdline_osi_linux (1 ); +acpi_cmdline_osi_linux (true);else if (str && !strcmp ("!Linux" , str)) -acpi_cmdline_osi_linux (0 ); +acpi_cmdline_osi_linux (false);else if (str && !strcmp ("Darwin" , str)) -acpi_cmdline_osi_darwin (1 ); +acpi_cmdline_osi_darwin (true);else if (str && !strcmp ("!Darwin" , str)) -acpi_cmdline_osi_darwin (0 ); +acpi_cmdline_osi_darwin (false);else acpi_osi_setup (str);
include/linux/acpi.h +2 -2
@@ -353,8 +353,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 );
Signature · 1 line
1.7.10
PATCH v3 6/7 ACPI / osi: Cleanup coding style issues before creating a separate OSI source file
In reply to Lv ZhengThis 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.
--- drivers/acpi/blacklist.c | 10 +++--- drivers/acpi/osl.c | 76 +++++++++++++++++++--------------------------- include/linux/acpi.h | 4 +-- 3 files changed, 38 insertions(+), 52 deletions(-)
drivers/acpi/blacklist.c +5 -5
@@ -135,17 +135,17 @@ int __init acpi_blacklisted(void)#ifdef CONFIG_DMI static int __init dmi_enable_osi_darwin (const struct dmi_system_id *d) { -acpi_dmi_osi_darwin (true, d);/* enable */ +acpi_osi_dmi_darwin (true, d);return 0 ; }static int __init dmi_enable_osi_linux (const struct dmi_system_id *d) { -acpi_dmi_osi_linux (true, d);/* enable */ +acpi_osi_dmi_linux (true, d);return 0 ; }static int __init dmi_disable_osi_vista (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice (PREFIX "DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2006" );acpi_osi_setup ("!Windows 2006 SP1" );acpi_osi_setup ("!Windows 2006 SP2" );
@@ -153,13 +153,13 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) }static int __init dmi_disable_osi_win7 (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice (PREFIX "DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2009" );return 0 ; }static int __init dmi_disable_osi_win8 (const struct dmi_system_id *d) { - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); +pr_notice (PREFIX "DMI detected: %s\n" , d->ident);acpi_osi_setup ("!Windows 2012" );return 0 ; }
drivers/acpi/osl.c +31 -45
183 lines not on this page · raw message
include/linux/acpi.h +2 -2
@@ -353,8 +353,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 );
Signature · 1 line
1.7.10
PATCH v3 7/7 ACPI / osi: Collect _OSI handling into one single file
In reply to Lv Zheng_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.
--- drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 219 +------------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 522 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 256 +---------------------- include/linux/acpi.h | 2 - 6 files changed, 531 insertions(+), 472 deletions(-) create mode 100644 drivers/acpi/osi.c
drivers/acpi/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_ACPI) += acpi.o \ acpica/ # All the builtin files are in the "acpi." module_param namespace. -acpi-y += osl.o utils.o reboot.o +acpi-y += osi.o osl.o utils.o reboot.o acpi-y += nvs.o # Power management related files
drivers/acpi/blacklist.c +5 -214
247 lines not on this page · raw message
drivers/acpi/internal.h +2 -0
@@ -20,6 +20,8 @@#define PREFIX "ACPI: " +int early_acpi_osi_init (void ); +int acpi_osi_init (void );acpi_status acpi_os_initialize1 (void );void init_acpi_device_notify (void );int acpi_scan_init (void );
drivers/acpi/osi.c new file +522 -0
522 lines not on this page · raw message
drivers/acpi/osl.c +1 -255
280 lines not on this page · raw message
include/linux/acpi.h +0 -2
@@ -353,8 +353,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 );
Signature · 1 line
1.7.10
Quoted 28 lines · Lv Zheng
This patchset cleans up
_OSIhandling code and fixes several issues in it.In the v2 version, as one fix has been changed to be a stable material, patches originally put before it need to be rebased. The necessary changes that are required by this fix are still kept before the fix patch, and the unnecessary changes that are not required by this fix are moved after the fix patch. So that the back porting of the stable materials could be easier. The coding style in the stable materials is kept wrong to be consistent to the coding style used by the old code, so checkpatch.pl may report warnings on the stable materials.
In the v3 version, SOB blocks are updated with the tester's information. Somepr_xxx(PREFIX)related wrong stuffs are corrected. One bool cleanup patch is split out.Chen Yu (1):
ACPI / osi: Fix default_OSI(Darwin)supportLv Zheng (6):
ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA
internal strings
ACPI / osi: Cleanup_OSI("Linux")related code before introducing new
support
ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! ACPI / osi: Cleanup OSI handling code to use bool
ACPI / osi: Cleanup coding style issues before creating a separate
OSI source file
ACPI / osi: Collect_OSIhandling into one single file
Quoted 9 lines
Documentation/kernel-parameters.txt | 2 + drivers/acpi/Makefile | 2 +- drivers/acpi/blacklist.c | 196 +------------ drivers/acpi/internal.h | 2 + drivers/acpi/osi.c | 522 +++++++++++++++++++++++++++++++++++ drivers/acpi/osl.c | 225 +-------------- include/linux/acpi.h | 1 - 7 files changed, 533 insertions(+), 417 deletions(-) create mode 100644 drivers/acpi/osi.c
All [1-7/7] applied, thanks!