All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Garrett <matthew.garrett@nebula.com>
To: linux-acpi@vger.kernel.org
Cc: seth.forshee@canonical.com, joeyli.kernel@gmail.com,
	daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	lenb@kernel.org, rjw@sisk.pl,
	Matthew Garrett <matthew.garrett@nebula.com>
Subject: [PATCH 2/3] ACPICA: Add interface for getting latest OS version requested via _OSI
Date: Sun,  9 Jun 2013 19:01:38 -0400	[thread overview]
Message-ID: <1370818899-8595-3-git-send-email-matthew.garrett@nebula.com> (raw)
In-Reply-To: <1370818899-8595-1-git-send-email-matthew.garrett@nebula.com>

Drivers may need to make policy decisions based on the OS that the firmware
believes it's interacting with. ACPI firmware will make a series of _OSI
calls, starting from the oldest OS version they support and ending with the
most recent. Add a function to return the last successful call so that
drivers know what the firmware's expecting.

Based on a patch by Seth Forshee <seth.forshee@canonical.com>

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/acpi/acpica/aclocal.h | 13 -------------
 drivers/acpi/acpica/utxface.c | 19 +++++++++++++++++++
 include/acpi/acpixf.h         | 22 ++++++++++++++++++++++
 3 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index d5bfbd3..8a2f532 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -948,19 +948,6 @@ struct acpi_bit_register_info {
 
 /* Structs and definitions for _OSI support and I/O port validation */
 
-#define ACPI_OSI_WIN_2000               0x01
-#define ACPI_OSI_WIN_XP                 0x02
-#define ACPI_OSI_WIN_XP_SP1             0x03
-#define ACPI_OSI_WINSRV_2003            0x04
-#define ACPI_OSI_WIN_XP_SP2             0x05
-#define ACPI_OSI_WINSRV_2003_SP1        0x06
-#define ACPI_OSI_WIN_VISTA              0x07
-#define ACPI_OSI_WINSRV_2008            0x08
-#define ACPI_OSI_WIN_VISTA_SP1          0x09
-#define ACPI_OSI_WIN_VISTA_SP2          0x0A
-#define ACPI_OSI_WIN_7                  0x0B
-#define ACPI_OSI_WIN_8                  0x0C
-
 #define ACPI_ALWAYS_ILLEGAL             0x00
 
 struct acpi_interface_info {
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 6505774..c1638c3 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -389,6 +389,25 @@ ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
 
 /*****************************************************************************
  *
+ * FUNCTION:    acpi_osi_version
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Last OS version requested via _OSI
+ *
+ * DESCRIPTION: Returns the argument to the most recent _OSI query performed
+ *		by the firmware
+ *
+ ****************************************************************************/
+u8 acpi_osi_version(void)
+{
+	return acpi_gbl_osi_data;
+}
+
+ACPI_EXPORT_SYMBOL(acpi_osi_version)
+
+/*****************************************************************************
+ *
  * FUNCTION:    acpi_check_address_range
  *
  * PARAMETERS:  space_id            - Address space ID
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 454881e..41d3ac1 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -82,6 +82,22 @@ extern u8 acpi_gbl_truncate_io_addresses;
 extern u8 acpi_gbl_disable_auto_repair;
 
 /*
+ * Values returned by acpi_osi_version()
+ */
+#define ACPI_OSI_WIN_2000               0x01
+#define ACPI_OSI_WIN_XP                 0x02
+#define ACPI_OSI_WIN_XP_SP1             0x03
+#define ACPI_OSI_WINSRV_2003            0x04
+#define ACPI_OSI_WIN_XP_SP2             0x05
+#define ACPI_OSI_WINSRV_2003_SP1        0x06
+#define ACPI_OSI_WIN_VISTA              0x07
+#define ACPI_OSI_WINSRV_2008            0x08
+#define ACPI_OSI_WIN_VISTA_SP1          0x09
+#define ACPI_OSI_WIN_VISTA_SP2          0x0A
+#define ACPI_OSI_WIN_7                  0x0B
+#define ACPI_OSI_WIN_8                  0x0C
+
+/*
  * Hardware-reduced prototypes. All interfaces that use these macros will
  * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
  * is set to TRUE.
@@ -307,6 +323,12 @@ acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type,
 					acpi_notify_handler handler,
 					void *context);
 
+#ifdef CONFIG_ACPI
+u8 acpi_osi_version(void);
+#else
+static inline u8 acpi_osi_version(void) { return 0; }
+#endif
+
 acpi_status
 acpi_remove_notify_handler(acpi_handle device,
 			   u32 handler_type, acpi_notify_handler handler);
-- 
1.8.2.1

  parent reply	other threads:[~2013-06-09 23:01 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09 23:01 [PATCH 0/3] Fix backlight issues on some Windows 8 systems Matthew Garrett
2013-06-09 23:01 ` [PATCH 1/3] acpi: video: add function to support unregister backlight interface Matthew Garrett
2013-06-09 23:01 ` Matthew Garrett [this message]
2013-06-17 22:31   ` [PATCH 2/3] ACPICA: Add interface for getting latest OS version requested via _OSI Rafael J. Wysocki
2013-06-17 22:37     ` Matthew Garrett
2013-06-17 22:37       ` Matthew Garrett
2013-06-18  0:42       ` Rafael J. Wysocki
2013-06-25 23:23         ` Rafael J. Wysocki
2013-07-02 13:56           ` [PATCH 0/2] Expose OSI version Aaron Lu
2013-07-02 13:59             ` [PATCH 1/2] ACPICA: expose " Aaron Lu
2013-07-02 14:01             ` [PATCH 2/2] ACPI / OSL: add a wrapper function to return " Aaron Lu
2013-07-03 21:57               ` Rafael J. Wysocki
2013-07-04  1:24                 ` Aaron Lu
2013-07-05 19:52                   ` Rafael J. Wysocki
2013-06-09 23:01 ` [PATCH 3/3] i915: Don't provide ACPI backlight interface if firmware expects Windows 8 Matthew Garrett
2013-06-10  7:40   ` Daniel Vetter
2013-06-10  9:22   ` joeyli
2013-06-10 14:09   ` Alex Deucher
2013-06-14  6:47   ` Aaron Lu
2013-06-14 17:29     ` Matthew Garrett
2013-06-14 17:29       ` Matthew Garrett
2013-06-15  1:26       ` Aaron Lu
2013-06-15  1:38         ` Matthew Garrett
2013-06-15  1:38           ` Matthew Garrett
2013-06-15  4:14           ` Aaron Lu
2013-06-15  4:14             ` Aaron Lu
2013-06-15  4:19             ` Matthew Garrett
2013-06-15 12:29               ` Aaron Lu
2013-06-15 12:29                 ` Aaron Lu
2013-06-15 15:16                 ` Matthew Garrett
2013-06-15 18:29                   ` Daniel Vetter
2013-06-15 18:44                     ` Matthew Garrett
2013-06-15 20:27                     ` Rafael J. Wysocki
2013-06-15 20:35                       ` Daniel Vetter
2013-07-05 12:20   ` Rafael J. Wysocki
2013-07-05 20:00     ` Rafael J. Wysocki
2013-07-05 21:40       ` Rafael J. Wysocki
2013-07-05 22:23         ` Rafael J. Wysocki
2013-07-06  5:45           ` Aaron Lu
2013-07-06 13:33             ` Rafael J. Wysocki
2013-07-07 13:19               ` Rafael J. Wysocki
2013-07-07 13:19                 ` Rafael J. Wysocki
2013-07-08  8:00                 ` Aaron Lu
2013-07-13  0:46                   ` [Update][PATCH] ACPI / video / i915: Remove ACPI backlight " Rafael J. Wysocki
2013-07-15  2:36                     ` Aaron Lu
2013-07-15 11:42                       ` Rafael J. Wysocki
2013-07-16  3:24                         ` Aaron Lu
2013-07-16 11:54                           ` Rafael J. Wysocki
2013-07-15 13:06                     ` Igor Gnatenko
2013-07-15 13:06                       ` Igor Gnatenko
2013-07-15 23:53                       ` Rafael J. Wysocki
2013-07-16  7:45                         ` Igor Gnatenko
2013-07-16  7:45                           ` Igor Gnatenko
2013-07-16 13:32                     ` Igor Gnatenko
2013-07-16 13:32                       ` Igor Gnatenko
2013-07-16 17:08                       ` Matthew Garrett
2013-07-16 17:08                         ` Matthew Garrett
2013-07-16 22:01                         ` Rafael J. Wysocki
2013-07-17  5:16                           ` Igor Gnatenko
2013-07-17  5:16                             ` Igor Gnatenko
2013-07-17 11:38                             ` Rafael J. Wysocki
2013-07-17 12:03                               ` Igor Gnatenko
2013-07-17 12:03                                 ` Igor Gnatenko
2013-06-10 11:59 ` [PATCH 0/3] Fix backlight issues on some Windows 8 systems Rafael J. Wysocki
2013-06-10 13:48   ` Matthew Garrett
2013-06-10 13:48     ` Matthew Garrett
2013-06-11 13:08 ` Seth Forshee
2013-06-22 21:46 ` Yves-Alexis Perez
2013-06-25 16:08   ` Matthew Garrett
2013-06-25 16:10     ` Daniel Vetter
2013-06-25 16:13       ` Matthew Garrett
2013-06-25 20:43     ` Yves-Alexis Perez
2013-06-25 20:43       ` Yves-Alexis Perez
2013-06-25 20:54       ` Matthew Garrett
2013-06-25 21:10         ` Yves-Alexis Perez
2013-06-25 21:14           ` Matthew Garrett
2013-06-25 21:30             ` Yves-Alexis Perez
2013-06-25 21:33               ` Matthew Garrett
2013-06-25 21:33                 ` Matthew Garrett
2013-06-25 21:46                 ` Yves-Alexis Perez
2013-06-25 21:49                   ` Matthew Garrett
2013-06-25 21:49                     ` Matthew Garrett
2013-07-17 15:51   ` Felipe Contreras
2013-07-17 19:57     ` Yves-Alexis Perez
2013-07-18  0:16 ` [Update][PATCH " Rafael J. Wysocki
2013-07-18  0:20   ` [PATCH 1/3] ACPICA: expose OSI version Rafael J. Wysocki
2013-07-18  5:38     ` Igor Gnatenko
2013-07-18  5:38       ` Igor Gnatenko
2013-07-18  0:21   ` [PATCH 2/3] ACPI / video: Always call acpi_video_init_brightness() on init Rafael J. Wysocki
2013-07-18  5:40     ` Igor Gnatenko
2013-07-18  5:40       ` Igor Gnatenko
2013-07-18  0:22   ` [PATCH 3/3] ACPI / video / i915: No ACPI backlight if firmware expects Windows 8 Rafael J. Wysocki
2013-07-20 13:16   ` [Update][PATCH 0/3] Fix backlight issues on some Windows 8 systems Felipe Contreras
2013-07-26 13:24     ` Jani Nikula
2013-07-29 18:01       ` Felipe Contreras
2013-07-30  5:03         ` Jani Nikula
2013-07-31  0:01   ` Rafael J. Wysocki
2013-07-31  0:01     ` Matthew Garrett
2013-07-31  0:01       ` Matthew Garrett
2013-07-31  6:48     ` Igor Gnatenko
2013-07-31  6:48       ` Igor Gnatenko
2013-07-31  9:08     ` Aaron Lu
2013-08-07  7:44 ` Backlight control only in the kernel? Borislav Petkov
2013-08-07  9:03   ` Aaron Lu
2013-08-07 10:34     ` Borislav Petkov
2013-08-07 10:36   ` Matthew Garrett
2013-08-07 10:36     ` Matthew Garrett
2013-08-07 11:04     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370818899-8595-3-git-send-email-matthew.garrett@nebula.com \
    --to=matthew.garrett@nebula.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joeyli.kernel@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=seth.forshee@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.