126f3cdf0SGordon Ross /******************************************************************************
226f3cdf0SGordon Ross *
326f3cdf0SGordon Ross * Module Name: utosi - Support for the _OSI predefined control method
426f3cdf0SGordon Ross *
526f3cdf0SGordon Ross *****************************************************************************/
626f3cdf0SGordon Ross
7*35786f68SRobert Mustacchi /******************************************************************************
8*35786f68SRobert Mustacchi *
9*35786f68SRobert Mustacchi * 1. Copyright Notice
10*35786f68SRobert Mustacchi *
11*35786f68SRobert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
1226f3cdf0SGordon Ross * All rights reserved.
1326f3cdf0SGordon Ross *
14*35786f68SRobert Mustacchi * 2. License
15*35786f68SRobert Mustacchi *
16*35786f68SRobert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
17*35786f68SRobert Mustacchi * rights. You may have additional license terms from the party that provided
18*35786f68SRobert Mustacchi * you this software, covering your right to use that party's intellectual
19*35786f68SRobert Mustacchi * property rights.
20*35786f68SRobert Mustacchi *
21*35786f68SRobert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*35786f68SRobert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
23*35786f68SRobert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*35786f68SRobert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
25*35786f68SRobert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
26*35786f68SRobert Mustacchi * Code in any form, with the right to sublicense such rights; and
27*35786f68SRobert Mustacchi *
28*35786f68SRobert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*35786f68SRobert Mustacchi * license (with the right to sublicense), under only those claims of Intel
30*35786f68SRobert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
31*35786f68SRobert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
32*35786f68SRobert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
33*35786f68SRobert Mustacchi * license, and in no event shall the patent license extend to any additions
34*35786f68SRobert Mustacchi * to or modifications of the Original Intel Code. No other license or right
35*35786f68SRobert Mustacchi * is granted directly or by implication, estoppel or otherwise;
36*35786f68SRobert Mustacchi *
37*35786f68SRobert Mustacchi * The above copyright and patent license is granted only if the following
38*35786f68SRobert Mustacchi * conditions are met:
39*35786f68SRobert Mustacchi *
40*35786f68SRobert Mustacchi * 3. Conditions
41*35786f68SRobert Mustacchi *
42*35786f68SRobert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
44*35786f68SRobert Mustacchi * Code or modification with rights to further distribute source must include
45*35786f68SRobert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
46*35786f68SRobert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
47*35786f68SRobert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
48*35786f68SRobert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
49*35786f68SRobert Mustacchi * Code and the date of any change. Licensee must include in that file the
50*35786f68SRobert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
51*35786f68SRobert Mustacchi * must include a prominent statement that the modification is derived,
52*35786f68SRobert Mustacchi * directly or indirectly, from Original Intel Code.
53*35786f68SRobert Mustacchi *
54*35786f68SRobert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
56*35786f68SRobert Mustacchi * Code or modification without rights to further distribute source must
57*35786f68SRobert Mustacchi * include the following Disclaimer and Export Compliance provision in the
58*35786f68SRobert Mustacchi * documentation and/or other materials provided with distribution. In
59*35786f68SRobert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
60*35786f68SRobert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
61*35786f68SRobert Mustacchi * license from Licensee to its licensee is limited to the intellectual
62*35786f68SRobert Mustacchi * property embodied in the software Licensee provides to its licensee, and
63*35786f68SRobert Mustacchi * not to intellectual property embodied in modifications its licensee may
64*35786f68SRobert Mustacchi * make.
65*35786f68SRobert Mustacchi *
66*35786f68SRobert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*35786f68SRobert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
68*35786f68SRobert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
69*35786f68SRobert Mustacchi * provision in the documentation and/or other materials provided with the
70*35786f68SRobert Mustacchi * distribution.
71*35786f68SRobert Mustacchi *
72*35786f68SRobert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
73*35786f68SRobert Mustacchi * Intel Code.
74*35786f68SRobert Mustacchi *
75*35786f68SRobert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*35786f68SRobert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
77*35786f68SRobert Mustacchi * other dealings in products derived from or relating to the Covered Code
78*35786f68SRobert Mustacchi * without prior written authorization from Intel.
79*35786f68SRobert Mustacchi *
80*35786f68SRobert Mustacchi * 4. Disclaimer and Export Compliance
81*35786f68SRobert Mustacchi *
82*35786f68SRobert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*35786f68SRobert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*35786f68SRobert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*35786f68SRobert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*35786f68SRobert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*35786f68SRobert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*35786f68SRobert Mustacchi * PARTICULAR PURPOSE.
89*35786f68SRobert Mustacchi *
90*35786f68SRobert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*35786f68SRobert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*35786f68SRobert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*35786f68SRobert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*35786f68SRobert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*35786f68SRobert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*35786f68SRobert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*35786f68SRobert Mustacchi * LIMITED REMEDY.
98*35786f68SRobert Mustacchi *
99*35786f68SRobert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*35786f68SRobert Mustacchi * software or system incorporating such software without first obtaining any
101*35786f68SRobert Mustacchi * required license or other approval from the U. S. Department of Commerce or
102*35786f68SRobert Mustacchi * any other agency or department of the United States Government. In the
103*35786f68SRobert Mustacchi * event Licensee exports any such software from the United States or
104*35786f68SRobert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
105*35786f68SRobert Mustacchi * ensure that the distribution and export/re-export of the software is in
106*35786f68SRobert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
107*35786f68SRobert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*35786f68SRobert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
109*35786f68SRobert Mustacchi * software, or service, directly or indirectly, to any country for which the
110*35786f68SRobert Mustacchi * United States government or any agency thereof requires an export license,
111*35786f68SRobert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
112*35786f68SRobert Mustacchi * such license, approval or letter.
113*35786f68SRobert Mustacchi *
114*35786f68SRobert Mustacchi *****************************************************************************
115*35786f68SRobert Mustacchi *
116*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
117*35786f68SRobert Mustacchi * following license:
118*35786f68SRobert Mustacchi *
11926f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without
12026f3cdf0SGordon Ross * modification, are permitted provided that the following conditions
12126f3cdf0SGordon Ross * are met:
12226f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright
12326f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer,
12426f3cdf0SGordon Ross * without modification.
12526f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12626f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below
12726f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon
12826f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further
12926f3cdf0SGordon Ross * binary redistribution.
13026f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
13126f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived
13226f3cdf0SGordon Ross * from this software without specific prior written permission.
13326f3cdf0SGordon Ross *
13426f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13526f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*35786f68SRobert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13726f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*35786f68SRobert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*35786f68SRobert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*35786f68SRobert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*35786f68SRobert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*35786f68SRobert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*35786f68SRobert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*35786f68SRobert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*35786f68SRobert Mustacchi *
146*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
147*35786f68SRobert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
148*35786f68SRobert Mustacchi * Software Foundation.
149*35786f68SRobert Mustacchi *
150*35786f68SRobert Mustacchi *****************************************************************************/
15126f3cdf0SGordon Ross
15226f3cdf0SGordon Ross #include "acpi.h"
15326f3cdf0SGordon Ross #include "accommon.h"
15426f3cdf0SGordon Ross
15526f3cdf0SGordon Ross
15626f3cdf0SGordon Ross #define _COMPONENT ACPI_UTILITIES
15726f3cdf0SGordon Ross ACPI_MODULE_NAME ("utosi")
15826f3cdf0SGordon Ross
1597b1019a6SJerry Jelinek
1607b1019a6SJerry Jelinek /******************************************************************************
1617b1019a6SJerry Jelinek *
1627b1019a6SJerry Jelinek * ACPICA policy for new _OSI strings:
1637b1019a6SJerry Jelinek *
1647b1019a6SJerry Jelinek * It is the stated policy of ACPICA that new _OSI strings will be integrated
1657b1019a6SJerry Jelinek * into this module as soon as possible after they are defined. It is strongly
1667b1019a6SJerry Jelinek * recommended that all ACPICA hosts mirror this policy and integrate any
1677b1019a6SJerry Jelinek * changes to this module as soon as possible. There are several historical
1687b1019a6SJerry Jelinek * reasons behind this policy:
1697b1019a6SJerry Jelinek *
1707b1019a6SJerry Jelinek * 1) New BIOSs tend to test only the case where the host responds TRUE to
1717b1019a6SJerry Jelinek * the latest version of Windows, which would respond to the latest/newest
1727b1019a6SJerry Jelinek * _OSI string. Not responding TRUE to the latest version of Windows will
1737b1019a6SJerry Jelinek * risk executing untested code paths throughout the DSDT and SSDTs.
1747b1019a6SJerry Jelinek *
1757b1019a6SJerry Jelinek * 2) If a new _OSI string is recognized only after a significant delay, this
1767b1019a6SJerry Jelinek * has the potential to cause problems on existing working machines because
1777b1019a6SJerry Jelinek * of the possibility that a new and different path through the ASL code
1787b1019a6SJerry Jelinek * will be executed.
1797b1019a6SJerry Jelinek *
1807b1019a6SJerry Jelinek * 3) New _OSI strings are tending to come out about once per year. A delay
1817b1019a6SJerry Jelinek * in recognizing a new string for a significant amount of time risks the
1827b1019a6SJerry Jelinek * release of another string which only compounds the initial problem.
1837b1019a6SJerry Jelinek *
1847b1019a6SJerry Jelinek *****************************************************************************/
1857b1019a6SJerry Jelinek
1867b1019a6SJerry Jelinek
18726f3cdf0SGordon Ross /*
18826f3cdf0SGordon Ross * Strings supported by the _OSI predefined control method (which is
18926f3cdf0SGordon Ross * implemented internally within this module.)
19026f3cdf0SGordon Ross *
19126f3cdf0SGordon Ross * March 2009: Removed "Linux" as this host no longer wants to respond true
19226f3cdf0SGordon Ross * for this string. Basically, the only safe OS strings are windows-related
19326f3cdf0SGordon Ross * and in many or most cases represent the only test path within the
19426f3cdf0SGordon Ross * BIOS-provided ASL code.
19526f3cdf0SGordon Ross *
19626f3cdf0SGordon Ross * The last element of each entry is used to track the newest version of
19726f3cdf0SGordon Ross * Windows that the BIOS has requested.
19826f3cdf0SGordon Ross */
19926f3cdf0SGordon Ross static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
20026f3cdf0SGordon Ross {
20126f3cdf0SGordon Ross /* Operating System Vendor Strings */
20226f3cdf0SGordon Ross
20326f3cdf0SGordon Ross {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */
20426f3cdf0SGordon Ross {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */
20526f3cdf0SGordon Ross {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */
20626f3cdf0SGordon Ross {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */
20726f3cdf0SGordon Ross {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */
20826f3cdf0SGordon Ross {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */
20926f3cdf0SGordon Ross {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */
21026f3cdf0SGordon Ross {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */
21126f3cdf0SGordon Ross {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
21226f3cdf0SGordon Ross {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
21326f3cdf0SGordon Ross {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
214*35786f68SRobert Mustacchi {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
215*35786f68SRobert Mustacchi {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
216*35786f68SRobert Mustacchi {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */
217*35786f68SRobert Mustacchi {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */
218*35786f68SRobert Mustacchi {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */
219*35786f68SRobert Mustacchi {"Windows 2017.2", NULL, 0, ACPI_OSI_WIN_10_RS3}, /* Windows 10 version 1709 - Added 02/2018 */
22026f3cdf0SGordon Ross
22126f3cdf0SGordon Ross /* Feature Group Strings */
22226f3cdf0SGordon Ross
2237b1019a6SJerry Jelinek {"Extended Address Space Descriptor", NULL, ACPI_OSI_FEATURE, 0},
22426f3cdf0SGordon Ross
22526f3cdf0SGordon Ross /*
22626f3cdf0SGordon Ross * All "optional" feature group strings (features that are implemented
2277b1019a6SJerry Jelinek * by the host) should be dynamically modified to VALID by the host via
2287b1019a6SJerry Jelinek * AcpiInstallInterface or AcpiUpdateInterfaces. Such optional feature
2297b1019a6SJerry Jelinek * group strings are set as INVALID by default here.
23026f3cdf0SGordon Ross */
2317b1019a6SJerry Jelinek
2327b1019a6SJerry Jelinek {"Module Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
2337b1019a6SJerry Jelinek {"Processor Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
2347b1019a6SJerry Jelinek {"3.0 Thermal Model", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
2357b1019a6SJerry Jelinek {"3.0 _SCP Extensions", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0},
2367b1019a6SJerry Jelinek {"Processor Aggregator Device", NULL, ACPI_OSI_OPTIONAL_FEATURE, 0}
23726f3cdf0SGordon Ross };
23826f3cdf0SGordon Ross
23926f3cdf0SGordon Ross
24026f3cdf0SGordon Ross /*******************************************************************************
24126f3cdf0SGordon Ross *
24226f3cdf0SGordon Ross * FUNCTION: AcpiUtInitializeInterfaces
24326f3cdf0SGordon Ross *
24426f3cdf0SGordon Ross * PARAMETERS: None
24526f3cdf0SGordon Ross *
24626f3cdf0SGordon Ross * RETURN: Status
24726f3cdf0SGordon Ross *
24826f3cdf0SGordon Ross * DESCRIPTION: Initialize the global _OSI supported interfaces list
24926f3cdf0SGordon Ross *
25026f3cdf0SGordon Ross ******************************************************************************/
25126f3cdf0SGordon Ross
25226f3cdf0SGordon Ross ACPI_STATUS
AcpiUtInitializeInterfaces(void)25326f3cdf0SGordon Ross AcpiUtInitializeInterfaces (
25426f3cdf0SGordon Ross void)
25526f3cdf0SGordon Ross {
2567b1019a6SJerry Jelinek ACPI_STATUS Status;
25726f3cdf0SGordon Ross UINT32 i;
25826f3cdf0SGordon Ross
25926f3cdf0SGordon Ross
2607b1019a6SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
2617b1019a6SJerry Jelinek if (ACPI_FAILURE (Status))
2627b1019a6SJerry Jelinek {
2637b1019a6SJerry Jelinek return (Status);
2647b1019a6SJerry Jelinek }
2657b1019a6SJerry Jelinek
26626f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces;
26726f3cdf0SGordon Ross
26826f3cdf0SGordon Ross /* Link the static list of supported interfaces */
26926f3cdf0SGordon Ross
2707b1019a6SJerry Jelinek for (i = 0;
2717b1019a6SJerry Jelinek i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1);
2727b1019a6SJerry Jelinek i++)
27326f3cdf0SGordon Ross {
27426f3cdf0SGordon Ross AcpiDefaultSupportedInterfaces[i].Next =
27526f3cdf0SGordon Ross &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1];
27626f3cdf0SGordon Ross }
27726f3cdf0SGordon Ross
27826f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
27926f3cdf0SGordon Ross return (AE_OK);
28026f3cdf0SGordon Ross }
28126f3cdf0SGordon Ross
28226f3cdf0SGordon Ross
28326f3cdf0SGordon Ross /*******************************************************************************
28426f3cdf0SGordon Ross *
28526f3cdf0SGordon Ross * FUNCTION: AcpiUtInterfaceTerminate
28626f3cdf0SGordon Ross *
28726f3cdf0SGordon Ross * PARAMETERS: None
28826f3cdf0SGordon Ross *
2897b1019a6SJerry Jelinek * RETURN: Status
29026f3cdf0SGordon Ross *
29126f3cdf0SGordon Ross * DESCRIPTION: Delete all interfaces in the global list. Sets
29226f3cdf0SGordon Ross * AcpiGbl_SupportedInterfaces to NULL.
29326f3cdf0SGordon Ross *
29426f3cdf0SGordon Ross ******************************************************************************/
29526f3cdf0SGordon Ross
2967b1019a6SJerry Jelinek ACPI_STATUS
AcpiUtInterfaceTerminate(void)29726f3cdf0SGordon Ross AcpiUtInterfaceTerminate (
29826f3cdf0SGordon Ross void)
29926f3cdf0SGordon Ross {
3007b1019a6SJerry Jelinek ACPI_STATUS Status;
30126f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface;
30226f3cdf0SGordon Ross
30326f3cdf0SGordon Ross
3047b1019a6SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
3057b1019a6SJerry Jelinek if (ACPI_FAILURE (Status))
3067b1019a6SJerry Jelinek {
3077b1019a6SJerry Jelinek return (Status);
3087b1019a6SJerry Jelinek }
30926f3cdf0SGordon Ross
3107b1019a6SJerry Jelinek NextInterface = AcpiGbl_SupportedInterfaces;
31126f3cdf0SGordon Ross while (NextInterface)
31226f3cdf0SGordon Ross {
31326f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = NextInterface->Next;
31426f3cdf0SGordon Ross
31526f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
31626f3cdf0SGordon Ross {
3177b1019a6SJerry Jelinek /* Only interfaces added at runtime can be freed */
3187b1019a6SJerry Jelinek
31926f3cdf0SGordon Ross ACPI_FREE (NextInterface->Name);
32026f3cdf0SGordon Ross ACPI_FREE (NextInterface);
32126f3cdf0SGordon Ross }
3227b1019a6SJerry Jelinek else
3237b1019a6SJerry Jelinek {
3247b1019a6SJerry Jelinek /* Interface is in static list. Reset it to invalid or valid. */
3257b1019a6SJerry Jelinek
3267b1019a6SJerry Jelinek if (NextInterface->Flags & ACPI_OSI_DEFAULT_INVALID)
3277b1019a6SJerry Jelinek {
3287b1019a6SJerry Jelinek NextInterface->Flags |= ACPI_OSI_INVALID;
3297b1019a6SJerry Jelinek }
3307b1019a6SJerry Jelinek else
3317b1019a6SJerry Jelinek {
3327b1019a6SJerry Jelinek NextInterface->Flags &= ~ACPI_OSI_INVALID;
3337b1019a6SJerry Jelinek }
3347b1019a6SJerry Jelinek }
33526f3cdf0SGordon Ross
33626f3cdf0SGordon Ross NextInterface = AcpiGbl_SupportedInterfaces;
33726f3cdf0SGordon Ross }
33826f3cdf0SGordon Ross
33926f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
3407b1019a6SJerry Jelinek return (AE_OK);
34126f3cdf0SGordon Ross }
34226f3cdf0SGordon Ross
34326f3cdf0SGordon Ross
34426f3cdf0SGordon Ross /*******************************************************************************
34526f3cdf0SGordon Ross *
34626f3cdf0SGordon Ross * FUNCTION: AcpiUtInstallInterface
34726f3cdf0SGordon Ross *
34826f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to install
34926f3cdf0SGordon Ross *
35026f3cdf0SGordon Ross * RETURN: Status
35126f3cdf0SGordon Ross *
35226f3cdf0SGordon Ross * DESCRIPTION: Install the interface into the global interface list.
35326f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex
35426f3cdf0SGordon Ross *
35526f3cdf0SGordon Ross ******************************************************************************/
35626f3cdf0SGordon Ross
35726f3cdf0SGordon Ross ACPI_STATUS
AcpiUtInstallInterface(ACPI_STRING InterfaceName)35826f3cdf0SGordon Ross AcpiUtInstallInterface (
35926f3cdf0SGordon Ross ACPI_STRING InterfaceName)
36026f3cdf0SGordon Ross {
36126f3cdf0SGordon Ross ACPI_INTERFACE_INFO *InterfaceInfo;
36226f3cdf0SGordon Ross
36326f3cdf0SGordon Ross
36426f3cdf0SGordon Ross /* Allocate info block and space for the name string */
36526f3cdf0SGordon Ross
36626f3cdf0SGordon Ross InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO));
36726f3cdf0SGordon Ross if (!InterfaceInfo)
36826f3cdf0SGordon Ross {
36926f3cdf0SGordon Ross return (AE_NO_MEMORY);
37026f3cdf0SGordon Ross }
37126f3cdf0SGordon Ross
3727b1019a6SJerry Jelinek InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (strlen (InterfaceName) + 1);
37326f3cdf0SGordon Ross if (!InterfaceInfo->Name)
37426f3cdf0SGordon Ross {
37526f3cdf0SGordon Ross ACPI_FREE (InterfaceInfo);
37626f3cdf0SGordon Ross return (AE_NO_MEMORY);
37726f3cdf0SGordon Ross }
37826f3cdf0SGordon Ross
37926f3cdf0SGordon Ross /* Initialize new info and insert at the head of the global list */
38026f3cdf0SGordon Ross
3817b1019a6SJerry Jelinek strcpy (InterfaceInfo->Name, InterfaceName);
38226f3cdf0SGordon Ross InterfaceInfo->Flags = ACPI_OSI_DYNAMIC;
38326f3cdf0SGordon Ross InterfaceInfo->Next = AcpiGbl_SupportedInterfaces;
38426f3cdf0SGordon Ross
38526f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = InterfaceInfo;
38626f3cdf0SGordon Ross return (AE_OK);
38726f3cdf0SGordon Ross }
38826f3cdf0SGordon Ross
38926f3cdf0SGordon Ross
39026f3cdf0SGordon Ross /*******************************************************************************
39126f3cdf0SGordon Ross *
39226f3cdf0SGordon Ross * FUNCTION: AcpiUtRemoveInterface
39326f3cdf0SGordon Ross *
39426f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to remove
39526f3cdf0SGordon Ross *
39626f3cdf0SGordon Ross * RETURN: Status
39726f3cdf0SGordon Ross *
39826f3cdf0SGordon Ross * DESCRIPTION: Remove the interface from the global interface list.
39926f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex
40026f3cdf0SGordon Ross *
40126f3cdf0SGordon Ross ******************************************************************************/
40226f3cdf0SGordon Ross
40326f3cdf0SGordon Ross ACPI_STATUS
AcpiUtRemoveInterface(ACPI_STRING InterfaceName)40426f3cdf0SGordon Ross AcpiUtRemoveInterface (
40526f3cdf0SGordon Ross ACPI_STRING InterfaceName)
40626f3cdf0SGordon Ross {
40726f3cdf0SGordon Ross ACPI_INTERFACE_INFO *PreviousInterface;
40826f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface;
40926f3cdf0SGordon Ross
41026f3cdf0SGordon Ross
41126f3cdf0SGordon Ross PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces;
41226f3cdf0SGordon Ross while (NextInterface)
41326f3cdf0SGordon Ross {
4147b1019a6SJerry Jelinek if (!strcmp (InterfaceName, NextInterface->Name))
41526f3cdf0SGordon Ross {
4167b1019a6SJerry Jelinek /*
4177b1019a6SJerry Jelinek * Found: name is in either the static list
4187b1019a6SJerry Jelinek * or was added at runtime
4197b1019a6SJerry Jelinek */
42026f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
42126f3cdf0SGordon Ross {
42226f3cdf0SGordon Ross /* Interface was added dynamically, remove and free it */
42326f3cdf0SGordon Ross
42426f3cdf0SGordon Ross if (PreviousInterface == NextInterface)
42526f3cdf0SGordon Ross {
42626f3cdf0SGordon Ross AcpiGbl_SupportedInterfaces = NextInterface->Next;
42726f3cdf0SGordon Ross }
42826f3cdf0SGordon Ross else
42926f3cdf0SGordon Ross {
43026f3cdf0SGordon Ross PreviousInterface->Next = NextInterface->Next;
43126f3cdf0SGordon Ross }
43226f3cdf0SGordon Ross
43326f3cdf0SGordon Ross ACPI_FREE (NextInterface->Name);
43426f3cdf0SGordon Ross ACPI_FREE (NextInterface);
43526f3cdf0SGordon Ross }
43626f3cdf0SGordon Ross else
43726f3cdf0SGordon Ross {
43826f3cdf0SGordon Ross /*
4397b1019a6SJerry Jelinek * Interface is in static list. If marked invalid, then
4407b1019a6SJerry Jelinek * it does not actually exist. Else, mark it invalid.
44126f3cdf0SGordon Ross */
44226f3cdf0SGordon Ross if (NextInterface->Flags & ACPI_OSI_INVALID)
44326f3cdf0SGordon Ross {
44426f3cdf0SGordon Ross return (AE_NOT_EXIST);
44526f3cdf0SGordon Ross }
44626f3cdf0SGordon Ross
44726f3cdf0SGordon Ross NextInterface->Flags |= ACPI_OSI_INVALID;
44826f3cdf0SGordon Ross }
44926f3cdf0SGordon Ross
45026f3cdf0SGordon Ross return (AE_OK);
45126f3cdf0SGordon Ross }
45226f3cdf0SGordon Ross
45326f3cdf0SGordon Ross PreviousInterface = NextInterface;
45426f3cdf0SGordon Ross NextInterface = NextInterface->Next;
45526f3cdf0SGordon Ross }
45626f3cdf0SGordon Ross
45726f3cdf0SGordon Ross /* Interface was not found */
45826f3cdf0SGordon Ross
45926f3cdf0SGordon Ross return (AE_NOT_EXIST);
46026f3cdf0SGordon Ross }
46126f3cdf0SGordon Ross
46226f3cdf0SGordon Ross
4637b1019a6SJerry Jelinek /*******************************************************************************
4647b1019a6SJerry Jelinek *
4657b1019a6SJerry Jelinek * FUNCTION: AcpiUtUpdateInterfaces
4667b1019a6SJerry Jelinek *
4677b1019a6SJerry Jelinek * PARAMETERS: Action - Actions to be performed during the
4687b1019a6SJerry Jelinek * update
4697b1019a6SJerry Jelinek *
4707b1019a6SJerry Jelinek * RETURN: Status
4717b1019a6SJerry Jelinek *
4727b1019a6SJerry Jelinek * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor
4737b1019a6SJerry Jelinek * strings or/and feature group strings.
4747b1019a6SJerry Jelinek * Caller MUST hold AcpiGbl_OsiMutex
4757b1019a6SJerry Jelinek *
4767b1019a6SJerry Jelinek ******************************************************************************/
4777b1019a6SJerry Jelinek
4787b1019a6SJerry Jelinek ACPI_STATUS
AcpiUtUpdateInterfaces(UINT8 Action)4797b1019a6SJerry Jelinek AcpiUtUpdateInterfaces (
4807b1019a6SJerry Jelinek UINT8 Action)
4817b1019a6SJerry Jelinek {
4827b1019a6SJerry Jelinek ACPI_INTERFACE_INFO *NextInterface;
4837b1019a6SJerry Jelinek
4847b1019a6SJerry Jelinek
4857b1019a6SJerry Jelinek NextInterface = AcpiGbl_SupportedInterfaces;
4867b1019a6SJerry Jelinek while (NextInterface)
4877b1019a6SJerry Jelinek {
4887b1019a6SJerry Jelinek if (((NextInterface->Flags & ACPI_OSI_FEATURE) &&
4897b1019a6SJerry Jelinek (Action & ACPI_FEATURE_STRINGS)) ||
4907b1019a6SJerry Jelinek (!(NextInterface->Flags & ACPI_OSI_FEATURE) &&
4917b1019a6SJerry Jelinek (Action & ACPI_VENDOR_STRINGS)))
4927b1019a6SJerry Jelinek {
4937b1019a6SJerry Jelinek if (Action & ACPI_DISABLE_INTERFACES)
4947b1019a6SJerry Jelinek {
4957b1019a6SJerry Jelinek /* Mark the interfaces as invalid */
4967b1019a6SJerry Jelinek
4977b1019a6SJerry Jelinek NextInterface->Flags |= ACPI_OSI_INVALID;
4987b1019a6SJerry Jelinek }
4997b1019a6SJerry Jelinek else
5007b1019a6SJerry Jelinek {
5017b1019a6SJerry Jelinek /* Mark the interfaces as valid */
5027b1019a6SJerry Jelinek
5037b1019a6SJerry Jelinek NextInterface->Flags &= ~ACPI_OSI_INVALID;
5047b1019a6SJerry Jelinek }
5057b1019a6SJerry Jelinek }
5067b1019a6SJerry Jelinek
5077b1019a6SJerry Jelinek NextInterface = NextInterface->Next;
5087b1019a6SJerry Jelinek }
5097b1019a6SJerry Jelinek
5107b1019a6SJerry Jelinek return (AE_OK);
5117b1019a6SJerry Jelinek }
5127b1019a6SJerry Jelinek
5137b1019a6SJerry Jelinek
51426f3cdf0SGordon Ross /*******************************************************************************
51526f3cdf0SGordon Ross *
51626f3cdf0SGordon Ross * FUNCTION: AcpiUtGetInterface
51726f3cdf0SGordon Ross *
51826f3cdf0SGordon Ross * PARAMETERS: InterfaceName - The interface to find
51926f3cdf0SGordon Ross *
52026f3cdf0SGordon Ross * RETURN: ACPI_INTERFACE_INFO if found. NULL if not found.
52126f3cdf0SGordon Ross *
52226f3cdf0SGordon Ross * DESCRIPTION: Search for the specified interface name in the global list.
52326f3cdf0SGordon Ross * Caller MUST hold AcpiGbl_OsiMutex
52426f3cdf0SGordon Ross *
52526f3cdf0SGordon Ross ******************************************************************************/
52626f3cdf0SGordon Ross
52726f3cdf0SGordon Ross ACPI_INTERFACE_INFO *
AcpiUtGetInterface(ACPI_STRING InterfaceName)52826f3cdf0SGordon Ross AcpiUtGetInterface (
52926f3cdf0SGordon Ross ACPI_STRING InterfaceName)
53026f3cdf0SGordon Ross {
53126f3cdf0SGordon Ross ACPI_INTERFACE_INFO *NextInterface;
53226f3cdf0SGordon Ross
53326f3cdf0SGordon Ross
53426f3cdf0SGordon Ross NextInterface = AcpiGbl_SupportedInterfaces;
53526f3cdf0SGordon Ross while (NextInterface)
53626f3cdf0SGordon Ross {
5377b1019a6SJerry Jelinek if (!strcmp (InterfaceName, NextInterface->Name))
53826f3cdf0SGordon Ross {
53926f3cdf0SGordon Ross return (NextInterface);
54026f3cdf0SGordon Ross }
54126f3cdf0SGordon Ross
54226f3cdf0SGordon Ross NextInterface = NextInterface->Next;
54326f3cdf0SGordon Ross }
54426f3cdf0SGordon Ross
54526f3cdf0SGordon Ross return (NULL);
54626f3cdf0SGordon Ross }
54726f3cdf0SGordon Ross
54826f3cdf0SGordon Ross
54926f3cdf0SGordon Ross /*******************************************************************************
55026f3cdf0SGordon Ross *
55126f3cdf0SGordon Ross * FUNCTION: AcpiUtOsiImplementation
55226f3cdf0SGordon Ross *
55326f3cdf0SGordon Ross * PARAMETERS: WalkState - Current walk state
55426f3cdf0SGordon Ross *
55526f3cdf0SGordon Ross * RETURN: Status
556*35786f68SRobert Mustacchi * Integer: TRUE (0) if input string is matched
557*35786f68SRobert Mustacchi * FALSE (-1) if string is not matched
55826f3cdf0SGordon Ross *
55926f3cdf0SGordon Ross * DESCRIPTION: Implementation of the _OSI predefined control method. When
56026f3cdf0SGordon Ross * an invocation of _OSI is encountered in the system AML,
56126f3cdf0SGordon Ross * control is transferred to this function.
56226f3cdf0SGordon Ross *
563*35786f68SRobert Mustacchi * (August 2016)
564*35786f68SRobert Mustacchi * Note: _OSI is now defined to return "Ones" to indicate a match, for
565*35786f68SRobert Mustacchi * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones
566*35786f68SRobert Mustacchi * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF
567*35786f68SRobert Mustacchi * (ACPI_UINT64_MAX).
568*35786f68SRobert Mustacchi *
569*35786f68SRobert Mustacchi * This function always returns ACPI_UINT64_MAX for TRUE, and later code
570*35786f68SRobert Mustacchi * will truncate this to 32 bits if necessary.
571*35786f68SRobert Mustacchi *
57226f3cdf0SGordon Ross ******************************************************************************/
57326f3cdf0SGordon Ross
57426f3cdf0SGordon Ross ACPI_STATUS
AcpiUtOsiImplementation(ACPI_WALK_STATE * WalkState)57526f3cdf0SGordon Ross AcpiUtOsiImplementation (
57626f3cdf0SGordon Ross ACPI_WALK_STATE *WalkState)
57726f3cdf0SGordon Ross {
57826f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *StringDesc;
57926f3cdf0SGordon Ross ACPI_OPERAND_OBJECT *ReturnDesc;
58026f3cdf0SGordon Ross ACPI_INTERFACE_INFO *InterfaceInfo;
58126f3cdf0SGordon Ross ACPI_INTERFACE_HANDLER InterfaceHandler;
5827b1019a6SJerry Jelinek ACPI_STATUS Status;
583*35786f68SRobert Mustacchi UINT64 ReturnValue;
58426f3cdf0SGordon Ross
58526f3cdf0SGordon Ross
58626f3cdf0SGordon Ross ACPI_FUNCTION_TRACE (UtOsiImplementation);
58726f3cdf0SGordon Ross
58826f3cdf0SGordon Ross
58926f3cdf0SGordon Ross /* Validate the string input argument (from the AML caller) */
59026f3cdf0SGordon Ross
59126f3cdf0SGordon Ross StringDesc = WalkState->Arguments[0].Object;
59226f3cdf0SGordon Ross if (!StringDesc ||
59326f3cdf0SGordon Ross (StringDesc->Common.Type != ACPI_TYPE_STRING))
59426f3cdf0SGordon Ross {
59526f3cdf0SGordon Ross return_ACPI_STATUS (AE_TYPE);
59626f3cdf0SGordon Ross }
59726f3cdf0SGordon Ross
59826f3cdf0SGordon Ross /* Create a return object */
59926f3cdf0SGordon Ross
60026f3cdf0SGordon Ross ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
60126f3cdf0SGordon Ross if (!ReturnDesc)
60226f3cdf0SGordon Ross {
60326f3cdf0SGordon Ross return_ACPI_STATUS (AE_NO_MEMORY);
60426f3cdf0SGordon Ross }
60526f3cdf0SGordon Ross
60626f3cdf0SGordon Ross /* Default return value is 0, NOT SUPPORTED */
60726f3cdf0SGordon Ross
60826f3cdf0SGordon Ross ReturnValue = 0;
6097b1019a6SJerry Jelinek Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
6107b1019a6SJerry Jelinek if (ACPI_FAILURE (Status))
6117b1019a6SJerry Jelinek {
6127b1019a6SJerry Jelinek AcpiUtRemoveReference (ReturnDesc);
6137b1019a6SJerry Jelinek return_ACPI_STATUS (Status);
6147b1019a6SJerry Jelinek }
61526f3cdf0SGordon Ross
61626f3cdf0SGordon Ross /* Lookup the interface in the global _OSI list */
61726f3cdf0SGordon Ross
61826f3cdf0SGordon Ross InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer);
61926f3cdf0SGordon Ross if (InterfaceInfo &&
62026f3cdf0SGordon Ross !(InterfaceInfo->Flags & ACPI_OSI_INVALID))
62126f3cdf0SGordon Ross {
62226f3cdf0SGordon Ross /*
62326f3cdf0SGordon Ross * The interface is supported.
62426f3cdf0SGordon Ross * Update the OsiData if necessary. We keep track of the latest
62526f3cdf0SGordon Ross * version of Windows that has been requested by the BIOS.
62626f3cdf0SGordon Ross */
62726f3cdf0SGordon Ross if (InterfaceInfo->Value > AcpiGbl_OsiData)
62826f3cdf0SGordon Ross {
62926f3cdf0SGordon Ross AcpiGbl_OsiData = InterfaceInfo->Value;
63026f3cdf0SGordon Ross }
63126f3cdf0SGordon Ross
632*35786f68SRobert Mustacchi ReturnValue = ACPI_UINT64_MAX;
63326f3cdf0SGordon Ross }
63426f3cdf0SGordon Ross
63526f3cdf0SGordon Ross AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
63626f3cdf0SGordon Ross
63726f3cdf0SGordon Ross /*
63826f3cdf0SGordon Ross * Invoke an optional _OSI interface handler. The host OS may wish
63926f3cdf0SGordon Ross * to do some interface-specific handling. For example, warn about
64026f3cdf0SGordon Ross * certain interfaces or override the true/false support value.
64126f3cdf0SGordon Ross */
64226f3cdf0SGordon Ross InterfaceHandler = AcpiGbl_InterfaceHandler;
64326f3cdf0SGordon Ross if (InterfaceHandler)
64426f3cdf0SGordon Ross {
645*35786f68SRobert Mustacchi if (InterfaceHandler (
646*35786f68SRobert Mustacchi StringDesc->String.Pointer, (UINT32) ReturnValue))
647*35786f68SRobert Mustacchi {
648*35786f68SRobert Mustacchi ReturnValue = ACPI_UINT64_MAX;
649*35786f68SRobert Mustacchi }
65026f3cdf0SGordon Ross }
65126f3cdf0SGordon Ross
65226f3cdf0SGordon Ross ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
65326f3cdf0SGordon Ross "ACPI: BIOS _OSI(\"%s\") is %ssupported\n",
65426f3cdf0SGordon Ross StringDesc->String.Pointer, ReturnValue == 0 ? "not " : ""));
65526f3cdf0SGordon Ross
65626f3cdf0SGordon Ross /* Complete the return object */
65726f3cdf0SGordon Ross
65826f3cdf0SGordon Ross ReturnDesc->Integer.Value = ReturnValue;
65926f3cdf0SGordon Ross WalkState->ReturnDesc = ReturnDesc;
66026f3cdf0SGordon Ross return_ACPI_STATUS (AE_OK);
66126f3cdf0SGordon Ross }
662