utosi.c revision 210944
1210944Sjkim/******************************************************************************
2210944Sjkim *
3210944Sjkim * Module Name: utosi - Support for the _OSI predefined control method
4210944Sjkim *
5210944Sjkim *****************************************************************************/
6210944Sjkim
7210944Sjkim/******************************************************************************
8210944Sjkim *
9210944Sjkim * 1. Copyright Notice
10210944Sjkim *
11210944Sjkim * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12210944Sjkim * All rights reserved.
13210944Sjkim *
14210944Sjkim * 2. License
15210944Sjkim *
16210944Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property
17210944Sjkim * rights.  You may have additional license terms from the party that provided
18210944Sjkim * you this software, covering your right to use that party's intellectual
19210944Sjkim * property rights.
20210944Sjkim *
21210944Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22210944Sjkim * copy of the source code appearing in this file ("Covered Code") an
23210944Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24210944Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy,
25210944Sjkim * make derivatives, distribute, use and display any portion of the Covered
26210944Sjkim * Code in any form, with the right to sublicense such rights; and
27210944Sjkim *
28210944Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29210944Sjkim * license (with the right to sublicense), under only those claims of Intel
30210944Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell,
31210944Sjkim * offer to sell, and import the Covered Code and derivative works thereof
32210944Sjkim * solely to the minimum extent necessary to exercise the above copyright
33210944Sjkim * license, and in no event shall the patent license extend to any additions
34210944Sjkim * to or modifications of the Original Intel Code.  No other license or right
35210944Sjkim * is granted directly or by implication, estoppel or otherwise;
36210944Sjkim *
37210944Sjkim * The above copyright and patent license is granted only if the following
38210944Sjkim * conditions are met:
39210944Sjkim *
40210944Sjkim * 3. Conditions
41210944Sjkim *
42210944Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43210944Sjkim * Redistribution of source code of any substantial portion of the Covered
44210944Sjkim * Code or modification with rights to further distribute source must include
45210944Sjkim * the above Copyright Notice, the above License, this list of Conditions,
46210944Sjkim * and the following Disclaimer and Export Compliance provision.  In addition,
47210944Sjkim * Licensee must cause all Covered Code to which Licensee contributes to
48210944Sjkim * contain a file documenting the changes Licensee made to create that Covered
49210944Sjkim * Code and the date of any change.  Licensee must include in that file the
50210944Sjkim * documentation of any changes made by any predecessor Licensee.  Licensee
51210944Sjkim * must include a prominent statement that the modification is derived,
52210944Sjkim * directly or indirectly, from Original Intel Code.
53210944Sjkim *
54210944Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55210944Sjkim * Redistribution of source code of any substantial portion of the Covered
56210944Sjkim * Code or modification without rights to further distribute source must
57210944Sjkim * include the following Disclaimer and Export Compliance provision in the
58210944Sjkim * documentation and/or other materials provided with distribution.  In
59210944Sjkim * addition, Licensee may not authorize further sublicense of source of any
60210944Sjkim * portion of the Covered Code, and must include terms to the effect that the
61210944Sjkim * license from Licensee to its licensee is limited to the intellectual
62210944Sjkim * property embodied in the software Licensee provides to its licensee, and
63210944Sjkim * not to intellectual property embodied in modifications its licensee may
64210944Sjkim * make.
65210944Sjkim *
66210944Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any
67210944Sjkim * substantial portion of the Covered Code or modification must reproduce the
68210944Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance
69210944Sjkim * provision in the documentation and/or other materials provided with the
70210944Sjkim * distribution.
71210944Sjkim *
72210944Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original
73210944Sjkim * Intel Code.
74210944Sjkim *
75210944Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76210944Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or
77210944Sjkim * other dealings in products derived from or relating to the Covered Code
78210944Sjkim * without prior written authorization from Intel.
79210944Sjkim *
80210944Sjkim * 4. Disclaimer and Export Compliance
81210944Sjkim *
82210944Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83210944Sjkim * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84210944Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85210944Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86210944Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87210944Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88210944Sjkim * PARTICULAR PURPOSE.
89210944Sjkim *
90210944Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91210944Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92210944Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93210944Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94210944Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95210944Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96210944Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97210944Sjkim * LIMITED REMEDY.
98210944Sjkim *
99210944Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this
100210944Sjkim * software or system incorporating such software without first obtaining any
101210944Sjkim * required license or other approval from the U. S. Department of Commerce or
102210944Sjkim * any other agency or department of the United States Government.  In the
103210944Sjkim * event Licensee exports any such software from the United States or
104210944Sjkim * re-exports any such software from a foreign destination, Licensee shall
105210944Sjkim * ensure that the distribution and export/re-export of the software is in
106210944Sjkim * compliance with all laws, regulations, orders, or other restrictions of the
107210944Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108210944Sjkim * any of its subsidiaries will export/re-export any technical data, process,
109210944Sjkim * software, or service, directly or indirectly, to any country for which the
110210944Sjkim * United States government or any agency thereof requires an export license,
111210944Sjkim * other governmental approval, or letter of assurance, without first obtaining
112210944Sjkim * such license, approval or letter.
113210944Sjkim *
114210944Sjkim *****************************************************************************/
115210944Sjkim
116210944Sjkim#define __UTOSI_C__
117210944Sjkim
118210944Sjkim#include "acpi.h"
119210944Sjkim#include "accommon.h"
120210944Sjkim
121210944Sjkim
122210944Sjkim#define _COMPONENT          ACPI_UTILITIES
123210944Sjkim        ACPI_MODULE_NAME    ("utosi")
124210944Sjkim
125210944Sjkim/*
126210944Sjkim * Strings supported by the _OSI predefined control method (which is
127210944Sjkim * implemented internally within this module.)
128210944Sjkim *
129210944Sjkim * March 2009: Removed "Linux" as this host no longer wants to respond true
130210944Sjkim * for this string. Basically, the only safe OS strings are windows-related
131210944Sjkim * and in many or most cases represent the only test path within the
132210944Sjkim * BIOS-provided ASL code.
133210944Sjkim *
134210944Sjkim * The last element of each entry is used to track the newest version of
135210944Sjkim * Windows that the BIOS has requested.
136210944Sjkim */
137210944Sjkimstatic ACPI_INTERFACE_INFO    AcpiDefaultSupportedInterfaces[] =
138210944Sjkim{
139210944Sjkim    /* Operating System Vendor Strings */
140210944Sjkim
141210944Sjkim    {"Windows 2000",        NULL, 0, ACPI_OSI_WIN_2000},         /* Windows 2000 */
142210944Sjkim    {"Windows 2001",        NULL, 0, ACPI_OSI_WIN_XP},           /* Windows XP */
143210944Sjkim    {"Windows 2001 SP1",    NULL, 0, ACPI_OSI_WIN_XP_SP1},       /* Windows XP SP1 */
144210944Sjkim    {"Windows 2001.1",      NULL, 0, ACPI_OSI_WINSRV_2003},      /* Windows Server 2003 */
145210944Sjkim    {"Windows 2001 SP2",    NULL, 0, ACPI_OSI_WIN_XP_SP2},       /* Windows XP SP2 */
146210944Sjkim    {"Windows 2001.1 SP1",  NULL, 0, ACPI_OSI_WINSRV_2003_SP1},  /* Windows Server 2003 SP1 - Added 03/2006 */
147210944Sjkim    {"Windows 2006",        NULL, 0, ACPI_OSI_WIN_VISTA},        /* Windows Vista - Added 03/2006 */
148210944Sjkim    {"Windows 2006.1",      NULL, 0, ACPI_OSI_WINSRV_2008},      /* Windows Server 2008 - Added 09/2009 */
149210944Sjkim    {"Windows 2006 SP1",    NULL, 0, ACPI_OSI_WIN_VISTA_SP1},    /* Windows Vista SP1 - Added 09/2009 */
150210944Sjkim    {"Windows 2009",        NULL, 0, ACPI_OSI_WIN_7},            /* Windows 7 and Server 2008 R2 - Added 09/2009 */
151210944Sjkim
152210944Sjkim    /* Feature Group Strings */
153210944Sjkim
154210944Sjkim    {"Extended Address Space Descriptor", NULL, 0, 0}
155210944Sjkim
156210944Sjkim    /*
157210944Sjkim     * All "optional" feature group strings (features that are implemented
158210944Sjkim     * by the host) should be dynamically added by the host via
159210944Sjkim     * AcpiInstallInterface and should not be manually added here.
160210944Sjkim     *
161210944Sjkim     * Examples of optional feature group strings:
162210944Sjkim     *
163210944Sjkim     * "Module Device"
164210944Sjkim     * "Processor Device"
165210944Sjkim     * "3.0 Thermal Model"
166210944Sjkim     * "3.0 _SCP Extensions"
167210944Sjkim     * "Processor Aggregator Device"
168210944Sjkim     */
169210944Sjkim};
170210944Sjkim
171210944Sjkim
172210944Sjkim/*******************************************************************************
173210944Sjkim *
174210944Sjkim * FUNCTION:    AcpiUtInitializeInterfaces
175210944Sjkim *
176210944Sjkim * PARAMETERS:  None
177210944Sjkim *
178210944Sjkim * RETURN:      Status
179210944Sjkim *
180210944Sjkim * DESCRIPTION: Initialize the global _OSI supported interfaces list
181210944Sjkim *
182210944Sjkim ******************************************************************************/
183210944Sjkim
184210944SjkimACPI_STATUS
185210944SjkimAcpiUtInitializeInterfaces (
186210944Sjkim    void)
187210944Sjkim{
188210944Sjkim    UINT32                  i;
189210944Sjkim
190210944Sjkim
191210944Sjkim    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
192210944Sjkim    AcpiGbl_SupportedInterfaces = AcpiDefaultSupportedInterfaces;
193210944Sjkim
194210944Sjkim    /* Link the static list of supported interfaces */
195210944Sjkim
196210944Sjkim    for (i = 0; i < (ACPI_ARRAY_LENGTH (AcpiDefaultSupportedInterfaces) - 1); i++)
197210944Sjkim    {
198210944Sjkim        AcpiDefaultSupportedInterfaces[i].Next =
199210944Sjkim            &AcpiDefaultSupportedInterfaces[(ACPI_SIZE) i + 1];
200210944Sjkim    }
201210944Sjkim
202210944Sjkim    AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
203210944Sjkim    return (AE_OK);
204210944Sjkim}
205210944Sjkim
206210944Sjkim
207210944Sjkim/*******************************************************************************
208210944Sjkim *
209210944Sjkim * FUNCTION:    AcpiUtInterfaceTerminate
210210944Sjkim *
211210944Sjkim * PARAMETERS:  None
212210944Sjkim *
213210944Sjkim * RETURN:      None
214210944Sjkim *
215210944Sjkim * DESCRIPTION: Delete all interfaces in the global list. Sets
216210944Sjkim *              AcpiGbl_SupportedInterfaces to NULL.
217210944Sjkim *
218210944Sjkim ******************************************************************************/
219210944Sjkim
220210944Sjkimvoid
221210944SjkimAcpiUtInterfaceTerminate (
222210944Sjkim    void)
223210944Sjkim{
224210944Sjkim    ACPI_INTERFACE_INFO     *NextInterface;
225210944Sjkim
226210944Sjkim
227210944Sjkim    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
228210944Sjkim    NextInterface = AcpiGbl_SupportedInterfaces;
229210944Sjkim
230210944Sjkim    while (NextInterface)
231210944Sjkim    {
232210944Sjkim        AcpiGbl_SupportedInterfaces = NextInterface->Next;
233210944Sjkim
234210944Sjkim        /* Only interfaces added at runtime can be freed */
235210944Sjkim
236210944Sjkim        if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
237210944Sjkim        {
238210944Sjkim            ACPI_FREE (NextInterface->Name);
239210944Sjkim            ACPI_FREE (NextInterface);
240210944Sjkim        }
241210944Sjkim
242210944Sjkim        NextInterface = AcpiGbl_SupportedInterfaces;
243210944Sjkim    }
244210944Sjkim
245210944Sjkim    AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
246210944Sjkim}
247210944Sjkim
248210944Sjkim
249210944Sjkim/*******************************************************************************
250210944Sjkim *
251210944Sjkim * FUNCTION:    AcpiUtInstallInterface
252210944Sjkim *
253210944Sjkim * PARAMETERS:  InterfaceName       - The interface to install
254210944Sjkim *
255210944Sjkim * RETURN:      Status
256210944Sjkim *
257210944Sjkim * DESCRIPTION: Install the interface into the global interface list.
258210944Sjkim *              Caller MUST hold AcpiGbl_OsiMutex
259210944Sjkim *
260210944Sjkim ******************************************************************************/
261210944Sjkim
262210944SjkimACPI_STATUS
263210944SjkimAcpiUtInstallInterface (
264210944Sjkim    ACPI_STRING             InterfaceName)
265210944Sjkim{
266210944Sjkim    ACPI_INTERFACE_INFO     *InterfaceInfo;
267210944Sjkim
268210944Sjkim
269210944Sjkim    /* Allocate info block and space for the name string */
270210944Sjkim
271210944Sjkim    InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO));
272210944Sjkim    if (!InterfaceInfo)
273210944Sjkim    {
274210944Sjkim        return (AE_NO_MEMORY);
275210944Sjkim    }
276210944Sjkim
277210944Sjkim    InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1);
278210944Sjkim    if (!InterfaceInfo->Name)
279210944Sjkim    {
280210944Sjkim        ACPI_FREE (InterfaceInfo);
281210944Sjkim        return (AE_NO_MEMORY);
282210944Sjkim    }
283210944Sjkim
284210944Sjkim    /* Initialize new info and insert at the head of the global list */
285210944Sjkim
286210944Sjkim    ACPI_STRCPY (InterfaceInfo->Name, InterfaceName);
287210944Sjkim    InterfaceInfo->Flags = ACPI_OSI_DYNAMIC;
288210944Sjkim    InterfaceInfo->Next = AcpiGbl_SupportedInterfaces;
289210944Sjkim
290210944Sjkim    AcpiGbl_SupportedInterfaces = InterfaceInfo;
291210944Sjkim    return (AE_OK);
292210944Sjkim}
293210944Sjkim
294210944Sjkim
295210944Sjkim/*******************************************************************************
296210944Sjkim *
297210944Sjkim * FUNCTION:    AcpiUtRemoveInterface
298210944Sjkim *
299210944Sjkim * PARAMETERS:  InterfaceName       - The interface to remove
300210944Sjkim *
301210944Sjkim * RETURN:      Status
302210944Sjkim *
303210944Sjkim * DESCRIPTION: Remove the interface from the global interface list.
304210944Sjkim *              Caller MUST hold AcpiGbl_OsiMutex
305210944Sjkim *
306210944Sjkim ******************************************************************************/
307210944Sjkim
308210944SjkimACPI_STATUS
309210944SjkimAcpiUtRemoveInterface (
310210944Sjkim    ACPI_STRING             InterfaceName)
311210944Sjkim{
312210944Sjkim    ACPI_INTERFACE_INFO     *PreviousInterface;
313210944Sjkim    ACPI_INTERFACE_INFO     *NextInterface;
314210944Sjkim
315210944Sjkim
316210944Sjkim    PreviousInterface = NextInterface = AcpiGbl_SupportedInterfaces;
317210944Sjkim    while (NextInterface)
318210944Sjkim    {
319210944Sjkim        if (!ACPI_STRCMP (InterfaceName, NextInterface->Name))
320210944Sjkim        {
321210944Sjkim            /* Found: name is in either the static list or was added at runtime */
322210944Sjkim
323210944Sjkim            if (NextInterface->Flags & ACPI_OSI_DYNAMIC)
324210944Sjkim            {
325210944Sjkim                /* Interface was added dynamically, remove and free it */
326210944Sjkim
327210944Sjkim                if (PreviousInterface == NextInterface)
328210944Sjkim                {
329210944Sjkim                    AcpiGbl_SupportedInterfaces = NextInterface->Next;
330210944Sjkim                }
331210944Sjkim                else
332210944Sjkim                {
333210944Sjkim                    PreviousInterface->Next = NextInterface->Next;
334210944Sjkim                }
335210944Sjkim
336210944Sjkim                ACPI_FREE (NextInterface->Name);
337210944Sjkim                ACPI_FREE (NextInterface);
338210944Sjkim            }
339210944Sjkim            else
340210944Sjkim            {
341210944Sjkim                /*
342210944Sjkim                 * Interface is in static list. If marked invalid, then it
343210944Sjkim                 * does not actually exist. Else, mark it invalid.
344210944Sjkim                 */
345210944Sjkim                if (NextInterface->Flags & ACPI_OSI_INVALID)
346210944Sjkim                {
347210944Sjkim                    return (AE_NOT_EXIST);
348210944Sjkim                }
349210944Sjkim
350210944Sjkim                NextInterface->Flags |= ACPI_OSI_INVALID;
351210944Sjkim            }
352210944Sjkim
353210944Sjkim            return (AE_OK);
354210944Sjkim        }
355210944Sjkim
356210944Sjkim        PreviousInterface = NextInterface;
357210944Sjkim        NextInterface = NextInterface->Next;
358210944Sjkim    }
359210944Sjkim
360210944Sjkim    /* Interface was not found */
361210944Sjkim
362210944Sjkim    return (AE_NOT_EXIST);
363210944Sjkim}
364210944Sjkim
365210944Sjkim
366210944Sjkim/*******************************************************************************
367210944Sjkim *
368210944Sjkim * FUNCTION:    AcpiUtGetInterface
369210944Sjkim *
370210944Sjkim * PARAMETERS:  InterfaceName       - The interface to find
371210944Sjkim *
372210944Sjkim * RETURN:      ACPI_INTERFACE_INFO if found. NULL if not found.
373210944Sjkim *
374210944Sjkim * DESCRIPTION: Search for the specified interface name in the global list.
375210944Sjkim *              Caller MUST hold AcpiGbl_OsiMutex
376210944Sjkim *
377210944Sjkim ******************************************************************************/
378210944Sjkim
379210944SjkimACPI_INTERFACE_INFO *
380210944SjkimAcpiUtGetInterface (
381210944Sjkim    ACPI_STRING             InterfaceName)
382210944Sjkim{
383210944Sjkim    ACPI_INTERFACE_INFO     *NextInterface;
384210944Sjkim
385210944Sjkim
386210944Sjkim    NextInterface = AcpiGbl_SupportedInterfaces;
387210944Sjkim    while (NextInterface)
388210944Sjkim    {
389210944Sjkim        if (!ACPI_STRCMP (InterfaceName, NextInterface->Name))
390210944Sjkim        {
391210944Sjkim            return (NextInterface);
392210944Sjkim        }
393210944Sjkim
394210944Sjkim        NextInterface = NextInterface->Next;
395210944Sjkim    }
396210944Sjkim
397210944Sjkim    return (NULL);
398210944Sjkim}
399210944Sjkim
400210944Sjkim
401210944Sjkim/*******************************************************************************
402210944Sjkim *
403210944Sjkim * FUNCTION:    AcpiUtOsiImplementation
404210944Sjkim *
405210944Sjkim * PARAMETERS:  WalkState           - Current walk state
406210944Sjkim *
407210944Sjkim * RETURN:      Status
408210944Sjkim *
409210944Sjkim * DESCRIPTION: Implementation of the _OSI predefined control method. When
410210944Sjkim *              an invocation of _OSI is encountered in the system AML,
411210944Sjkim *              control is transferred to this function.
412210944Sjkim *
413210944Sjkim ******************************************************************************/
414210944Sjkim
415210944SjkimACPI_STATUS
416210944SjkimAcpiUtOsiImplementation (
417210944Sjkim    ACPI_WALK_STATE         *WalkState)
418210944Sjkim{
419210944Sjkim    ACPI_OPERAND_OBJECT     *StringDesc;
420210944Sjkim    ACPI_OPERAND_OBJECT     *ReturnDesc;
421210944Sjkim    ACPI_INTERFACE_INFO     *InterfaceInfo;
422210944Sjkim    ACPI_INTERFACE_HANDLER  InterfaceHandler;
423210944Sjkim    UINT32                  ReturnValue;
424210944Sjkim
425210944Sjkim
426210944Sjkim    ACPI_FUNCTION_TRACE (UtOsiImplementation);
427210944Sjkim
428210944Sjkim
429210944Sjkim    /* Validate the string input argument (from the AML caller) */
430210944Sjkim
431210944Sjkim    StringDesc = WalkState->Arguments[0].Object;
432210944Sjkim    if (!StringDesc ||
433210944Sjkim        (StringDesc->Common.Type != ACPI_TYPE_STRING))
434210944Sjkim    {
435210944Sjkim        return_ACPI_STATUS (AE_TYPE);
436210944Sjkim    }
437210944Sjkim
438210944Sjkim    /* Create a return object */
439210944Sjkim
440210944Sjkim    ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
441210944Sjkim    if (!ReturnDesc)
442210944Sjkim    {
443210944Sjkim        return_ACPI_STATUS (AE_NO_MEMORY);
444210944Sjkim    }
445210944Sjkim
446210944Sjkim    /* Default return value is 0, NOT SUPPORTED */
447210944Sjkim
448210944Sjkim    ReturnValue = 0;
449210944Sjkim    (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
450210944Sjkim
451210944Sjkim    /* Lookup the interface in the global _OSI list */
452210944Sjkim
453210944Sjkim    InterfaceInfo = AcpiUtGetInterface (StringDesc->String.Pointer);
454210944Sjkim    if (InterfaceInfo &&
455210944Sjkim        !(InterfaceInfo->Flags & ACPI_OSI_INVALID))
456210944Sjkim    {
457210944Sjkim        /*
458210944Sjkim         * The interface is supported.
459210944Sjkim         * Update the OsiData if necessary. We keep track of the latest
460210944Sjkim         * version of Windows that has been requested by the BIOS.
461210944Sjkim         */
462210944Sjkim        if (InterfaceInfo->Value > AcpiGbl_OsiData)
463210944Sjkim        {
464210944Sjkim            AcpiGbl_OsiData = InterfaceInfo->Value;
465210944Sjkim        }
466210944Sjkim
467210944Sjkim        ReturnValue = ACPI_UINT32_MAX;
468210944Sjkim    }
469210944Sjkim
470210944Sjkim    AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
471210944Sjkim
472210944Sjkim    /*
473210944Sjkim     * Invoke an optional _OSI interface handler. The host OS may wish
474210944Sjkim     * to do some interface-specific handling. For example, warn about
475210944Sjkim     * certain interfaces or override the true/false support value.
476210944Sjkim     */
477210944Sjkim    InterfaceHandler = AcpiGbl_InterfaceHandler;
478210944Sjkim    if (InterfaceHandler)
479210944Sjkim    {
480210944Sjkim        ReturnValue = InterfaceHandler (
481210944Sjkim            StringDesc->String.Pointer, ReturnValue);
482210944Sjkim    }
483210944Sjkim
484210944Sjkim    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
485210944Sjkim        "ACPI: BIOS _OSI(\"%s\") is %ssupported\n",
486210944Sjkim        StringDesc->String.Pointer, ReturnValue == 0 ? "not " : ""));
487210944Sjkim
488210944Sjkim    /* Complete the return object */
489210944Sjkim
490210944Sjkim    ReturnDesc->Integer.Value = ReturnValue;
491210944Sjkim    WalkState->ReturnDesc = ReturnDesc;
492210944Sjkim    return_ACPI_STATUS (AE_OK);
493210944Sjkim}
494