linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Start deprecating _OSI on new architectures
@ 2015-02-04  0:21 al.stone
  2015-02-04  0:21 ` [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later al.stone
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

The use of the ACPI _OSI method in Linux has a long and sordid history.
Instead of perpetuating past complications on new architectures, the 
consensus amongst those writing the ACPI specification and those using
it seems to be to ultimately deprecate the use of _OSI.  A change request
has been submitted (but not yet decided upon) to modify the ACPI specification
accordingly.

In the meantime, these patches rearrange the implementation of _OSI so
that it can be deprecated, or ultimately removed completely, on at least
arm64 platforms.  This is done by separating out the _OSI implementation
and moving it into a new file.  For x86 and ia64, there is no change in
functionality.  But, this allows us to provide a separate implementation
of _OSI for arm64 that generates a warning that it has been deprecated, 
and always returns false; i.e., that the capability being queried for, 
whether OS name or functionality, is not supported.  This is the first
four of the patches.

The final patch changes the default value for the _OS_ method for arm64
only.  Since there is no need to pretend to be older versions of Windows,
or any other OS at all, the _OS_ method will return "Linux" on arm64.
One can still use the acpi_os_name kernel parameter if there is a need
to use some other value.

The first three patches do not depend on arm64 support for ACPI and could
be used independently.  The last two patches make much more sense when used
in conjunction with Hanjun's patches for ACPI 5.1 on arm64 [0].

These have been through some simple testing on two different x86 laptops,
and all seems well (Lenovo t440s and t430s ThinkPads).  The arm64 code has
been tested on an AMD Seattle system.  Unfortunately, for ia64, all I could
do was cross-compile the code; I have no access to hardware to test on.

NB: the first two patches do not pass checkpatch.pl; since this is existing
code being moved, I have not repaired the reported errors for now, but will
do so once the disposition of these patches have been resolved.


Changes in v2:
  -- significant simplification based on Rafael's comments
  -- ACPI spec change request has now been submitted


[0] https://lkml.org/lkml/2015/2/2/261


Al Stone (4):
  ACPI: move acpi_os_handler() so it can be made arch-dependent later
  ACPI: move _OSI support functions to allow arch-dependent
    implementation
  ACPI: add arch-specific compilation for _OSI and the blacklist
  ACPI: arm64: use the arch-specific ACPI _OSI method and ACPI blacklist

Hanjun Guo (1):
  ACPI: arm64: use "Linux" as ACPI_OS_NAME for _OS on arm64

 arch/arm64/Kconfig              |   7 ++
 drivers/acpi/Kconfig            |  22 ++++
 drivers/acpi/Makefile           |  17 +++
 drivers/acpi/blacklist-arm.c    |  20 ++++
 drivers/acpi/blacklist.c        |   9 ++
 drivers/acpi/osi-arm.c          |  25 ++++
 drivers/acpi/osi.c              | 255 ++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/osl.c              | 217 ----------------------------------
 include/acpi/acconfig.h         |   2 +
 include/acpi/platform/aclinux.h |   4 +
 include/linux/acpi.h            |   4 +-
 11 files changed, 362 insertions(+), 220 deletions(-)
 create mode 100644 drivers/acpi/blacklist-arm.c
 create mode 100644 drivers/acpi/osi-arm.c
 create mode 100644 drivers/acpi/osi.c

-- 
2.1.0


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

* [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later
  2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
@ 2015-02-04  0:21 ` al.stone
  2015-02-04 13:50   ` Rafael J. Wysocki
  2015-02-04  0:21 ` [PATCH v2 2/5] ACPI: move _OSI support functions to allow arch-dependent implementation al.stone
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

In order to deprecate the use of _OSI for arm64 or other new architectures,
we need to make the default handler something we can change for various
platforms.  This patch moves the definition of acpi_osi_handler() -- the
function used by ACPICA as a callback for evaluating _OSI -- into a separate
file.  Subsequent patches will change which files get built so that we can
then build the version of _OSI we need for a particular architecture.

There is no functional change.

Signed-off-by: Al Stone <al.stone@linaro.org>
---
 drivers/acpi/Makefile |   2 +-
 drivers/acpi/osi.c    | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/osl.c    |  24 ------------
 include/linux/acpi.h  |   1 +
 4 files changed, 102 insertions(+), 25 deletions(-)
 create mode 100644 drivers/acpi/osi.c

diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index c346011..df348b3 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -18,7 +18,7 @@ obj-y				+= acpi.o \
 					acpica/
 
 # All the builtin files are in the "acpi." module_param namespace.
-acpi-y				+= osl.o utils.o reboot.o
+acpi-y				+= osl.o utils.o reboot.o osi.o
 acpi-y				+= nvs.o
 
 # Power management related files
diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
new file mode 100644
index 0000000..fff2b0c
--- /dev/null
+++ b/drivers/acpi/osi.c
@@ -0,0 +1,100 @@
+/*
+ *  osi.c - _OSI implementation (moved from drivers/acpi/osl.c)
+ *
+ *  Copyright (C) 2000       Andrew Henroid
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *  Copyright (c) 2008 Intel Corporation
+ *   Author: Matthew Wilcox <willy@linux.intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ */
+
+#include <linux/acpi.h>
+
+#define _COMPONENT		ACPI_OS_SERVICES
+ACPI_MODULE_NAME("osl");
+
+#define PREFIX			"ACPI: "
+
+/*
+ * The story of _OSI(Linux)
+ *
+ * From pre-history through Linux-2.6.22,
+ * Linux responded TRUE upon a BIOS OSI(Linux) query.
+ *
+ * Unfortunately, reference BIOS writers got wind of this
+ * and put OSI(Linux) in their example code, quickly exposing
+ * this string as ill-conceived and opening the door to
+ * an un-bounded number of BIOS incompatibilities.
+ *
+ * For example, OSI(Linux) was used on resume to re-POST a
+ * video card on one system, because Linux at that time
+ * could not do a speedy restore in its native driver.
+ * But then upon gaining quick native restore capability,
+ * Linux has no way to tell the BIOS to skip the time-consuming
+ * POST -- putting Linux at a permanent performance disadvantage.
+ * On another system, the BIOS writer used OSI(Linux)
+ * to infer native OS support for IPMI!  On other systems,
+ * OSI(Linux) simply got in the way of Linux claiming to
+ * be compatible with other operating systems, exposing
+ * BIOS issues such as skipped device initialization.
+ *
+ * So "Linux" turned out to be a really poor chose of
+ * OSI string, and from Linux-2.6.23 onward we respond FALSE.
+ *
+ * BIOS writers should NOT query _OSI(Linux) on future systems.
+ * Linux will complain on the console when it sees it, and return FALSE.
+ * To get Linux to return TRUE for your system  will require
+ * a kernel source update to add a DMI entry,
+ * or boot with "acpi_osi=Linux"
+ */
+
+static struct osi_linux {
+	unsigned int	enable:1;
+	unsigned int	dmi:1;
+	unsigned int	cmdline:1;
+	unsigned int	default_disabling:1;
+} osi_linux = {0, 0, 0, 0};
+
+u32 acpi_osi_handler(acpi_string interface, u32 supported)
+{
+	if (!strcmp("Linux", interface)) {
+
+		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" : "");
+	}
+
+	if (!strcmp("Darwin", interface)) {
+		/*
+		 * Apple firmware will behave poorly if it receives positive
+		 * answers to "Darwin" and any other OS. Respond positively
+		 * to Darwin and then disable all other vendor strings.
+		 */
+		acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
+		supported = ACPI_UINT32_MAX;
+	}
+
+	return supported;
+}
+
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f9eeae8..c7f1cd6 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -141,30 +141,6 @@ static struct osi_linux {
 	unsigned int	default_disabling:1;
 } osi_linux = {0, 0, 0, 0};
 
