From ae00d812436dc968f4a5dea7757b6a94910b6dc4 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Tue, 29 May 2007 18:43:33 -0400 Subject: ACPI: extend "acpi_osi=" boot option The boot option "acpi_osi=" has always disabled Linux _OSI support, thus disabling all OS Interface strings which are advertised by Linux to the BIOS. Now... acpi_osi="string" adds the interface string, and acpi_osi="!string" invalidates the pre-defined interface string eg. acpi_osi="!Windows 2006" would disable Linux's claim of Vista compatibility. Signed-off-by: Len Brown --- drivers/acpi/osl.c | 25 ++++++++++++++++--------- drivers/acpi/utilities/uteval.c | 27 ++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 10 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index b998340e23d4..f4760cfa61e1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -73,6 +73,9 @@ static void *acpi_irq_context; static struct workqueue_struct *kacpid_wq; static struct workqueue_struct *kacpi_notify_wq; +#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ +static char osi_additional_string[OSI_STRING_LENGTH_MAX]; + static void __init acpi_request_region (struct acpi_generic_address *addr, unsigned int length, char *desc) { @@ -961,19 +964,23 @@ static int __init acpi_os_name_setup(char *str) __setup("acpi_os_name=", acpi_os_name_setup); /* - * _OSI control + * Modify the list of "OS Interfaces" reported to BIOS via _OSI + * * empty string disables _OSI - * TBD additional string adds to _OSI + * string starting with '!' disables that string + * otherwise string is added to list, augmenting built-in strings */ static int __init acpi_osi_setup(char *str) { if (str == NULL || *str == '\0') { printk(KERN_INFO PREFIX "_OSI method disabled\n"); acpi_gbl_create_osi_method = FALSE; - } else { - /* TBD */ - printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", - str); + } else if (*str == '!') { + if (acpi_osi_invalidate(++str) == AE_OK) + printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); + } else if (*osi_additional_string == '\0') { + strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); + printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); } return 1; @@ -1143,11 +1150,11 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) acpi_status acpi_os_validate_interface (char *interface) { - - return AE_SUPPORT; + if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) + return AE_OK; + return AE_SUPPORT; } - /****************************************************************************** * * FUNCTION: acpi_os_validate_address diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 13d5879cd98b..a10120ad6982 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -59,7 +59,7 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, /* * Strings supported by the _OSI predefined (internal) method. */ -static const char *acpi_interfaces_supported[] = { +static char *acpi_interfaces_supported[] = { /* Operating System Vendor Strings */ "Linux", @@ -156,6 +156,31 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) return_ACPI_STATUS(AE_CTRL_TERMINATE); } +/******************************************************************************* + * + * FUNCTION: acpi_osi_invalidate + * + * PARAMETERS: interface_string + * + * RETURN: Status + * + * DESCRIPTION: invalidate string in pre-defiend _OSI string list + * + ******************************************************************************/ + +acpi_status acpi_osi_invalidate(char *interface) +{ + int i; + + for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { + if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) { + *acpi_interfaces_supported[i] = '\0'; + return AE_OK; + } + } + return AE_NOT_FOUND; +} + /******************************************************************************* * * FUNCTION: acpi_ut_evaluate_object -- cgit v1.2.2 From f507654d450d329c81a70eec0096d5dfe67802ec Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 30 May 2007 00:10:38 -0400 Subject: ACPI: Make _OSI(Linux) a special case _OSI("Linux") is like _OS("Linux"), it is ill-defined and virtually no BIOS vendors test interaction with it. As a result, it can do more damage than good because it causes the BIOS to follow un-tested paths. Recently, several machines have turned up that erroneously test this string in a way which causes them to _not_ test other compatibility strings, including the ZI9 and Toshiba. So it appears that this bad code has made it into a BIOS vendor's reference BIOS. Linux has no choice but to stop advertising compatibility with _OSI string "Linux" - as there are an unbounded number of possible incompatibilities going forward. But some BIOSes have already shipped which do use it for things like conditionally re-enabling video on resume from S3. (Too bad they didn't do that unconditionally) Add special case code for _OSI(Linux) Squawk to dmesg if _OSI(Linux) is requested Add DMI list both to enable and disable _OSI(Linux) But for now, keep the default enabled via #define OSI_LINUX_ENABLED. http://bugzilla.kernel.org/show_bug.cgi?id=7787 Signed-off-by: Len Brown --- drivers/acpi/osl.c | 91 +++++++++++++++++++++++++++++++++++++++++ drivers/acpi/utilities/uteval.c | 1 - 2 files changed, 91 insertions(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f4760cfa61e1..e349879d9246 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,18 @@ static struct workqueue_struct *kacpi_notify_wq; #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ static char osi_additional_string[OSI_STRING_LENGTH_MAX]; +#define OSI_LINUX_ENABLED +#ifdef OSI_LINUX_ENABLED +int osi_linux = 1; /* enable _OSI(Linux) by default */ +#else +int osi_linux; /* disable _OSI(Linux) by default */ +#endif + + +#ifdef CONFIG_DMI +static struct dmi_system_id acpi_osl_dmi_table[]; +#endif + static void __init acpi_request_region (struct acpi_generic_address *addr, unsigned int length, char *desc) { @@ -126,6 +139,7 @@ device_initcall(acpi_reserve_resources); acpi_status acpi_os_initialize(void) { + dmi_check_system(acpi_osl_dmi_table); return AE_OK; } @@ -963,6 +977,16 @@ static int __init acpi_os_name_setup(char *str) __setup("acpi_os_name=", acpi_os_name_setup); +static void enable_osi_linux(int enable) { + + if (osi_linux != enable) + printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n", + enable ? "En": "Dis"); + + osi_linux = enable; + return; +} + /* * Modify the list of "OS Interfaces" reported to BIOS via _OSI * @@ -978,6 +1002,10 @@ static int __init acpi_osi_setup(char *str) } else if (*str == '!') { if (acpi_osi_invalidate(++str) == AE_OK) printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); + } else if (!strcmp("!Linux", str)) { + enable_osi_linux(0); + } else if (!strcmp("Linux", str)) { + enable_osi_linux(1); } else if (*osi_additional_string == '\0') { strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); @@ -1152,6 +1180,23 @@ acpi_os_validate_interface (char *interface) { if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) return AE_OK; + if (!strcmp("Linux", interface)) { + printk(KERN_WARNING PREFIX + "System BIOS is requesting _OSI(Linux)\n"); +#ifdef OSI_LINUX_ENABLED + printk(KERN_WARNING PREFIX + "Please test with \"acpi_osi=!Linux\"\n" + "Please send dmidecode " + "to linux-acpi@vger.kernel.org\n"); +#else + printk(KERN_WARNING PREFIX + "If \"acpi_osi=Linux\" works better,\n" + "Please send dmidecode " + "to linux-acpi@vger.kernel.org\n"); +#endif + if(osi_linux) + return AE_OK; + } return AE_SUPPORT; } @@ -1181,5 +1226,51 @@ acpi_os_validate_address ( return AE_OK; } +#ifdef CONFIG_DMI +#ifdef OSI_LINUX_ENABLED +static int dmi_osi_not_linux(struct dmi_system_id *d) +{ + printk(KERN_NOTICE "%s detected: requires not _OSI(Linux)\n", d->ident); + enable_osi_linux(0); + return 0; +} +#else +static int dmi_osi_linux(struct dmi_system_id *d) +{ + printk(KERN_NOTICE "%s detected: requires _OSI(Linux)\n", d->ident); + enable_osi_linux(1); + return 0; +} +#endif + +static struct dmi_system_id acpi_osl_dmi_table[] = { +#ifdef OSI_LINUX_ENABLED + /* + * Boxes that need NOT _OSI(Linux) + */ + { + .callback = dmi_osi_not_linux, + .ident = "Toshiba Satellite P100", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_BOARD_NAME, "Satellite P100"), + }, + }, +#else + /* + * Boxes that need _OSI(Linux) + */ + { + .callback = dmi_osi_linux, + .ident = "Intel Napa CRB", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), + DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"), + }, + }, +#endif + {} +}; +#endif /* CONFIG_DMI */ #endif diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index a10120ad6982..8ec6f8e48138 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c @@ -62,7 +62,6 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, static char *acpi_interfaces_supported[] = { /* Operating System Vendor Strings */ - "Linux", "Windows 2000", "Windows 2001", "Windows 2001 SP0", -- cgit v1.2.2 From dd272b5716a54afa33a69f2241284d8ec60b7892 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 30 May 2007 00:26:11 -0400 Subject: ACPI: add __init to acpi_initialize_subsystem() Add __init to: acpi_initialize_subsystem() (and un-export it) acpi_os_initialize() Add __initdata to: acpi_osl_dmi_table[] Signed-off-by: Len Brown --- drivers/acpi/osl.c | 6 +++--- drivers/acpi/utilities/utxface.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index e349879d9246..58ceb18ec997 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -86,7 +86,7 @@ int osi_linux; /* disable _OSI(Linux) by default */ #ifdef CONFIG_DMI -static struct dmi_system_id acpi_osl_dmi_table[]; +static struct __initdata dmi_system_id acpi_osl_dmi_table[]; #endif static void __init acpi_request_region (struct acpi_generic_address *addr, @@ -137,7 +137,7 @@ static int __init acpi_reserve_resources(void) } device_initcall(acpi_reserve_resources); -acpi_status acpi_os_initialize(void) +acpi_status __init acpi_os_initialize(void) { dmi_check_system(acpi_osl_dmi_table); return AE_OK; @@ -1243,7 +1243,7 @@ static int dmi_osi_linux(struct dmi_system_id *d) } #endif -static struct dmi_system_id acpi_osl_dmi_table[] = { +static struct dmi_system_id acpi_osl_dmi_table[] __initdata = { #ifdef OSI_LINUX_ENABLED /* * Boxes that need NOT _OSI(Linux) diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index e9a57806cd34..2d496918b3cd 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c @@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utxface") * called, so any early initialization belongs here. * ******************************************************************************/ -acpi_status acpi_initialize_subsystem(void) +acpi_status __init acpi_initialize_subsystem(void) { acpi_status status; @@ -108,8 +108,6 @@ acpi_status acpi_initialize_subsystem(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) - /******************************************************************************* * * FUNCTION: acpi_enable_subsystem -- cgit v1.2.2