[2/3] ACPICA: Add interface for getting latest OS version requested via _OSI
diff mbox

Message ID 1370818899-8595-3-git-send-email-matthew.garrett@nebula.com
State Changes Requested, archived
Headers show

Commit Message

Matthew Garrett June 9, 2013, 11:01 p.m. UTC
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(-)

Comments

Rafael Wysocki June 17, 2013, 10:31 p.m. UTC | #1
Hi Matthew,

On Sunday, June 09, 2013 07:01:38 PM Matthew Garrett wrote:
> 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>

Bob (CCed) would prefer us to access acpi_gbl_osi_data directly instead of
adding the wrapper to ACPICA.  He also thinks that the symbol definitions
should go into include/acpi/actypes.h rather than into acpixf.h.

Then, the only ACPICA change would be to move the symbols and we can
add a Linux-specific patch on top of that adding the acpi_gbl_osi_data
wrapper.

How does that sound?

Rafael


> 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);
>
Matthew Garrett June 17, 2013, 10:37 p.m. UTC | #2
On Tue, 2013-06-18 at 00:31 +0200, Rafael J. Wysocki wrote:
> Hi Matthew,

> 

> On Sunday, June 09, 2013 07:01:38 PM Matthew Garrett wrote:

> > 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>

> 

> Bob (CCed) would prefer us to access acpi_gbl_osi_data directly instead of

> adding the wrapper to ACPICA.  He also thinks that the symbol definitions

> should go into include/acpi/actypes.h rather than into acpixf.h.

> 

> Then, the only ACPICA change would be to move the symbols and we can

> add a Linux-specific patch on top of that adding the acpi_gbl_osi_data

> wrapper.


That sounds good to me. Do you want to respin that, or should I send an
updated set?

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Rafael Wysocki June 18, 2013, 12:42 a.m. UTC | #3
On Monday, June 17, 2013 10:37:10 PM Matthew Garrett wrote:
> On Tue, 2013-06-18 at 00:31 +0200, Rafael J. Wysocki wrote:
> > Hi Matthew,
> > 
> > On Sunday, June 09, 2013 07:01:38 PM Matthew Garrett wrote:
> > > 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>
> > 
> > Bob (CCed) would prefer us to access acpi_gbl_osi_data directly instead of
> > adding the wrapper to ACPICA.  He also thinks that the symbol definitions
> > should go into include/acpi/actypes.h rather than into acpixf.h.
> > 
> > Then, the only ACPICA change would be to move the symbols and we can
> > add a Linux-specific patch on top of that adding the acpi_gbl_osi_data
> > wrapper.
> 
> That sounds good to me. Do you want to respin that, or should I send an
> updated set?

That one should be fine, no need to respin [1/3] and [3/3].

Thanks,
Rafael
Rafael Wysocki June 25, 2013, 11:23 p.m. UTC | #4
On Tuesday, June 18, 2013 02:42:13 AM Rafael J. Wysocki wrote:
> On Monday, June 17, 2013 10:37:10 PM Matthew Garrett wrote:
> > On Tue, 2013-06-18 at 00:31 +0200, Rafael J. Wysocki wrote:
> > > Hi Matthew,
> > > 
> > > On Sunday, June 09, 2013 07:01:38 PM Matthew Garrett wrote:
> > > > 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>
> > > 
> > > Bob (CCed) would prefer us to access acpi_gbl_osi_data directly instead of
> > > adding the wrapper to ACPICA.  He also thinks that the symbol definitions
> > > should go into include/acpi/actypes.h rather than into acpixf.h.
> > > 
> > > Then, the only ACPICA change would be to move the symbols and we can
> > > add a Linux-specific patch on top of that adding the acpi_gbl_osi_data
> > > wrapper.
> > 
> > That sounds good to me. Do you want to respin that, or should I send an
> > updated set?
> 
> That one should be fine, no need to respin [1/3] and [3/3].

Any news?

Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Aaron Lu July 2, 2013, 1:56 p.m. UTC | #5
This is a re-spin of patch 2/3:
ACPICA: Add interface for getting latest OS version requested via _OSI
to address the comments suggested by Bob and Rafael.

To be exact, the patchset does:
1 Expose acpi_gbl_osi_data through include/acpi/acpixf.h and move all
  OSI definitions to include/acpi/actypes.h in patch 1;
2 Add a wrapper function acpi_osi_version in osl.c to return
  acpi_gbl_osi_data in patch 2.

Matthew,
I suppose you might be busy so I've done the re-spin for you,
please let me know if you think something wrong, thanks.

Aaron Lu (2):
  ACPICA: expose OSI version
  ACPI / OSL: add a wrapper function to return OSI version

 drivers/acpi/acpica/aclocal.h | 13 -------------
 drivers/acpi/osl.c            |  6 ++++++
 include/acpi/acpixf.h         |  1 +
 include/acpi/actypes.h        | 15 +++++++++++++++
 include/linux/acpi.h          |  6 ++++++
 5 files changed, 28 insertions(+), 13 deletions(-)

Patch
diff mbox

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);