-static u32 acpi_osi_handler(acpi_string interface, u32 supported)
-{
-	if (!strcmp("Linux", interface)) {
-
-		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" : "");
-	}
-
-	if (!strcmp("Darwin", interface)) {
-		/*
-		 * Apple firmware will behave poorly if it receives positive
-		 * answers to "Darwin" and any other OS. Respond positively
-		 * to Darwin and then disable all other vendor strings.
-		 */
-		acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
-		supported = ACPI_UINT32_MAX;
-	}
-
-	return supported;
-}
-
 static void __init acpi_request_region (struct acpi_generic_address *gas,
 	unsigned int length, char *desc)
 {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 87f365e..ec18ab0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -271,6 +271,7 @@ static inline int acpi_video_display_switch_support(void)
 extern int acpi_blacklisted(void);
 extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
 extern void acpi_osi_setup(char *str);
+extern u32 acpi_osi_handler(acpi_string interface, u32 supported);
 
 #ifdef CONFIG_ACPI_NUMA
 int acpi_get_node(acpi_handle handle);
-- 
2.1.0

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

* [PATCH v2 2/5] ACPI: move _OSI support functions to allow arch-dependent implementation
  2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
  2015-02-04  0:21 ` [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later al.stone
@ 2015-02-04  0:21 ` al.stone
  2015-02-04  0:21 ` [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist al.stone
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

Having moved the _OSI callback function needed by ACPICA from
drivers/acpi/osl.c to drivers/acpi/osi.c, we now move all the
remaining _OSI support functions to osi.c.

This patch is much larger than I had wanted it to be; several of the
functions that implemented acpi_osi* command line options, or did the
set up of the interfaces to be provided by _OSI, shared a static struct.
Hence, I ended up moving a bunch of code at once rather than perhaps a
function at a time.

With this patch, all the _OSI-associated code has now been moved
to osi.c, and we next change the build so that we can make the
_OSI implementation arch-dependent.

There is no functional change.

Signed-off-by: Al Stone <al.stone@linaro.org>
---
 drivers/acpi/blacklist.c |   4 +
 drivers/acpi/osi.c       | 157 +++++++++++++++++++++++++++++++++++++-
 drivers/acpi/osl.c       | 193 -----------------------------------------------
 include/linux/acpi.h     |   3 -
 4 files changed, 160 insertions(+), 197 deletions(-)

diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 9b693d5..3931e19 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -34,6 +34,10 @@
 
 #include "internal.h"
 
+extern void __init acpi_dmi_osi_linux(int enable,
+				      const struct dmi_system_id *d);
+extern void __init acpi_osi_setup(char *str);
+
 enum acpi_blacklist_predicates {
 	all_versions,
 	less_than_or_equal,
diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
index fff2b0c..761c29e 100644
--- a/drivers/acpi/osi.c
+++ b/drivers/acpi/osi.c
@@ -34,6 +34,8 @@ ACPI_MODULE_NAME("osl");
 
 #define PREFIX			"ACPI: "
 
+static void __init acpi_osi_setup_late(void);
+
 /*
  * The story of _OSI(Linux)
  *
@@ -72,10 +74,14 @@ static struct osi_linux {
 	unsigned int	dmi:1;
 	unsigned int	cmdline:1;
 	unsigned int	default_disabling:1;
-} osi_linux = {0, 0, 0, 0};
+	unsigned int	interfaces_added:1;
+} osi_linux = {0, 0, 0, 0, 0};
 
 u32 acpi_osi_handler(acpi_string interface, u32 supported)
 {
+	if (!osi_linux.interfaces_added)
+		acpi_osi_setup_late();
+
 	if (!strcmp("Linux", interface)) {
 
 		printk_once(KERN_NOTICE FW_BUG PREFIX
@@ -98,3 +104,152 @@ u32 acpi_osi_handler(acpi_string interface, u32 supported)
 	return supported;
 }
 
+#define	OSI_STRING_LENGTH_MAX 64	/* arbitrary */
+#define	OSI_STRING_ENTRIES_MAX 16	/* arbitrary */
+
+struct osi_setup_entry {
+	char string[OSI_STRING_LENGTH_MAX];
+	bool enable;
+};
+
+static struct osi_setup_entry
+		osi_setup_entries[OSI_STRING_ENTRIES_MAX] = {
+	{"Module Device", true},
+	{"Processor Device", true},
+	{"3.0 _SCP Extensions", true},
+	{"Processor Aggregator Device", true},
+};
+
+void __init acpi_osi_setup(char *str)
+{
+	struct osi_setup_entry *osi;
+	bool enable = true;
+	int i;
+
+	if (!acpi_gbl_create_osi_method)
+		return;
+
+	if (str == NULL || *str == '\0') {
+		printk(KERN_INFO PREFIX "_OSI method disabled\n");
+		acpi_gbl_create_osi_method = FALSE;
+		return;
+	}
+
+	if (*str == '!') {
+		str++;
+		if (*str == '\0') {
+			osi_linux.default_disabling = 1;
+			return;
+		} else if (*str == '*') {
+			acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
+			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
+				osi = &osi_setup_entries[i];
+				osi->enable = false;
+			}
+			return;
+		}
+		enable = false;
+	}
+
+	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
+		osi = &osi_setup_entries[i];
+		if (!strcmp(osi->string, str)) {
+			osi->enable = enable;
+			break;
+		} else if (osi->string[0] == '\0') {
+			osi->enable = enable;
+			strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
+			break;
+		}
+	}
+}
+
+static void __init set_osi_linux(unsigned int enable)
+{
+	if (osi_linux.enable != enable)
+		osi_linux.enable = enable;
+
+	if (osi_linux.enable)
+		acpi_osi_setup("Linux");
+	else
+		acpi_osi_setup("!Linux");
+
+	return;
+}
+
+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;
+	set_osi_linux(enable);
+
+	return;
+}
+
+void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
+{
+	printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
+
+	if (enable == -1)
+		return;
+
+	osi_linux.dmi = 1;	/* DMI knows that this box asks OSI(Linux) */
+	set_osi_linux(enable);
+
+	return;
+}
+
+/*
+ * Modify the list of "OS Interfaces" reported to BIOS via _OSI
+ *
+ * empty string disables _OSI
+ * string starting with '!' disables that string
+ * otherwise string is added to list, augmenting built-in strings
+ */
+static void __init acpi_osi_setup_late(void)
+{
+	struct osi_setup_entry *osi;
+	char *str;
+	int i;
+	acpi_status status;
+
+	if (osi_linux.default_disabling) {
+		status = acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
+
+		if (ACPI_SUCCESS(status))
+			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n");
+	}
+
+	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
+		osi = &osi_setup_entries[i];
+		str = osi->string;
+
+		if (*str == '\0')
+			break;
+		if (osi->enable) {
+			status = acpi_install_interface(str);
+
+			if (ACPI_SUCCESS(status))
+				printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
+		} else {
+			status = acpi_remove_interface(str);
+
+			if (ACPI_SUCCESS(status))
+				printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
+		}
+	}
+}
+
+static int __init osi_setup(char *str)
+{
+	if (str && !strcmp("Linux", str))
+		acpi_cmdline_osi_linux(1);
+	else if (str && !strcmp("!Linux", str))
+		acpi_cmdline_osi_linux(0);
+	else
+		acpi_osi_setup(str);
+
+	return 1;
+}
+
+__setup("acpi_osi=", osi_setup);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index c7f1cd6..a0c9940 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -99,48 +99,6 @@ struct acpi_ioremap {
 static LIST_HEAD(acpi_ioremaps);
 static DEFINE_MUTEX(acpi_ioremap_lock);
 
-static void __init acpi_osi_setup_late(void);
-
-/*
- * The story of _OSI(Linux)
- *
- * From pre-history through Linux-2.6.22,
- * Linux responded TRUE upon a BIOS OSI(Linux) query.
- *
- * Unfortunately, reference BIOS writers got wind of this
- * and put OSI(Linux) in their example code, quickly exposing
- * this string as ill-conceived and opening the door to
- * an un-bounded number of BIOS incompatibilities.
- *
- * For example, OSI(Linux) was used on resume to re-POST a
- * video card on one system, because Linux at that time
- * could not do a speedy restore in its native driver.
- * But then upon gaining quick native restore capability,
- * Linux has no way to tell the BIOS to skip the time-consuming
- * POST -- putting Linux at a permanent performance disadvantage.
- * On another system, the BIOS writer used OSI(Linux)
- * to infer native OS support for IPMI!  On other systems,
- * OSI(Linux) simply got in the way of Linux claiming to
- * be compatible with other operating systems, exposing
- * BIOS issues such as skipped device initialization.
- *
- * So "Linux" turned out to be a really poor chose of
- * OSI string, and from Linux-2.6.23 onward we respond FALSE.
- *
- * BIOS writers should NOT query _OSI(Linux) on future systems.
- * Linux will complain on the console when it sees it, and return FALSE.
- * To get Linux to return TRUE for your system  will require
- * a kernel source update to add a DMI entry,
- * or boot with "acpi_osi=Linux"
- */
-
-static struct osi_linux {
-	unsigned int	enable:1;
-	unsigned int	dmi:1;
-	unsigned int	cmdline:1;
-	unsigned int	default_disabling:1;
-} osi_linux = {0, 0, 0, 0};
-
 static void __init acpi_request_region (struct acpi_generic_address *gas,
 	unsigned int length, char *desc)
 {
@@ -1394,156 +1352,6 @@ static int __init acpi_os_name_setup(char *str)
 
 __setup("acpi_os_name=", acpi_os_name_setup);
 
-#define	OSI_STRING_LENGTH_MAX 64	/* arbitrary */
-#define	OSI_STRING_ENTRIES_MAX 16	/* arbitrary */
-
-struct osi_setup_entry {
-	char string[OSI_STRING_LENGTH_MAX];
-	bool enable;
-};
-
-static struct osi_setup_entry
-		osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = {
-	{"Module Device", true},
-	{"Processor Device", true},
-	{"3.0 _SCP Extensions", true},
-	{"Processor Aggregator Device", true},
-};
-
-void __init acpi_osi_setup(char *str)
-{
-	struct osi_setup_entry *osi;
-	bool enable = true;
-	int i;
-
-	if (!acpi_gbl_create_osi_method)
-		return;
-
-	if (str == NULL || *str == '\0') {
-		printk(KERN_INFO PREFIX "_OSI method disabled\n");
-		acpi_gbl_create_osi_method = FALSE;
-		return;
-	}
-
-	if (*str == '!') {
-		str++;
-		if (*str == '\0') {
-			osi_linux.default_disabling = 1;
-			return;
-		} else if (*str == '*') {
-			acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
-			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
-				osi = &osi_setup_entries[i];
-				osi->enable = false;
-			}
-			return;
-		}
-		enable = false;
-	}
-
-	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
-		osi = &osi_setup_entries[i];
-		if (!strcmp(osi->string, str)) {
-			osi->enable = enable;
-			break;
-		} else if (osi->string[0] == '\0') {
-			osi->enable = enable;
-			strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
-			break;
-		}
-	}
-}
-
-static void __init set_osi_linux(unsigned int enable)
-{
-	if (osi_linux.enable != enable)
-		osi_linux.enable = enable;
-
-	if (osi_linux.enable)
-		acpi_osi_setup("Linux");
-	else
-		acpi_osi_setup("!Linux");
-
-	return;
-}
-
-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;
-	set_osi_linux(enable);
-
-	return;
-}
-
-void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
-{
-	printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
-
-	if (enable == -1)
-		return;
-
-	osi_linux.dmi = 1;	/* DMI knows that this box asks OSI(Linux) */
-	set_osi_linux(enable);
-
-	return;
-}
-
-/*
- * Modify the list of "OS Interfaces" reported to BIOS via _OSI
- *
- * empty string disables _OSI
- * string starting with '!' disables that string
- * otherwise string is added to list, augmenting built-in strings
- */
-static void __init acpi_osi_setup_late(void)
-{
-	struct osi_setup_entry *osi;
-	char *str;
-	int i;
-	acpi_status status;
-
-	if (osi_linux.default_disabling) {
-		status = acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
-
-		if (ACPI_SUCCESS(status))
-			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n");
-	}
-
-	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
-		osi = &osi_setup_entries[i];
-		str = osi->string;
-
-		if (*str == '\0')
-			break;
-		if (osi->enable) {
-			status = acpi_install_interface(str);
-
-			if (ACPI_SUCCESS(status))
-				printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
-		} else {
-			status = acpi_remove_interface(str);
-
-			if (ACPI_SUCCESS(status))
-				printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
-		}
-	}
-}
-
-static int __init osi_setup(char *str)
-{
-	if (str && !strcmp("Linux", str))
-		acpi_cmdline_osi_linux(1);
-	else if (str && !strcmp("!Linux", str))
-		acpi_cmdline_osi_linux(0);
-	else
-		acpi_osi_setup(str);
-
-	return 1;
-}
-
-__setup("acpi_osi=", osi_setup);
-
 /*
  * Disable the auto-serialization of named objects creation methods.
  *
@@ -1828,7 +1636,6 @@ acpi_status __init acpi_os_initialize1(void)
 	BUG_ON(!kacpi_notify_wq);
 	BUG_ON(!kacpi_hotplug_wq);
 	acpi_install_interface_handler(acpi_osi_handler);
-	acpi_osi_setup_late();
 	return AE_OK;
 }
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ec18ab0..b345015 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -268,9 +268,6 @@ static inline int acpi_video_display_switch_support(void)
 
 #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
 
-extern int acpi_blacklisted(void);
-extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
-extern void acpi_osi_setup(char *str);
 extern u32 acpi_osi_handler(acpi_string interface, u32 supported);
 
 #ifdef CONFIG_ACPI_NUMA
-- 
2.1.0


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

* [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist
  2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
  2015-02-04  0:21 ` [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later al.stone
  2015-02-04  0:21 ` [PATCH v2 2/5] ACPI: move _OSI support functions to allow arch-dependent implementation al.stone
@ 2015-02-04  0:21 ` al.stone
  2015-02-04 14:00   ` Rafael J. Wysocki
  2015-02-04  0:21 ` [PATCH v2 4/5] ACPI: arm64: use the arch-specific ACPI _OSI method and ACPI blacklist al.stone
  2015-02-04  0:21 ` [PATCH v2 5/5] ACPI: arm64: use "Linux" as ACPI_OS_NAME for _OS on arm64 al.stone
  4 siblings, 1 reply; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

Now that all of the _OSI functionality has been separated out, we can
provide arch-specific functionality for it.  This also allows us to do
the same for the acpi_blacklisted() function.

Whether arch-specific functions are used or not now depends on the config
options CONFIG_ACPI_ARCH_SPECIFIC_OSI and CONFIG_ARCH_SPECIFIC_BLACKLIST.
By default, both are set false which causes the x86/ia64 versions to be
used, just as is done today.  Setting one or both of these options true
will cause architecture-specific implementations to be built instead; this
patch also provides arm64 implementations.

For x86/ia64, there is no functional change.

For arm64, any use of _OSI will issue a warning that it is deprecated.
All use of _OSI will return false -- i.e., it will return no useful
information to any firmware using it.  The ability to temporarily turn
on _OSI, or turn off _OSI, or affect it in other ways from the command
line is no longer available for arm64, either.  The blacklist for ACPI
on arm64 is empty.  This will, of course, require ACPI to be enabled
for arm64.

Signed-off-by: Al Stone <al.stone@linaro.org>
---
 drivers/acpi/Kconfig         | 22 ++++++++++++++++++++++
 drivers/acpi/Makefile        | 19 ++++++++++++++++++-
 drivers/acpi/blacklist-arm.c | 20 ++++++++++++++++++++
 drivers/acpi/blacklist.c     |  5 +++++
 drivers/acpi/osi-arm.c       | 25 +++++++++++++++++++++++++
 5 files changed, 90 insertions(+), 1 deletion(-)
 create mode 100644 drivers/acpi/blacklist-arm.c
 create mode 100644 drivers/acpi/osi-arm.c

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 3e3bd35..4190940 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -369,6 +369,28 @@ config ACPI_REDUCED_HARDWARE_ONLY
 
 	  If you are unsure what to do, do not enable this option.
 
+config ACPI_ARCH_SPECIFIC_OSI
+	bool "Use an arch-specific _OSI implementation" if EXPERT
+	def_bool n
+	help
+	  If this option is set, the ACPI driver will use an
+	  implementation of _OSI that is specific to the target
+	  architecture, instead of the default implementation
+	  originally created for x86 and then used on ia64.
+
+	  If you are unsure what to do, do not enable this option.
+
+config ACPI_ARCH_SPECIFIC_BLACKLIST
+	bool "Use an arch-specific ACPI blacklist" if EXPERT
+	def_bool n
+	help
+	  If this option is set, the ACPI driver will use a blacklist
+	  that is specific to the target architecture, instead of the
+	  default implementation originally created for x86 and then
+	  used on ia64.
+
+	  If you are unsure what to do, do not enable this option.
+
 source "drivers/acpi/apei/Kconfig"
 
 config ACPI_EXTLOG
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index df348b3..beefb17 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -18,9 +18,26 @@ obj-y				+= acpi.o \
 					acpica/
 
 # All the builtin files are in the "acpi." module_param namespace.
-acpi-y				+= osl.o utils.o reboot.o osi.o
+acpi-y				+= osl.o utils.o reboot.o
 acpi-y				+= nvs.o
 
+# _OSI related files
+ifeq ($(CONFIG_ACPI_ARCH_SPECIFIC_OSI), y)
+ifeq ($(ARCH), arm64)
+acpi-y				+= osi-arm.o
+endif
+else # X86, IA64
+acpi-y				+= osi.o
+endif
+
+ifeq ($(CONFIG_ACPI_ARCH_SPECIFIC_BLACKLIST), y)
+ifeq ($(ARCH), arm64)
+acpi-y				+= blacklist-arm.o
+endif
+else # X86, IA64
+acpi-y				+= blacklist.o
+endif
+
 # Power management related files
 acpi-y				+= wakeup.o
 ifeq ($(ARCH), arm64)
diff --git a/drivers/acpi/blacklist-arm.c b/drivers/acpi/blacklist-arm.c
new file mode 100644
index 0000000..1be6a56
--- /dev/null
+++ b/drivers/acpi/blacklist-arm.c
@@ -0,0 +1,20 @@
+/*
+ *  ARM64 Specific ACPI Blacklist Support
+ *
+ *  Copyright (C) 2015, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *
+ *  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 pr_fmt(fmt) "ACPI: " fmt
+
+#include <linux/acpi.h>
+
+/* The arm64 ACPI blacklist is currently empty.  */
+int __init acpi_blacklisted(void)
+{
+	return 0;
+}
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 3931e19..222c82d 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -34,9 +34,14 @@
 
 #include "internal.h"
 
+#ifdef CONFIG_ACPI_ARCH_SPECIFIC_OSI
+void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) { }
+void __init acpi_osi_setup(char *str) { }
+#else
 extern void __init acpi_dmi_osi_linux(int enable,
 				      const struct dmi_system_id *d);
 extern void __init acpi_osi_setup(char *str);
+#endif
 
 enum acpi_blacklist_predicates {
 	all_versions,
diff --git a/drivers/acpi/osi-arm.c b/drivers/acpi/osi-arm.c
new file mode 100644
index 0000000..bb351f4
--- /dev/null
+++ b/drivers/acpi/osi-arm.c
@@ -0,0 +1,25 @@
+/*
+ *  ARM64 Specific ACPI _OSI Support
+ *
+ *  Copyright (C) 2015, Linaro Ltd.
+ *	Author: Al Stone <al.stone@linaro.org>
+ *
+ *  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 pr_fmt(fmt) "ACPI: " fmt
+
+#include <linux/acpi.h>
+
+/*
+ * Consensus is to deprecate _OSI for all new ACPI-supported architectures.
+ * So, for arm64, reduce _OSI to a warning message, and tell the firmware
+ * nothing of value.
+ */
+u32 acpi_osi_handler(acpi_string interface, u32 supported)
+{
+	pr_warn("_OSI was called, but is deprecated for this architecture.\n");
+	return false;
+}
-- 
2.1.0


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

* [PATCH v2 4/5] ACPI: arm64: use the arch-specific ACPI _OSI method and ACPI blacklist
  2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
                   ` (2 preceding siblings ...)
  2015-02-04  0:21 ` [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist al.stone
@ 2015-02-04  0:21 ` al.stone
  2015-02-04  0:21 ` [PATCH v2 5/5] ACPI: arm64: use "Linux" as ACPI_OS_NAME for _OS on arm64 al.stone
  4 siblings, 0 replies; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

Set the defaults for the arm64 kernel so that the arch-specific _OSI
method and blacklist are always used for ACPI.

Signed-off-by: Al Stone <al.stone@linaro.org>
---
 arch/arm64/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 915aa16..d01d3f7 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,5 +1,7 @@
 config ARM64
 	def_bool y
+	select ACPI_ARCH_SPECIFIC_OSI if ACPI
+	select ACPI_ARCH_SPECIFIC_BLACKLIST if ACPI
 	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
 	select ARCH_BINFMT_ELF_RANDOMIZE_PIE
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
-- 
2.1.0


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

* [PATCH v2 5/5] ACPI: arm64: use "Linux" as ACPI_OS_NAME for _OS on arm64
  2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
                   ` (3 preceding siblings ...)
  2015-02-04  0:21 ` [PATCH v2 4/5] ACPI: arm64: use the arch-specific ACPI _OSI method and ACPI blacklist al.stone
@ 2015-02-04  0:21 ` al.stone
  4 siblings, 0 replies; 13+ messages in thread
From: al.stone @ 2015-02-04  0:21 UTC (permalink / raw)
  To: rjw, lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu
  Cc: linux-ia64, linux-kernel, linux-acpi, devel, linux-arm-kernel,
	linaro-acpi, linaro-kernel, patches

From: Al Stone <al.stone@linaro.org>

ACPI_OS_NAME is globally defined as "Microsoft Windows NT" for now.
That doesn't make much sense in the ARM context, so set it to "Linux"
when CONFIG_ARM64.

If it is necessary to change the return value from \_OS_ (that is, return
some value other than the default in ACPI_OS_NAME), use the kernel parameter
"acpi_os_name=<string>".

Many thanks to Rafael Wysocki for this greatly simplified form of the patch.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Al Stone <al.stone@linaro.org>
---
 arch/arm64/Kconfig              | 5 +++++
 include/acpi/acconfig.h         | 2 ++
 include/acpi/platform/aclinux.h | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index d01d3f7..9a13d28 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -88,6 +88,11 @@ config ARM64
 config 64BIT
 	def_bool y
 
+config ACPI_OS_NAME
+	string
+	default "Linux"
+	depends on ACPI
+
 config ARCH_PHYS_ADDR_T_64BIT
 	def_bool y
 
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 5a0a3e5..1980bf4 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -69,7 +69,9 @@
  * code that will not execute the _OSI method unless _OS matches the string
  * below.  Therefore, change this string at your own risk.
  */
+#ifndef ACPI_OS_NAME
 #define ACPI_OS_NAME                    "Microsoft Windows NT"
+#endif
 
 /* Maximum objects in the various object caches */
 
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 1ba7c19..a871cdd 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -69,6 +69,10 @@
 #define ACPI_REDUCED_HARDWARE 1
 #endif
 
+#ifdef CONFIG_ACPI_OS_NAME
+#define ACPI_OS_NAME CONFIG_ACPI_OS_NAME
+#endif
+
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
-- 
2.1.0


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

* Re: [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later
  2015-02-04  0:21 ` [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later al.stone
@ 2015-02-04 13:50   ` Rafael J. Wysocki
  2015-02-04 22:44     ` Al Stone
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2015-02-04 13:50 UTC (permalink / raw)
  To: al.stone
  Cc: lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu, linux-ia64, linux-kernel, linux-acpi, devel,
	linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On Tuesday, February 03, 2015 05:21:40 PM al.stone@linaro.org wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> In order to deprecate the use of _OSI for arm64 or other new architectures,
> we need to make the default handler something we can change for various
> platforms.  This patch moves the definition of acpi_osi_handler() -- the
> function used by ACPICA as a callback for evaluating _OSI -- into a separate
> file.  Subsequent patches will change which files get built so that we can
> then build the version of _OSI we need for a particular architecture.
> 
> There is no functional change.
> 
> Signed-off-by: Al Stone <al.stone@linaro.org>
> ---
>  drivers/acpi/Makefile |   2 +-
>  drivers/acpi/osi.c    | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/acpi/osl.c    |  24 ------------
>  include/linux/acpi.h  |   1 +
>  4 files changed, 102 insertions(+), 25 deletions(-)
>  create mode 100644 drivers/acpi/osi.c
> 
> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> index c346011..df348b3 100644
> --- a/drivers/acpi/Makefile
> +++ b/drivers/acpi/Makefile
> @@ -18,7 +18,7 @@ obj-y				+= acpi.o \
>  					acpica/
>  
>  # All the builtin files are in the "acpi." module_param namespace.
> -acpi-y				+= osl.o utils.o reboot.o
> +acpi-y				+= osl.o utils.o reboot.o osi.o
>  acpi-y				+= nvs.o
>  
>  # Power management related files
> diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
> new file mode 100644
> index 0000000..fff2b0c
> --- /dev/null
> +++ b/drivers/acpi/osi.c
> @@ -0,0 +1,100 @@
> +/*
> + *  osi.c - _OSI implementation (moved from drivers/acpi/osl.c)
> + *
> + *  Copyright (C) 2000       Andrew Henroid
> + *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
> + *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
> + *  Copyright (c) 2008 Intel Corporation
> + *   Author: Matthew Wilcox <willy@linux.intel.com>
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.

Nit: The street address of the FSF is not really useful here.  What if they move? :-)

> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + */
> +
> +#include <linux/acpi.h>
> +
> +#define _COMPONENT		ACPI_OS_SERVICES
> +ACPI_MODULE_NAME("osl");
> +
> +#define PREFIX			"ACPI: "
> +
> +/*
> + * The story of _OSI(Linux)
> + *
> + * From pre-history through Linux-2.6.22,
> + * Linux responded TRUE upon a BIOS OSI(Linux) query.
> + *
> + * Unfortunately, reference BIOS writers got wind of this
> + * and put OSI(Linux) in their example code, quickly exposing
> + * this string as ill-conceived and opening the door to
> + * an un-bounded number of BIOS incompatibilities.
> + *
> + * For example, OSI(Linux) was used on resume to re-POST a
> + * video card on one system, because Linux at that time
> + * could not do a speedy restore in its native driver.
> + * But then upon gaining quick native restore capability,
> + * Linux has no way to tell the BIOS to skip the time-consuming
> + * POST -- putting Linux at a permanent performance disadvantage.
> + * On another system, the BIOS writer used OSI(Linux)
> + * to infer native OS support for IPMI!  On other systems,
> + * OSI(Linux) simply got in the way of Linux claiming to
> + * be compatible with other operating systems, exposing
> + * BIOS issues such as skipped device initialization.
> + *
> + * So "Linux" turned out to be a really poor chose of
> + * OSI string, and from Linux-2.6.23 onward we respond FALSE.
> + *
> + * BIOS writers should NOT query _OSI(Linux) on future systems.
> + * Linux will complain on the console when it sees it, and return FALSE.
> + * To get Linux to return TRUE for your system  will require
> + * a kernel source update to add a DMI entry,
> + * or boot with "acpi_osi=Linux"
> + */
> +
> +static struct osi_linux {
> +	unsigned int	enable:1;
> +	unsigned int	dmi:1;
> +	unsigned int	cmdline:1;
> +	unsigned int	default_disabling:1;
> +} osi_linux = {0, 0, 0, 0};
> +
> +u32 acpi_osi_handler(acpi_string interface, u32 supported)
> +{
> +	if (!strcmp("Linux", interface)) {
> +
> +		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" : "");
> +	}
> +
> +	if (!strcmp("Darwin", interface)) {
> +		/*
> +		 * Apple firmware will behave poorly if it receives positive
> +		 * answers to "Darwin" and any other OS. Respond positively
> +		 * to Darwin and then disable all other vendor strings.
> +		 */
> +		acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
> +		supported = ACPI_UINT32_MAX;
> +	}
> +
> +	return supported;
> +}
> +
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index f9eeae8..c7f1cd6 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -141,30 +141,6 @@ static struct osi_linux {
>  	unsigned int	default_disabling:1;
>  } osi_linux = {0, 0, 0, 0};
>  
> -static u32 acpi_osi_handler(acpi_string interface, u32 supported)
> -{
> -	if (!strcmp("Linux", interface)) {
> -
> -		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" : "");
> -	}
> -
> -	if (!strcmp("Darwin", interface)) {
> -		/*
> -		 * Apple firmware will behave poorly if it receives positive
> -		 * answers to "Darwin" and any other OS. Respond positively
> -		 * to Darwin and then disable all other vendor strings.
> -		 */
> -		acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
> -		supported = ACPI_UINT32_MAX;
> -	}
> -
> -	return supported;
> -}
> -
>  static void __init acpi_request_region (struct acpi_generic_address *gas,
>  	unsigned int length, char *desc)
>  {
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 87f365e..ec18ab0 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -271,6 +271,7 @@ static inline int acpi_video_display_switch_support(void)
>  extern int acpi_blacklisted(void);
>  extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
>  extern void acpi_osi_setup(char *str);
> +extern u32 acpi_osi_handler(acpi_string interface, u32 supported);
>  
>  #ifdef CONFIG_ACPI_NUMA
>  int acpi_get_node(acpi_handle handle);
> 

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

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

* Re: [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist
  2015-02-04  0:21 ` [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist al.stone
@ 2015-02-04 14:00   ` Rafael J. Wysocki
  2015-02-04 14:03     ` Rafael J. Wysocki
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2015-02-04 14:00 UTC (permalink / raw)
  To: al.stone
  Cc: lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu, linux-ia64, linux-kernel, linux-acpi, devel,
	linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On Tuesday, February 03, 2015 05:21:42 PM al.stone@linaro.org wrote:
> From: Al Stone <al.stone@linaro.org>
> 
> Now that all of the _OSI functionality has been separated out, we can
> provide arch-specific functionality for it.  This also allows us to do
> the same for the acpi_blacklisted() function.
> 
> Whether arch-specific functions are used or not now depends on the config
> options CONFIG_ACPI_ARCH_SPECIFIC_OSI and CONFIG_ARCH_SPECIFIC_BLACKLIST.
> By default, both are set false which causes the x86/ia64 versions to be
> used, just as is done today.  Setting one or both of these options true
> will cause architecture-specific implementations to be built instead; this
> patch also provides arm64 implementations.
> 
> For x86/ia64, there is no functional change.
> 
> For arm64, any use of _OSI will issue a warning that it is deprecated.
> All use of _OSI will return false -- i.e., it will return no useful
> information to any firmware using it.  The ability to temporarily turn
> on _OSI, or turn off _OSI, or affect it in other ways from the command
> line is no longer available for arm64, either.  The blacklist for ACPI
> on arm64 is empty.  This will, of course, require ACPI to be enabled
> for arm64.
> 
> Signed-off-by: Al Stone <al.stone@linaro.org>
> ---
>  drivers/acpi/Kconfig         | 22 ++++++++++++++++++++++
>  drivers/acpi/Makefile        | 19 ++++++++++++++++++-
>  drivers/acpi/blacklist-arm.c | 20 ++++++++++++++++++++
>  drivers/acpi/blacklist.c     |  5 +++++
>  drivers/acpi/osi-arm.c       | 25 +++++++++++++++++++++++++
>  5 files changed, 90 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/acpi/blacklist-arm.c
>  create mode 100644 drivers/acpi/osi-arm.c
> 
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 3e3bd35..4190940 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -369,6 +369,28 @@ config ACPI_REDUCED_HARDWARE_ONLY
>  
>  	  If you are unsure what to do, do not enable this option.
>  
> +config ACPI_ARCH_SPECIFIC_OSI

I woulnd't make this and the other one user-selectable.  Let architectures
select them from their top-level Kconfig files.

That's what we do with the other CONFIG_ARCH_ things.

So in the architecture-specific Kconfig you'll have

config ACPI_ARCH_SPECIFIC_OSI
	def_bool n
	depends on ACPI

Moreover, I'd call that ARCH_SPECIFIC_ACPI_OSI.

And analogously for the blacklist thing (and do we need two of them really?).

> +	bool "Use an arch-specific _OSI implementation" if EXPERT
> +	def_bool n
> +	help
> +	  If this option is set, the ACPI driver will use an
> +	  implementation of _OSI that is specific to the target
> +	  architecture, instead of the default implementation
> +	  originally created for x86 and then used on ia64.
> +
> +	  If you are unsure what to do, do not enable this option.
> +
> +config ACPI_ARCH_SPECIFIC_BLACKLIST
> +	bool "Use an arch-specific ACPI blacklist" if EXPERT
> +	def_bool n
> +	help
> +	  If this option is set, the ACPI driver will use a blacklist
> +	  that is specific to the target architecture, instead of the
> +	  default implementation originally created for x86 and then
> +	  used on ia64.
> +
> +	  If you are unsure what to do, do not enable this option.
> +
>  source "drivers/acpi/apei/Kconfig"
>  
>  config ACPI_EXTLOG
> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> index df348b3..beefb17 100644
> --- a/drivers/acpi/Makefile
> +++ b/drivers/acpi/Makefile
> @@ -18,9 +18,26 @@ obj-y				+= acpi.o \
>  					acpica/
>  
>  # All the builtin files are in the "acpi." module_param namespace.
> -acpi-y				+= osl.o utils.o reboot.o osi.o
> +acpi-y				+= osl.o utils.o reboot.o
>  acpi-y				+= nvs.o
>  
> +# _OSI related files
> +ifeq ($(CONFIG_ACPI_ARCH_SPECIFIC_OSI), y)
> +ifeq ($(ARCH), arm64)
> +acpi-y				+= osi-arm.o

No, no.  Please no osi-arm.c or blacklist-arm.c in drivers/acpi/.
The arch-specific stuff needs to go into arch/

> +endif
> +else # X86, IA64
> +acpi-y				+= osi.o
> +endif
> +
> +ifeq ($(CONFIG_ACPI_ARCH_SPECIFIC_BLACKLIST), y)
> +ifeq ($(ARCH), arm64)
> +acpi-y				+= blacklist-arm.o
> +endif
> +else # X86, IA64
> +acpi-y				+= blacklist.o
> +endif
> +
>  # Power management related files
>  acpi-y				+= wakeup.o
>  ifeq ($(ARCH), arm64)
> diff --git a/drivers/acpi/blacklist-arm.c b/drivers/acpi/blacklist-arm.c
> new file mode 100644
> index 0000000..1be6a56
> --- /dev/null
> +++ b/drivers/acpi/blacklist-arm.c
> @@ -0,0 +1,20 @@
> +/*
> + *  ARM64 Specific ACPI Blacklist Support
> + *
> + *  Copyright (C) 2015, Linaro Ltd.
> + *	Author: Al Stone <al.stone@linaro.org>
> + *
> + *  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 pr_fmt(fmt) "ACPI: " fmt
> +
> +#include <linux/acpi.h>
> +
> +/* The arm64 ACPI blacklist is currently empty.  */
> +int __init acpi_blacklisted(void)
> +{
> +	return 0;
> +}
> diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
> index 3931e19..222c82d 100644
> --- a/drivers/acpi/blacklist.c
> +++ b/drivers/acpi/blacklist.c
> @@ -34,9 +34,14 @@
>  
>  #include "internal.h"
>  
> +#ifdef CONFIG_ACPI_ARCH_SPECIFIC_OSI
> +void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) { }
> +void __init acpi_osi_setup(char *str) { }
> +#else
>  extern void __init acpi_dmi_osi_linux(int enable,
>  				      const struct dmi_system_id *d);
>  extern void __init acpi_osi_setup(char *str);
> +#endif
>  
>  enum acpi_blacklist_predicates {
>  	all_versions,
> diff --git a/drivers/acpi/osi-arm.c b/drivers/acpi/osi-arm.c
> new file mode 100644
> index 0000000..bb351f4
> --- /dev/null
> +++ b/drivers/acpi/osi-arm.c
> @@ -0,0 +1,25 @@
> +/*
> + *  ARM64 Specific ACPI _OSI Support
> + *
> + *  Copyright (C) 2015, Linaro Ltd.
> + *	Author: Al Stone <al.stone@linaro.org>
> + *
> + *  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 pr_fmt(fmt) "ACPI: " fmt
> +
> +#include <linux/acpi.h>
> +
> +/*
> + * Consensus is to deprecate _OSI for all new ACPI-supported architectures.
> + * So, for arm64, reduce _OSI to a warning message, and tell the firmware
> + * nothing of value.
> + */
> +u32 acpi_osi_handler(acpi_string interface, u32 supported)
> +{
> +	pr_warn("_OSI was called, but is deprecated for this architecture.\n");
> +	return false;
> +}
> 

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

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

* Re: [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist
  2015-02-04 14:00   ` Rafael J. Wysocki
@ 2015-02-04 14:03     ` Rafael J. Wysocki
  2015-02-04 22:46       ` Al Stone
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2015-02-04 14:03 UTC (permalink / raw)
  To: al.stone
  Cc: lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu, linux-ia64, linux-kernel, linux-acpi, devel,
	linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On Wednesday, February 04, 2015 03:00:15 PM Rafael J. Wysocki wrote:
> On Tuesday, February 03, 2015 05:21:42 PM al.stone@linaro.org wrote:
> > From: Al Stone <al.stone@linaro.org>
> > 
> > Now that all of the _OSI functionality has been separated out, we can
> > provide arch-specific functionality for it.  This also allows us to do
> > the same for the acpi_blacklisted() function.
> > 
> > Whether arch-specific functions are used or not now depends on the config
> > options CONFIG_ACPI_ARCH_SPECIFIC_OSI and CONFIG_ARCH_SPECIFIC_BLACKLIST.
> > By default, both are set false which causes the x86/ia64 versions to be
> > used, just as is done today.  Setting one or both of these options true
> > will cause architecture-specific implementations to be built instead; this
> > patch also provides arm64 implementations.
> > 
> > For x86/ia64, there is no functional change.
> > 
> > For arm64, any use of _OSI will issue a warning that it is deprecated.
> > All use of _OSI will return false -- i.e., it will return no useful
> > information to any firmware using it.  The ability to temporarily turn
> > on _OSI, or turn off _OSI, or affect it in other ways from the command
> > line is no longer available for arm64, either.  The blacklist for ACPI
> > on arm64 is empty.  This will, of course, require ACPI to be enabled
> > for arm64.
> > 
> > Signed-off-by: Al Stone <al.stone@linaro.org>
> > ---
> >  drivers/acpi/Kconfig         | 22 ++++++++++++++++++++++
> >  drivers/acpi/Makefile        | 19 ++++++++++++++++++-
> >  drivers/acpi/blacklist-arm.c | 20 ++++++++++++++++++++
> >  drivers/acpi/blacklist.c     |  5 +++++
> >  drivers/acpi/osi-arm.c       | 25 +++++++++++++++++++++++++
> >  5 files changed, 90 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/acpi/blacklist-arm.c
> >  create mode 100644 drivers/acpi/osi-arm.c
> > 
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 3e3bd35..4190940 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -369,6 +369,28 @@ config ACPI_REDUCED_HARDWARE_ONLY
> >  
> >  	  If you are unsure what to do, do not enable this option.
> >  
> > +config ACPI_ARCH_SPECIFIC_OSI
> 
> I woulnd't make this and the other one user-selectable.  Let architectures
> select them from their top-level Kconfig files.
> 
> That's what we do with the other CONFIG_ARCH_ things.
> 
> So in the architecture-specific Kconfig you'll have
> 
> config ACPI_ARCH_SPECIFIC_OSI
> 	def_bool n
> 	depends on ACPI
> 
> Moreover, I'd call that ARCH_SPECIFIC_ACPI_OSI.

Or even better, you can define them here (drivers/acpi/Kconfig/) as

config ARCH_SPECIFIC_ACPI_OSI
	def_bool n

and then do

	select ARCH_SPECIFIC_ACPI_OSI if ACPI

as you did in [4/5].


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

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

* Re: [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later
  2015-02-04 13:50   ` Rafael J. Wysocki
@ 2015-02-04 22:44     ` Al Stone
  2015-02-04 23:21       ` Rafael J. Wysocki
  0 siblings, 1 reply; 13+ messages in thread
From: Al Stone @ 2015-02-04 22:44 UTC (permalink / raw)
  To: Rafael J. Wysocki, al.stone
  Cc: lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu, linux-ia64, linux-kernel, linux-acpi, devel,
	linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On 02/04/2015 06:50 AM, Rafael J. Wysocki wrote:
> On Tuesday, February 03, 2015 05:21:40 PM al.stone@linaro.org wrote:
>> From: Al Stone <al.stone@linaro.org>
>>
>> In order to deprecate the use of _OSI for arm64 or other new architectures,
>> we need to make the default handler something we can change for various
>> platforms.  This patch moves the definition of acpi_osi_handler() -- the
>> function used by ACPICA as a callback for evaluating _OSI -- into a separate
>> file.  Subsequent patches will change which files get built so that we can
>> then build the version of _OSI we need for a particular architecture.
>>
>> There is no functional change.
>>
>> Signed-off-by: Al Stone <al.stone@linaro.org>
>> ---
>>  drivers/acpi/Makefile |   2 +-
>>  drivers/acpi/osi.c    | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>  drivers/acpi/osl.c    |  24 ------------
>>  include/linux/acpi.h  |   1 +
>>  4 files changed, 102 insertions(+), 25 deletions(-)
>>  create mode 100644 drivers/acpi/osi.c
>>
>> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
>> index c346011..df348b3 100644
>> --- a/drivers/acpi/Makefile
>> +++ b/drivers/acpi/Makefile
>> @@ -18,7 +18,7 @@ obj-y				+= acpi.o \
>>  					acpica/
>>  
>>  # All the builtin files are in the "acpi." module_param namespace.
>> -acpi-y				+= osl.o utils.o reboot.o
>> +acpi-y				+= osl.o utils.o reboot.o osi.o
>>  acpi-y				+= nvs.o
>>  
>>  # Power management related files
>> diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
>> new file mode 100644
>> index 0000000..fff2b0c
>> --- /dev/null
>> +++ b/drivers/acpi/osi.c
>> @@ -0,0 +1,100 @@
>> +/*
>> + *  osi.c - _OSI implementation (moved from drivers/acpi/osl.c)
>> + *
>> + *  Copyright (C) 2000       Andrew Henroid
>> + *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
>> + *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
>> + *  Copyright (c) 2008 Intel Corporation
>> + *   Author: Matthew Wilcox <willy@linux.intel.com>
>> + *
>> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> + *
>> + *  This program is free software; you can redistribute it and/or modify
>> + *  it under the terms of the GNU General Public License as published by
>> + *  the Free Software Foundation; either version 2 of the License, or
>> + *  (at your option) any later version.
>> + *
>> + *  This program is distributed in the hope that it will be useful,
>> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + *  GNU General Public License for more details.
> 
> Nit: The street address of the FSF is not really useful here.  What if they move? :-)

This was one of the things checkpatch complained about, understandably :).  It's
a direct cut'n'paste from osl.c.

I can clean these up in the new file; would it help to clean up osl.c (at least
from checkpatch's point of view), as long as I'm at it?

>> + *
>> + *  You should have received a copy of the GNU General Public License
>> + *  along with this program; if not, write to the Free Software
>> + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>> + *
>> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> + *
>> + */
[snip...]

-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
ahs3@redhat.com
-----------------------------------

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

* Re: [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist
  2015-02-04 14:03     ` Rafael J. Wysocki
@ 2015-02-04 22:46       ` Al Stone
  0 siblings, 0 replies; 13+ messages in thread
From: Al Stone @ 2015-02-04 22:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, al.stone
  Cc: fenghua.yu, tony.luck, linux-ia64, linaro-acpi, catalin.marinas,
	patches, will.deacon, robert.moore, linux-kernel, linux-acpi,
	linaro-kernel, devel, linux-arm-kernel, lenb

On 02/04/2015 07:03 AM, Rafael J. Wysocki wrote:
> On Wednesday, February 04, 2015 03:00:15 PM Rafael J. Wysocki wrote:
>> On Tuesday, February 03, 2015 05:21:42 PM al.stone@linaro.org wrote:
>>> From: Al Stone <al.stone@linaro.org>
>>>
>>> Now that all of the _OSI functionality has been separated out, we can
>>> provide arch-specific functionality for it.  This also allows us to do
>>> the same for the acpi_blacklisted() function.
>>>
>>> Whether arch-specific functions are used or not now depends on the config
>>> options CONFIG_ACPI_ARCH_SPECIFIC_OSI and CONFIG_ARCH_SPECIFIC_BLACKLIST.
>>> By default, both are set false which causes the x86/ia64 versions to be
>>> used, just as is done today.  Setting one or both of these options true
>>> will cause architecture-specific implementations to be built instead; this
>>> patch also provides arm64 implementations.
>>>
>>> For x86/ia64, there is no functional change.
>>>
>>> For arm64, any use of _OSI will issue a warning that it is deprecated.
>>> All use of _OSI will return false -- i.e., it will return no useful
>>> information to any firmware using it.  The ability to temporarily turn
>>> on _OSI, or turn off _OSI, or affect it in other ways from the command
>>> line is no longer available for arm64, either.  The blacklist for ACPI
>>> on arm64 is empty.  This will, of course, require ACPI to be enabled
>>> for arm64.
>>>
>>> Signed-off-by: Al Stone <al.stone@linaro.org>
>>> ---
>>>  drivers/acpi/Kconfig         | 22 ++++++++++++++++++++++
>>>  drivers/acpi/Makefile        | 19 ++++++++++++++++++-
>>>  drivers/acpi/blacklist-arm.c | 20 ++++++++++++++++++++
>>>  drivers/acpi/blacklist.c     |  5 +++++
>>>  drivers/acpi/osi-arm.c       | 25 +++++++++++++++++++++++++
>>>  5 files changed, 90 insertions(+), 1 deletion(-)
>>>  create mode 100644 drivers/acpi/blacklist-arm.c
>>>  create mode 100644 drivers/acpi/osi-arm.c
>>>
>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>> index 3e3bd35..4190940 100644
>>> --- a/drivers/acpi/Kconfig
>>> +++ b/drivers/acpi/Kconfig
>>> @@ -369,6 +369,28 @@ config ACPI_REDUCED_HARDWARE_ONLY
>>>  
>>>  	  If you are unsure what to do, do not enable this option.
>>>  
>>> +config ACPI_ARCH_SPECIFIC_OSI
>>
>> I woulnd't make this and the other one user-selectable.  Let architectures
>> select them from their top-level Kconfig files.
>>
>> That's what we do with the other CONFIG_ARCH_ things.
>>
>> So in the architecture-specific Kconfig you'll have
>>
>> config ACPI_ARCH_SPECIFIC_OSI
>> 	def_bool n
>> 	depends on ACPI
>>
>> Moreover, I'd call that ARCH_SPECIFIC_ACPI_OSI.
> 
> Or even better, you can define them here (drivers/acpi/Kconfig/) as
> 
> config ARCH_SPECIFIC_ACPI_OSI
> 	def_bool n
> 
> and then do
> 
> 	select ARCH_SPECIFIC_ACPI_OSI if ACPI
> 
> as you did in [4/5].
> 
> 

Ah, indeed I did.  Okay; I'll touch that up.

-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
ahs3@redhat.com
-----------------------------------

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

* Re: [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later
  2015-02-04 22:44     ` Al Stone
@ 2015-02-04 23:21       ` Rafael J. Wysocki
  2015-02-04 23:49         ` Al Stone
  0 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2015-02-04 23:21 UTC (permalink / raw)
  To: Al Stone
  Cc: al.stone, lenb, catalin.marinas, will.deacon, robert.moore,
	tony.luck, fenghua.yu, linux-ia64, linux-kernel, linux-acpi,
	devel, linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On Wednesday, February 04, 2015 03:44:50 PM Al Stone wrote:
> On 02/04/2015 06:50 AM, Rafael J. Wysocki wrote:
> > On Tuesday, February 03, 2015 05:21:40 PM al.stone@linaro.org wrote:
> >> From: Al Stone <al.stone@linaro.org>
> >>
> >> In order to deprecate the use of _OSI for arm64 or other new architectures,
> >> we need to make the default handler something we can change for various
> >> platforms.  This patch moves the definition of acpi_osi_handler() -- the
> >> function used by ACPICA as a callback for evaluating _OSI -- into a separate
> >> file.  Subsequent patches will change which files get built so that we can
> >> then build the version of _OSI we need for a particular architecture.
> >>
> >> There is no functional change.
> >>
> >> Signed-off-by: Al Stone <al.stone@linaro.org>
> >> ---
> >>  drivers/acpi/Makefile |   2 +-
> >>  drivers/acpi/osi.c    | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >>  drivers/acpi/osl.c    |  24 ------------
> >>  include/linux/acpi.h  |   1 +
> >>  4 files changed, 102 insertions(+), 25 deletions(-)
> >>  create mode 100644 drivers/acpi/osi.c
> >>
> >> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> >> index c346011..df348b3 100644
> >> --- a/drivers/acpi/Makefile
> >> +++ b/drivers/acpi/Makefile
> >> @@ -18,7 +18,7 @@ obj-y				+= acpi.o \
> >>  					acpica/
> >>  
> >>  # All the builtin files are in the "acpi." module_param namespace.
> >> -acpi-y				+= osl.o utils.o reboot.o
> >> +acpi-y				+= osl.o utils.o reboot.o osi.o
> >>  acpi-y				+= nvs.o
> >>  
> >>  # Power management related files
> >> diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
> >> new file mode 100644
> >> index 0000000..fff2b0c
> >> --- /dev/null
> >> +++ b/drivers/acpi/osi.c
> >> @@ -0,0 +1,100 @@
> >> +/*
> >> + *  osi.c - _OSI implementation (moved from drivers/acpi/osl.c)
> >> + *
> >> + *  Copyright (C) 2000       Andrew Henroid
> >> + *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
> >> + *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
> >> + *  Copyright (c) 2008 Intel Corporation
> >> + *   Author: Matthew Wilcox <willy@linux.intel.com>
> >> + *
> >> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> + *
> >> + *  This program is free software; you can redistribute it and/or modify
> >> + *  it under the terms of the GNU General Public License as published by
> >> + *  the Free Software Foundation; either version 2 of the License, or
> >> + *  (at your option) any later version.
> >> + *
> >> + *  This program is distributed in the hope that it will be useful,
> >> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> + *  GNU General Public License for more details.
> > 
> > Nit: The street address of the FSF is not really useful here.  What if they move? :-)
> 
> This was one of the things checkpatch complained about, understandably :).  It's
> a direct cut'n'paste from osl.c.
> 
> I can clean these up in the new file; would it help to clean up osl.c (at least
> from checkpatch's point of view), as long as I'm at it?

Yeah, won't hurt. :-)

In a separate patch please, though.


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

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

* Re: [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later
  2015-02-04 23:21       ` Rafael J. Wysocki
@ 2015-02-04 23:49         ` Al Stone
  0 siblings, 0 replies; 13+ messages in thread
From: Al Stone @ 2015-02-04 23:49 UTC (permalink / raw)
  To: Rafael J. Wysocki, Al Stone
  Cc: lenb, catalin.marinas, will.deacon, robert.moore, tony.luck,
	fenghua.yu, linux-ia64, linux-kernel, linux-acpi, devel,
	linux-arm-kernel, linaro-acpi, linaro-kernel, patches

On 02/04/2015 04:21 PM, Rafael J. Wysocki wrote:
> On Wednesday, February 04, 2015 03:44:50 PM Al Stone wrote:
>> On 02/04/2015 06:50 AM, Rafael J. Wysocki wrote:
>>> On Tuesday, February 03, 2015 05:21:40 PM al.stone@linaro.org wrote:
>>>> From: Al Stone <al.stone@linaro.org>
>>>>
>>>> In order to deprecate the use of _OSI for arm64 or other new architectures,
>>>> we need to make the default handler something we can change for various
>>>> platforms.  This patch moves the definition of acpi_osi_handler() -- the
>>>> function used by ACPICA as a callback for evaluating _OSI -- into a separate
>>>> file.  Subsequent patches will change which files get built so that we can
>>>> then build the version of _OSI we need for a particular architecture.
>>>>
>>>> There is no functional change.
>>>>
>>>> Signed-off-by: Al Stone <al.stone@linaro.org>
>>>> ---
>>>>  drivers/acpi/Makefile |   2 +-
>>>>  drivers/acpi/osi.c    | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>  drivers/acpi/osl.c    |  24 ------------
>>>>  include/linux/acpi.h  |   1 +
>>>>  4 files changed, 102 insertions(+), 25 deletions(-)
>>>>  create mode 100644 drivers/acpi/osi.c
>>>>
>>>> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
>>>> index c346011..df348b3 100644
>>>> --- a/drivers/acpi/Makefile
>>>> +++ b/drivers/acpi/Makefile
>>>> @@ -18,7 +18,7 @@ obj-y				+= acpi.o \
>>>>  					acpica/
>>>>  
>>>>  # All the builtin files are in the "acpi." module_param namespace.
>>>> -acpi-y				+= osl.o utils.o reboot.o
>>>> +acpi-y				+= osl.o utils.o reboot.o osi.o
>>>>  acpi-y				+= nvs.o
>>>>  
>>>>  # Power management related files
>>>> diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
>>>> new file mode 100644
>>>> index 0000000..fff2b0c
>>>> --- /dev/null
>>>> +++ b/drivers/acpi/osi.c
>>>> @@ -0,0 +1,100 @@
>>>> +/*
>>>> + *  osi.c - _OSI implementation (moved from drivers/acpi/osl.c)
>>>> + *
>>>> + *  Copyright (C) 2000       Andrew Henroid
>>>> + *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
>>>> + *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
>>>> + *  Copyright (c) 2008 Intel Corporation
>>>> + *   Author: Matthew Wilcox <willy@linux.intel.com>
>>>> + *
>>>> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> + *
>>>> + *  This program is free software; you can redistribute it and/or modify
>>>> + *  it under the terms of the GNU General Public License as published by
>>>> + *  the Free Software Foundation; either version 2 of the License, or
>>>> + *  (at your option) any later version.
>>>> + *
>>>> + *  This program is distributed in the hope that it will be useful,
>>>> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>>> + *  GNU General Public License for more details.
>>>
>>> Nit: The street address of the FSF is not really useful here.  What if they move? :-)
>>
>> This was one of the things checkpatch complained about, understandably :).  It's
>> a direct cut'n'paste from osl.c.
>>
>> I can clean these up in the new file; would it help to clean up osl.c (at least
>> from checkpatch's point of view), as long as I'm at it?
> 
> Yeah, won't hurt. :-)
> 
> In a separate patch please, though.
> 
> 

Of course.  Will do.

-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Linaro Enterprise Group
al.stone@linaro.org
-----------------------------------

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

end of thread, other threads:[~2015-02-04 23:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04  0:21 [PATCH v2 0/5] Start deprecating _OSI on new architectures al.stone
2015-02-04  0:21 ` [PATCH v2 1/5] ACPI: move acpi_os_handler() so it can be made arch-dependent later al.stone
2015-02-04 13:50   ` Rafael J. Wysocki
2015-02-04 22:44     ` Al Stone
2015-02-04 23:21       ` Rafael J. Wysocki
2015-02-04 23:49         ` Al Stone
2015-02-04  0:21 ` [PATCH v2 2/5] ACPI: move _OSI support functions to allow arch-dependent implementation al.stone
2015-02-04  0:21 ` [PATCH v2 3/5] ACPI: add arch-specific compilation for _OSI and the blacklist al.stone
2015-02-04 14:00   ` Rafael J. Wysocki
2015-02-04 14:03     ` Rafael J. Wysocki
2015-02-04 22:46       ` Al Stone
2015-02-04  0:21 ` [PATCH v2 4/5] ACPI: arm64: use the arch-specific ACPI _OSI method and ACPI blacklist al.stone
2015-02-04  0:21 ` [PATCH v2 5/5] ACPI: arm64: use "Linux" as ACPI_OS_NAME for _OS on arm64 al.stone

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