public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Matthew Garrett <matthew.garrett@nebula.com>
Cc: lenb@kernel.org, robert.moore@intel.com, lv.zheng@intel.com,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, bhelgaas@google.com
Subject: Re: [PATCH 1/4] ACPI: Support _OSI("Darwin") correctly
Date: Tue, 17 Jun 2014 14:11:36 +0200	[thread overview]
Message-ID: <7712179.sDPAd6Ubry@vostro.rjw.lan> (raw)
In-Reply-To: <1401640436-1947-2-git-send-email-matthew.garrett@nebula.com>

On Sunday, June 01, 2014 12:33:53 PM Matthew Garrett wrote:
> Apple hardware queries _OSI("Darwin") in order to determine whether the
> system is running OS X, and changes firmware behaviour based on the answer.
> The most obvious difference in behaviour is that Thunderbolt hardware is
> forcibly powered down unless the system is running OS X. The obvious solution
> would be to simply add Darwin to the list of supported _OSI strings, but this
> causes problems.
> 
> Recent Apple hardware includes two separate methods for checking _OSI
> strings. The first will check whether Darwin is supported, and if so will
> exit. The second will check whether Darwin is supported, but will then
> continue to check for further operating systems. If a further operating
> system is found then later firmware code will assume that the OS is not OS X.
> This results in the unfortunate situation where the Thunderbolt controller is
> available at boot time but remains powered down after suspend.
> 
> The easiest way to handle this is to special-case it in the Linux-specific
> OSI handling code. If we see Darwin, we should answer true and then disable
> all other _OSI vendor strings.
> 
> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>

Does applying this patch without the rest of the series makes things worse
or better on the machines in question (or perhaps it doesn't matter at all
alone)?

Rafael


> ---
>  drivers/acpi/acpica/utosi.c |  1 +
>  drivers/acpi/osl.c          | 10 ++++++++++
>  include/acpi/actypes.h      | 25 +++++++++++++------------
>  3 files changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
> index 685766f..63b0a3b 100644
> --- a/drivers/acpi/acpica/utosi.c
> +++ b/drivers/acpi/acpica/utosi.c
> @@ -87,6 +87,7 @@ ACPI_MODULE_NAME("utosi")
>  static struct acpi_interface_info acpi_default_supported_interfaces[] = {
>  	/* Operating System Vendor Strings */
>  
> +	{"Darwin", NULL, 0, ACPI_OSI_DARWIN},	/* OS X */
>  	{"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000},	/* Windows 2000 */
>  	{"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP},	/* Windows XP */
>  	{"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1},	/* Windows XP SP1 */
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 6776c59..312ab5c 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -152,6 +152,16 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported)
>  			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/include/acpi/actypes.h b/include/acpi/actypes.h
> index e763565..1c2ef56 100644
> --- a/include/acpi/actypes.h
> +++ b/include/acpi/actypes.h
> @@ -1210,17 +1210,18 @@ struct acpi_memory_list {
>  #define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
>  #define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
>  
> -#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_OSI_DARWIN                 0x01
> +#define ACPI_OSI_WIN_2000               0x02
> +#define ACPI_OSI_WIN_XP                 0x03
> +#define ACPI_OSI_WIN_XP_SP1             0x04
> +#define ACPI_OSI_WINSRV_2003            0x05
> +#define ACPI_OSI_WIN_XP_SP2             0x06
> +#define ACPI_OSI_WINSRV_2003_SP1        0x07
> +#define ACPI_OSI_WIN_VISTA              0x08
> +#define ACPI_OSI_WINSRV_2008            0x09
> +#define ACPI_OSI_WIN_VISTA_SP1          0x0A
> +#define ACPI_OSI_WIN_VISTA_SP2          0x0B
> +#define ACPI_OSI_WIN_7                  0x0C
> +#define ACPI_OSI_WIN_8                  0x0D
>  
>  #endif				/* __ACTYPES_H__ */
> 

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

  reply	other threads:[~2014-06-17 11:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-01 16:33 ACPI: Improve behaviour on Apple hardware Matthew Garrett
2014-06-01 16:33 ` [PATCH 1/4] ACPI: Support _OSI("Darwin") correctly Matthew Garrett
2014-06-17 12:11   ` Rafael J. Wysocki [this message]
2014-06-17 14:46     ` Matthew Garrett
2014-06-18  5:26       ` Matthew Garrett
2014-06-18 23:42         ` Rafael J. Wysocki
2014-06-01 16:33 ` [PATCH 2/4] ACPI: Don't call PCI OSC on Apple hardware when claiming to be Darwin Matthew Garrett
2014-06-01 16:33 ` [PATCH 3/4] ACPI: Don't assume the existence of an SBS charger Matthew Garrett
2014-06-01 16:33 ` [PATCH 4/4] ACPI: Disable smart battery manager on Apple Matthew Garrett

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=7712179.sDPAd6Ubry@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=bhelgaas@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=matthew.garrett@nebula.com \
    --cc=robert.moore@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox