126f3cdf0SGordon Ross /****************************************************************************** 226f3cdf0SGordon Ross * 326f3cdf0SGordon Ross * Module Name: utosi - Support for the _OSI predefined control method 426f3cdf0SGordon Ross * 526f3cdf0SGordon Ross *****************************************************************************/ 626f3cdf0SGordon Ross 726f3cdf0SGordon Ross /* 8*385cc6b4SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp. 926f3cdf0SGordon Ross * All rights reserved. 1026f3cdf0SGordon Ross * 1126f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without 1226f3cdf0SGordon Ross * modification, are permitted provided that the following conditions 1326f3cdf0SGordon Ross * are met: 1426f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright 1526f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer, 1626f3cdf0SGordon Ross * without modification. 1726f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1826f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below 1926f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon 2026f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further 2126f3cdf0SGordon Ross * binary redistribution. 2226f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names 2326f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived 2426f3cdf0SGordon Ross * from this software without specific prior written permission. 2526f3cdf0SGordon Ross * 2626f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the 2726f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free 2826f3cdf0SGordon Ross * Software Foundation. 2926f3cdf0SGordon Ross * 3026f3cdf0SGordon Ross * NO WARRANTY 3126f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3226f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3326f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3426f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3526f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3626f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3726f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3826f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3926f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4026f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4126f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES. 4226f3cdf0SGordon Ross */ 4326f3cdf0SGordon Ross 4426f3cdf0SGordon Ross #include "acpi.h" 4526f3cdf0SGordon Ross #include "accommon.h" 4626f3cdf0SGordon Ross 4726f3cdf0SGordon Ross 4826f3cdf0SGordon Ross #define _COMPONENT ACPI_UTILITIES 4926f3cdf0SGordon Ross ACPI_MODULE_NAME ("utosi") 5026f3cdf0SGordon Ross 51*385cc6b4SJerry Jelinek 52*385cc6b4SJerry Jelinek /****************************************************************************** 53*385cc6b4SJerry Jelinek * 54*385cc6b4SJerry Jelinek * ACPICA policy for new _OSI strings: 55*385cc6b4SJerry Jelinek * 56*385cc6b4SJerry Jelinek * It is the stated policy of ACPICA that new _OSI strings will be integrated 57*385cc6b4SJerry Jelinek * into this module as soon as possible after they are defined. It is strongly 58*385cc6b4SJerry Jelinek * recommended that all ACPICA hosts mirror this policy and integrate any 59*385cc6b4SJerry Jelinek * changes to this module as soon as possible. There are several historical 60*385cc6b4SJerry Jelinek * reasons behind this policy: 61*385cc6b4SJerry Jelinek * 62*385cc6b4SJerry Jelinek * 1) New BIOSs tend to test only the case where the host responds TRUE to 63*385cc6b4SJerry Jelinek * the latest version of Windows, which would respond to the latest/newest 64*385cc6b4SJerry Jelinek * _OSI string. Not responding TRUE to the latest version of Windows will 65*385cc6b4SJerry Jelinek * risk executing untested code paths throughout the DSDT and SSDTs. 66*385cc6b4SJerry Jelinek * 67*385cc6b4SJerry Jelinek * 2) If a new _OSI string is recognized only after a significant delay, this 68*385cc6b4SJerry Jelinek * has the potential to cause problems on existing working machines because 69*385cc6b4SJerry Jelinek * of the possibility that a new and different path through the ASL code 70*385cc6b4SJerry Jelinek * will be executed. 71*385cc6b4SJerry Jelinek * 72*385cc6b4SJerry Jelinek * 3) New _OSI strings are tending to come out about once per year. A delay 73*385cc6b4SJerry Jelinek * in recognizing a new string for a significant amount of time risks the 74*385cc6b4SJerry Jelinek * release of another string which only compounds the initial problem. 75*385cc6b4SJerry Jelinek * 76*385cc6b4SJerry Jelinek *****************************************************************************/ 77*385cc6b4SJerry Jelinek 78*385cc6b4SJerry Jelinek 7926f3cdf0SGordon Ross /* 8026f3cdf0SGordon Ross * Strings supported by the _OSI predefined control method (which is 8126f3cdf0SGordon Ross * implemented internally within this module.) 8226f3cdf0SGordon Ross * 8326f3cdf0SGordon Ross * March 2009: Removed "Linux" as this host no longer wants to respond true 8426f3cdf0SGordon Ross * for this string. Basically, the only safe OS strings are windows-related 8526f3cdf0SGordon Ross * and in many or most cases represent the only test path within the 8626f3cdf0SGordon Ross * BIOS-provided ASL code. 8726f3cdf0SGordon Ross * 8826f3cdf0SGordon Ross * The last element of each entry is used to track the newest version of 8926f3cdf0SGordon Ross * Windows that the BIOS has requested. 9026f3cdf0SGordon Ross */ 9126f3cdf0SGordon Ross static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = 9226f3cdf0SGordon Ross { 9326f3cdf0SGordon Ross /* Operating System Vendor Strings */ 9426f3cdf0SGordon Ross 9526f3cdf0SGordon Ross {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ 9626f3cdf0SGordon Ross {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ 9726f3cdf0SGordon Ross {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ 9826f3cdf0SGordon Ross {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ 9926f3cdf0SGordon Ross {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ 10026f3cdf0SGordon Ross {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ 10126f3cdf0SGordon Ross {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ 10226f3cdf0SGordon Ross {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ 10326f3cdf0SGordon Ross {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ 10426f3cdf0SGordon Ross {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ 10526f3cdf0SGordon Ross {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ 106*385cc6b4SJerry Jelinek /* 107*385cc6b4SJerry Jelinek * XXX 108*385cc6b4SJerry Jelinek * The following OSes are temporarily disabled. Windows introduced 109*385cc6b4SJerry Jelinek * support for xhci (USB 3.0) in Windows 8. When we advertise Windows 8 110*385cc6b4SJerry Jelinek * and newer support, some vendors use that as a key to automatically 111*385cc6b4SJerry Jelinek * transition all USB ports to the xhci controller. Until we have 112*385cc6b4SJerry Jelinek * support for the xhci controller, we should not advertise these 113*385cc6b4SJerry Jelinek * operating systems. From a brief survey, there isn't too much other 114*385cc6b4SJerry Jelinek * AML that this impacts at this time. 115*385cc6b4SJerry Jelinek */ 116*385cc6b4SJerry Jelinek /* {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8},*/ /* Windows 8 and Server 2012 - Added 08/2012 */ 117*385cc6b4SJerry Jelinek /* {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8},*/ /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ 118*385cc6b4SJerry Jelinek /* {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10},*/ /* Windows 10 - Added 03/2015 */ 11926f3cdf0SGordon Ross 12026f3cdf0SGordon Ross /* Feature Group Strings */ 12126f3cdf0SGordon Ross 122*385cc6b4SJerry Jelinek {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0}, 12326f3cdf0SGordon Ross 12426f3cdf0SGordon Ross /* 12526f3cdf0SGordon Ross * All "optional" feature group strings (features that are implemented 126*385cc6b4SJerry Jelinek * by the host) should be dynamically modified to VALID by the host via 127*385cc6b4SJerry Jelinek * AcpiInstallInterface or AcpiUpdateInterfaces. Such optional feature 128*385cc6b4SJerry Jelinek * group strings are set as INVALID by default here. 12926f3cdf0SGordon Ross */ 130*385cc6b4SJerry Jelinek 131*385cc6b4SJerry Jelinek {"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, 132*385cc6b4SJerry Jelinek {"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, 133*385cc6b4SJerry Jelinek {"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, 134*385cc6b4SJerry Jelinek {"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}, 135*385cc6b4SJerry Jelinek {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0} 13626f3cdf0SGordon Ross }; 13726f3cdf0SGordon Ross 13826f3cdf0SGordon Ross 13926f3cdf0SGordon Ross /******************************************************************************* 14026f3cdf0SGordon Ross * 14126f3cdf0SGordon Ross * FUNCTION: AcpiUtInitializeInterfaces 14226f3cdf0SGordon Ross * 14326f3cdf0SGordon Ross * PARAMETERS: None 14426f3cdf0SGordon Ross * 14526f3cdf0SGordon Ross * RETURN: Status 14626f3cdf0SGordon Ross * 14726f3cdf0SGordon Ross * DESCRIPTION: Initialize the global _OSI supported interfaces list 14826f3cdf0SGordon Ross * 14926f3cdf0SGordon Ross ******************************************************************************/ 15026f3cdf0SGordon Ross 15126f3cdf0SGordon Ross ACPI_STATUS 15226f3cdf0SGordon Ross AcpiUtInitializeInterfaces ( 15326f3cdf0SGordon Ross void) 15426f3cdf0SGordon Ross { 155*385cc6b4SJerry Jelinek ACPI_STATUS Status; 15626f3cdf0SGordon Ross UINT32 i; 15726f3cdf0SGordon Ross 15826f3cdf0SGordon Ross 159*385cc6b4SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 160*385cc6b4SJerry Jelinek if (ACPI_FAILURE (Status)) 161*385cc6b4SJerry Jelinek { 162*385cc6b4SJerry Jelinek return (Status); 163*385cc6b4SJerry Jelinek } 164*385cc6b4SJerry Jelinek 16526f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces; 16626f3cdf0SGordon Ross 16726f3cdf0SGordon Ross /* Link the static list of supported interfaces */ 16826f3cdf0SGordon Ross 169*385cc6b4SJerry Jelinek for (i = 0; 170*385cc6b4SJerry Jelinek i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); 171*385cc6b4SJerry Jelinek i++) 17226f3cdf0SGordon Ross { 17326f3cdf0SGordon Ross AcpiDefaultSupportedInterfaces[i].Next = 17426f3cdf0SGordon Ross &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1]; 17526f3cdf0SGordon Ross } 17626f3cdf0SGordon Ross 17726f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 17826f3cdf0SGordon Ross return (AE_OK); 17926f3cdf0SGordon Ross } 18026f3cdf0SGordon Ross 18126f3cdf0SGordon Ross 18226f3cdf0SGordon Ross /******************************************************************************* 18326f3cdf0SGordon Ross * 18426f3cdf0SGordon Ross * FUNCTION: AcpiUtInterfaceTerminate 18526f3cdf0SGordon Ross * 18626f3cdf0SGordon Ross * PARAMETERS: None 18726f3cdf0SGordon Ross * 188*385cc6b4SJerry Jelinek * RETURN: Status 18926f3cdf0SGordon Ross * 19026f3cdf0SGordon Ross * DESCRIPTION: Delete all interfaces in the global list. Sets 19126f3cdf0SGordon Ross * AcpiGbl_SupportedInterfaces to NULL. 19226f3cdf0SGordon Ross * 19326f3cdf0SGordon Ross ******************************************************************************/ 19426f3cdf0SGordon Ross 195*385cc6b4SJerry Jelinek ACPI_STATUS 19626f3cdf0SGordon Ross AcpiUtInterfaceTerminate ( 19726f3cdf0SGordon Ross void) 19826f3cdf0SGordon Ross { 199*385cc6b4SJerry Jelinek ACPI_STATUS Status; 20026f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface; 20126f3cdf0SGordon Ross 20226f3cdf0SGordon Ross 203*385cc6b4SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 204*385cc6b4SJerry Jelinek if (ACPI_FAILURE (Status)) 205*385cc6b4SJerry Jelinek { 206*385cc6b4SJerry Jelinek return (Status); 207*385cc6b4SJerry Jelinek } 20826f3cdf0SGordon Ross 209*385cc6b4SJerry Jelinek NextInterface = AcpiGbl_SupportedInterfaces; 21026f3cdf0SGordon Ross while (NextInterface) 21126f3cdf0SGordon Ross { 21226f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = NextInterface->Next; 21326f3cdf0SGordon Ross 21426f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_DYNAMIC) 21526f3cdf0SGordon Ross { 216*385cc6b4SJerry Jelinek /* Only interfaces added at runtime can be freed */ 217*385cc6b4SJerry Jelinek 21826f3cdf0SGordon Ross ACPI_FREE (NextInterface->Name); 21926f3cdf0SGordon Ross ACPI_FREE (NextInterface); 22026f3cdf0SGordon Ross } 221*385cc6b4SJerry Jelinek else 222*385cc6b4SJerry Jelinek { 223*385cc6b4SJerry Jelinek /* Interface is in static list. Reset it to invalid or valid. */ 224*385cc6b4SJerry Jelinek 225*385cc6b4SJerry Jelinek if (NextInterface->Flags & ACPI_OSI_DEFAULT_INVALID) 226*385cc6b4SJerry Jelinek { 227*385cc6b4SJerry Jelinek NextInterface->Flags |= ACPI_OSI_INVALID; 228*385cc6b4SJerry Jelinek } 229*385cc6b4SJerry Jelinek else 230*385cc6b4SJerry Jelinek { 231*385cc6b4SJerry Jelinek NextInterface->Flags &= ~ACPI_OSI_INVALID; 232*385cc6b4SJerry Jelinek } 233*385cc6b4SJerry Jelinek } 23426f3cdf0SGordon Ross 23526f3cdf0SGordon Ross NextInterface = AcpiGbl_SupportedInterfaces; 23626f3cdf0SGordon Ross } 23726f3cdf0SGordon Ross 23826f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 239*385cc6b4SJerry Jelinek return (AE_OK); 24026f3cdf0SGordon Ross } 24126f3cdf0SGordon Ross 24226f3cdf0SGordon Ross 24326f3cdf0SGordon Ross /******************************************************************************* 24426f3cdf0SGordon Ross * 24526f3cdf0SGordon Ross * FUNCTION: AcpiUtInstallInterface 24626f3cdf0SGordon Ross * 24726f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to install 24826f3cdf0SGordon Ross * 24926f3cdf0SGordon Ross * RETURN: Status 25026f3cdf0SGordon Ross * 25126f3cdf0SGordon Ross * DESCRIPTION: Install the interface into the global interface list. 25226f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex 25326f3cdf0SGordon Ross * 25426f3cdf0SGordon Ross ******************************************************************************/ 25526f3cdf0SGordon Ross 25626f3cdf0SGordon Ross ACPI_STATUS 25726f3cdf0SGordon Ross AcpiUtInstallInterface ( 25826f3cdf0SGordon Ross ACPI_STRING InterfaceName) 25926f3cdf0SGordon Ross { 26026f3cdf0SGordon Ross ACPI_INTERFACE_INFO *InterfaceInfo; 26126f3cdf0SGordon Ross 26226f3cdf0SGordon Ross 26326f3cdf0SGordon Ross /* Allocate info block and space for the name string */ 26426f3cdf0SGordon Ross 26526f3cdf0SGordon Ross InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO)); 26626f3cdf0SGordon Ross if (!InterfaceInfo) 26726f3cdf0SGordon Ross { 26826f3cdf0SGordon Ross return (AE_NO_MEMORY); 26926f3cdf0SGordon Ross } 27026f3cdf0SGordon Ross 271*385cc6b4SJerry Jelinek InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1); 27226f3cdf0SGordon Ross if (!InterfaceInfo->Name) 27326f3cdf0SGordon Ross { 27426f3cdf0SGordon Ross ACPI_FREE (InterfaceInfo); 27526f3cdf0SGordon Ross return (AE_NO_MEMORY); 27626f3cdf0SGordon Ross } 27726f3cdf0SGordon Ross 27826f3cdf0SGordon Ross /* Initialize new info and insert at the head of the global list */ 27926f3cdf0SGordon Ross 280*385cc6b4SJerry Jelinek strcpy (InterfaceInfo->Name, InterfaceName); 28126f3cdf0SGordon Ross InterfaceInfo->Flags = ACPI_OSI_DYNAMIC; 28226f3cdf0SGordon Ross InterfaceInfo->Next = AcpiGbl_SupportedInterfaces; 28326f3cdf0SGordon Ross 28426f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = InterfaceInfo; 28526f3cdf0SGordon Ross return (AE_OK); 28626f3cdf0SGordon Ross } 28726f3cdf0SGordon Ross 28826f3cdf0SGordon Ross 28926f3cdf0SGordon Ross /******************************************************************************* 29026f3cdf0SGordon Ross * 29126f3cdf0SGordon Ross * FUNCTION: AcpiUtRemoveInterface 29226f3cdf0SGordon Ross * 29326f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to remove 29426f3cdf0SGordon Ross * 29526f3cdf0SGordon Ross * RETURN: Status 29626f3cdf0SGordon Ross * 29726f3cdf0SGordon Ross * DESCRIPTION: Remove the interface from the global interface list. 29826f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex 29926f3cdf0SGordon Ross * 30026f3cdf0SGordon Ross ******************************************************************************/ 30126f3cdf0SGordon Ross 30226f3cdf0SGordon Ross ACPI_STATUS 30326f3cdf0SGordon Ross AcpiUtRemoveInterface ( 30426f3cdf0SGordon Ross ACPI_STRING InterfaceName) 30526f3cdf0SGordon Ross { 30626f3cdf0SGordon Ross ACPI_INTERFACE_INFO *PreviousInterface; 30726f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface; 30826f3cdf0SGordon Ross 30926f3cdf0SGordon Ross 31026f3cdf0SGordon Ross PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces; 31126f3cdf0SGordon Ross while (NextInterface) 31226f3cdf0SGordon Ross { 313*385cc6b4SJerry Jelinek if (!strcmp (InterfaceName, NextInterface->Name)) 31426f3cdf0SGordon Ross { 315*385cc6b4SJerry Jelinek /* 316*385cc6b4SJerry Jelinek * Found: name is in either the static list 317*385cc6b4SJerry Jelinek * or was added at runtime 318*385cc6b4SJerry Jelinek */ 31926f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_DYNAMIC) 32026f3cdf0SGordon Ross { 32126f3cdf0SGordon Ross /* Interface was added dynamically, remove and free it */ 32226f3cdf0SGordon Ross 32326f3cdf0SGordon Ross if (PreviousInterface == NextInterface) 32426f3cdf0SGordon Ross { 32526f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = NextInterface->Next; 32626f3cdf0SGordon Ross } 32726f3cdf0SGordon Ross else 32826f3cdf0SGordon Ross { 32926f3cdf0SGordon Ross PreviousInterface->Next = NextInterface->Next; 33026f3cdf0SGordon Ross } 33126f3cdf0SGordon Ross 33226f3cdf0SGordon Ross ACPI_FREE (NextInterface->Name); 33326f3cdf0SGordon Ross ACPI_FREE (NextInterface); 33426f3cdf0SGordon Ross } 33526f3cdf0SGordon Ross else 33626f3cdf0SGordon Ross { 33726f3cdf0SGordon Ross /* 338*385cc6b4SJerry Jelinek * Interface is in static list. If marked invalid, then 339*385cc6b4SJerry Jelinek * it does not actually exist. Else, mark it invalid. 34026f3cdf0SGordon Ross */ 34126f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_INVALID) 34226f3cdf0SGordon Ross { 34326f3cdf0SGordon Ross return (AE_NOT_EXIST); 34426f3cdf0SGordon Ross } 34526f3cdf0SGordon Ross 34626f3cdf0SGordon Ross NextInterface->Flags |= ACPI_OSI_INVALID; 34726f3cdf0SGordon Ross } 34826f3cdf0SGordon Ross 34926f3cdf0SGordon Ross return (AE_OK); 35026f3cdf0SGordon Ross } 35126f3cdf0SGordon Ross 35226f3cdf0SGordon Ross PreviousInterface = NextInterface; 35326f3cdf0SGordon Ross NextInterface = NextInterface->Next; 35426f3cdf0SGordon Ross } 35526f3cdf0SGordon Ross 35626f3cdf0SGordon Ross /* Interface was not found */ 35726f3cdf0SGordon Ross 35826f3cdf0SGordon Ross return (AE_NOT_EXIST); 35926f3cdf0SGordon Ross } 36026f3cdf0SGordon Ross 36126f3cdf0SGordon Ross 36226f3cdf0SGordon Ross /******************************************************************************* 36326f3cdf0SGordon Ross * 364*385cc6b4SJerry Jelinek * FUNCTION: AcpiUtUpdateInterfaces 365*385cc6b4SJerry Jelinek * 366*385cc6b4SJerry Jelinek * PARAMETERS: Action - Actions to be performed during the 367*385cc6b4SJerry Jelinek * update 368*385cc6b4SJerry Jelinek * 369*385cc6b4SJerry Jelinek * RETURN: Status 370*385cc6b4SJerry Jelinek * 371*385cc6b4SJerry Jelinek * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor 372*385cc6b4SJerry Jelinek * strings or/and feature group strings. 373*385cc6b4SJerry Jelinek * Caller MUST hold AcpiGbl_OsiMutex 374*385cc6b4SJerry Jelinek * 375*385cc6b4SJerry Jelinek ******************************************************************************/ 376*385cc6b4SJerry Jelinek 377*385cc6b4SJerry Jelinek ACPI_STATUS 378*385cc6b4SJerry Jelinek AcpiUtUpdateInterfaces ( 379*385cc6b4SJerry Jelinek UINT8 Action) 380*385cc6b4SJerry Jelinek { 381*385cc6b4SJerry Jelinek ACPI_INTERFACE_INFO *NextInterface; 382*385cc6b4SJerry Jelinek 383*385cc6b4SJerry Jelinek 384*385cc6b4SJerry Jelinek NextInterface = AcpiGbl_SupportedInterfaces; 385*385cc6b4SJerry Jelinek while (NextInterface) 386*385cc6b4SJerry Jelinek { 387*385cc6b4SJerry Jelinek if (((NextInterface->Flags & ACPI_OSI_FEATURE) && 388*385cc6b4SJerry Jelinek (Action & ACPI_FEATURE_STRINGS)) || 389*385cc6b4SJerry Jelinek (!(NextInterface->Flags & ACPI_OSI_FEATURE) && 390*385cc6b4SJerry Jelinek (Action & ACPI_VENDOR_STRINGS))) 391*385cc6b4SJerry Jelinek { 392*385cc6b4SJerry Jelinek if (Action & ACPI_DISABLE_INTERFACES) 393*385cc6b4SJerry Jelinek { 394*385cc6b4SJerry Jelinek /* Mark the interfaces as invalid */ 395*385cc6b4SJerry Jelinek 396*385cc6b4SJerry Jelinek NextInterface->Flags |= ACPI_OSI_INVALID; 397*385cc6b4SJerry Jelinek } 398*385cc6b4SJerry Jelinek else 399*385cc6b4SJerry Jelinek { 400*385cc6b4SJerry Jelinek /* Mark the interfaces as valid */ 401*385cc6b4SJerry Jelinek 402*385cc6b4SJerry Jelinek NextInterface->Flags &= ~ACPI_OSI_INVALID; 403*385cc6b4SJerry Jelinek } 404*385cc6b4SJerry Jelinek } 405*385cc6b4SJerry Jelinek 406*385cc6b4SJerry Jelinek NextInterface = NextInterface->Next; 407*385cc6b4SJerry Jelinek } 408*385cc6b4SJerry Jelinek 409*385cc6b4SJerry Jelinek return (AE_OK); 410*385cc6b4SJerry Jelinek } 411*385cc6b4SJerry Jelinek 412*385cc6b4SJerry Jelinek 413*385cc6b4SJerry Jelinek /******************************************************************************* 414*385cc6b4SJerry Jelinek * 41526f3cdf0SGordon Ross * FUNCTION: AcpiUtGetInterface 41626f3cdf0SGordon Ross * 41726f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to find 41826f3cdf0SGordon Ross * 41926f3cdf0SGordon Ross * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found. 42026f3cdf0SGordon Ross * 42126f3cdf0SGordon Ross * DESCRIPTION: Search for the specified interface name in the global list. 42226f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex 42326f3cdf0SGordon Ross * 42426f3cdf0SGordon Ross ******************************************************************************/ 42526f3cdf0SGordon Ross 42626f3cdf0SGordon Ross ACPI_INTERFACE_INFO * 42726f3cdf0SGordon Ross AcpiUtGetInterface ( 42826f3cdf0SGordon Ross ACPI_STRING InterfaceName) 42926f3cdf0SGordon Ross { 43026f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface; 43126f3cdf0SGordon Ross 43226f3cdf0SGordon Ross 43326f3cdf0SGordon Ross NextInterface = AcpiGbl_SupportedInterfaces; 43426f3cdf0SGordon Ross while (NextInterface) 43526f3cdf0SGordon Ross { 436*385cc6b4SJerry Jelinek if (!strcmp (InterfaceName, NextInterface->Name)) 43726f3cdf0SGordon Ross { 43826f3cdf0SGordon Ross return (NextInterface); 43926f3cdf0SGordon Ross } 44026f3cdf0SGordon Ross 44126f3cdf0SGordon Ross NextInterface = NextInterface->Next; 44226f3cdf0SGordon Ross } 44326f3cdf0SGordon Ross 44426f3cdf0SGordon Ross return (NULL); 44526f3cdf0SGordon Ross } 44626f3cdf0SGordon Ross 44726f3cdf0SGordon Ross 44826f3cdf0SGordon Ross /******************************************************************************* 44926f3cdf0SGordon Ross * 45026f3cdf0SGordon Ross * FUNCTION: AcpiUtOsiImplementation 45126f3cdf0SGordon Ross * 45226f3cdf0SGordon Ross * PARAMETERS: WalkState - Current walk state 45326f3cdf0SGordon Ross * 45426f3cdf0SGordon Ross * RETURN: Status 45526f3cdf0SGordon Ross * 45626f3cdf0SGordon Ross * DESCRIPTION: Implementation of the _OSI predefined control method. When 45726f3cdf0SGordon Ross * an invocation of _OSI is encountered in the system AML, 45826f3cdf0SGordon Ross * control is transferred to this function. 45926f3cdf0SGordon Ross * 46026f3cdf0SGordon Ross ******************************************************************************/ 46126f3cdf0SGordon Ross 46226f3cdf0SGordon Ross ACPI_STATUS 46326f3cdf0SGordon Ross AcpiUtOsiImplementation ( 46426f3cdf0SGordon Ross ACPI_WALK_STATE *WalkState) 46526f3cdf0SGordon Ross { 46626f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *StringDesc; 46726f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ReturnDesc; 46826f3cdf0SGordon Ross ACPI_INTERFACE_INFO *InterfaceInfo; 46926f3cdf0SGordon Ross ACPI_INTERFACE_HANDLER InterfaceHandler; 470*385cc6b4SJerry Jelinek ACPI_STATUS Status; 47126f3cdf0SGordon Ross UINT32 ReturnValue; 47226f3cdf0SGordon Ross 47326f3cdf0SGordon Ross 47426f3cdf0SGordon Ross ACPI_FUNCTION_TRACE (UtOsiImplementation); 47526f3cdf0SGordon Ross 47626f3cdf0SGordon Ross 47726f3cdf0SGordon Ross /* Validate the string input argument (from the AML caller) */ 47826f3cdf0SGordon Ross 47926f3cdf0SGordon Ross StringDesc = WalkState->Arguments[0].Object; 48026f3cdf0SGordon Ross if (!StringDesc || 48126f3cdf0SGordon Ross (StringDesc->Common.Type != ACPI_TYPE_STRING)) 48226f3cdf0SGordon Ross { 48326f3cdf0SGordon Ross return_ACPI_STATUS (AE_TYPE); 48426f3cdf0SGordon Ross } 48526f3cdf0SGordon Ross 48626f3cdf0SGordon Ross /* Create a return object */ 48726f3cdf0SGordon Ross 48826f3cdf0SGordon Ross ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); 48926f3cdf0SGordon Ross if (!ReturnDesc) 49026f3cdf0SGordon Ross { 49126f3cdf0SGordon Ross return_ACPI_STATUS (AE_NO_MEMORY); 49226f3cdf0SGordon Ross } 49326f3cdf0SGordon Ross 49426f3cdf0SGordon Ross /* Default return value is 0, NOT SUPPORTED */ 49526f3cdf0SGordon Ross 49626f3cdf0SGordon Ross ReturnValue = 0; 497*385cc6b4SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 498*385cc6b4SJerry Jelinek if (ACPI_FAILURE (Status)) 499*385cc6b4SJerry Jelinek { 500*385cc6b4SJerry Jelinek AcpiUtRemoveReference (ReturnDesc); 501*385cc6b4SJerry Jelinek return_ACPI_STATUS (Status); 502*385cc6b4SJerry Jelinek } 50326f3cdf0SGordon Ross 50426f3cdf0SGordon Ross /* Lookup the interface in the global _OSI list */ 50526f3cdf0SGordon Ross 50626f3cdf0SGordon Ross InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer); 50726f3cdf0SGordon Ross if (InterfaceInfo && 50826f3cdf0SGordon Ross !(InterfaceInfo->Flags & ACPI_OSI_INVALID)) 50926f3cdf0SGordon Ross { 51026f3cdf0SGordon Ross /* 51126f3cdf0SGordon Ross * The interface is supported. 51226f3cdf0SGordon Ross * Update the OsiData if necessary. We keep track of the latest 51326f3cdf0SGordon Ross * version of Windows that has been requested by the BIOS. 51426f3cdf0SGordon Ross */ 51526f3cdf0SGordon Ross if (InterfaceInfo->Value > AcpiGbl_OsiData) 51626f3cdf0SGordon Ross { 51726f3cdf0SGordon Ross AcpiGbl_OsiData = InterfaceInfo->Value; 51826f3cdf0SGordon Ross } 51926f3cdf0SGordon Ross 52026f3cdf0SGordon Ross ReturnValue = ACPI_UINT32_MAX; 52126f3cdf0SGordon Ross } 52226f3cdf0SGordon Ross 52326f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 52426f3cdf0SGordon Ross 52526f3cdf0SGordon Ross /* 52626f3cdf0SGordon Ross * Invoke an optional _OSI interface handler. The host OS may wish 52726f3cdf0SGordon Ross * to do some interface-specific handling. For example, warn about 52826f3cdf0SGordon Ross * certain interfaces or override the true/false support value. 52926f3cdf0SGordon Ross */ 53026f3cdf0SGordon Ross InterfaceHandler = AcpiGbl_InterfaceHandler; 53126f3cdf0SGordon Ross if (InterfaceHandler) 53226f3cdf0SGordon Ross { 53326f3cdf0SGordon Ross ReturnValue = InterfaceHandler ( 53426f3cdf0SGordon Ross StringDesc->String.Pointer, ReturnValue); 53526f3cdf0SGordon Ross } 53626f3cdf0SGordon Ross 53726f3cdf0SGordon Ross ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, 53826f3cdf0SGordon Ross "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", 53926f3cdf0SGordon Ross StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); 54026f3cdf0SGordon Ross 54126f3cdf0SGordon Ross /* Complete the return object */ 54226f3cdf0SGordon Ross 54326f3cdf0SGordon Ross ReturnDesc->Integer.Value = ReturnValue; 54426f3cdf0SGordon Ross WalkState->ReturnDesc = ReturnDesc; 54526f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK); 54626f3cdf0SGordon Ross } 547