Home | History | Annotate | Line # | Download | only in acpiexec
aetests.c revision 1.1.1.2
      1      1.1  christos /******************************************************************************
      2      1.1  christos  *
      3      1.1  christos  * Module Name: aetests - Miscellaneous tests for ACPICA public interfaces
      4      1.1  christos  *
      5      1.1  christos  *****************************************************************************/
      6      1.1  christos 
      7      1.1  christos /*
      8  1.1.1.2  christos  * Copyright (C) 2000 - 2018, Intel Corp.
      9      1.1  christos  * All rights reserved.
     10      1.1  christos  *
     11      1.1  christos  * Redistribution and use in source and binary forms, with or without
     12      1.1  christos  * modification, are permitted provided that the following conditions
     13      1.1  christos  * are met:
     14      1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15      1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16      1.1  christos  *    without modification.
     17      1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18      1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19      1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20      1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21      1.1  christos  *    binary redistribution.
     22      1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23      1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24      1.1  christos  *    from this software without specific prior written permission.
     25      1.1  christos  *
     26      1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27      1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28      1.1  christos  * Software Foundation.
     29      1.1  christos  *
     30      1.1  christos  * NO WARRANTY
     31      1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32      1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33      1.1  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34      1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35      1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36      1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37      1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38      1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39      1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40      1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41      1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42      1.1  christos  */
     43      1.1  christos 
     44      1.1  christos #include "aecommon.h"
     45      1.1  christos 
     46      1.1  christos #define _COMPONENT          ACPI_TOOLS
     47      1.1  christos         ACPI_MODULE_NAME    ("aetests")
     48      1.1  christos 
     49      1.1  christos /* Local prototypes */
     50      1.1  christos 
     51      1.1  christos static void
     52      1.1  christos AeMutexInterfaces (
     53      1.1  christos     void);
     54      1.1  christos 
     55      1.1  christos static void
     56      1.1  christos AeHardwareInterfaces (
     57      1.1  christos     void);
     58      1.1  christos 
     59      1.1  christos static void
     60      1.1  christos AeTestSleepData (
     61      1.1  christos     void);
     62      1.1  christos 
     63      1.1  christos 
     64      1.1  christos /******************************************************************************
     65      1.1  christos  *
     66      1.1  christos  * FUNCTION:    AeMiscellaneousTests
     67      1.1  christos  *
     68      1.1  christos  * DESCRIPTION: Various ACPICA validation tests.
     69      1.1  christos  *
     70      1.1  christos  *****************************************************************************/
     71      1.1  christos 
     72      1.1  christos void
     73      1.1  christos AeMiscellaneousTests (
     74      1.1  christos     void)
     75      1.1  christos {
     76      1.1  christos     ACPI_BUFFER             ReturnBuf;
     77      1.1  christos     char                    Buffer[32];
     78      1.1  christos     ACPI_STATUS             Status;
     79      1.1  christos     ACPI_STATISTICS         Stats;
     80      1.1  christos     ACPI_HANDLE             Handle;
     81      1.1  christos 
     82      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
     83      1.1  christos     UINT32                  Temp;
     84      1.1  christos     UINT32                  LockHandle1;
     85      1.1  christos     UINT32                  LockHandle2;
     86      1.1  christos     ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
     87      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
     88      1.1  christos 
     89      1.1  christos 
     90      1.1  christos     Status = AcpiGetHandle (NULL, "\\", &Handle);
     91      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
     92      1.1  christos 
     93      1.1  christos     if (AcpiGbl_DoInterfaceTests)
     94      1.1  christos     {
     95      1.1  christos         /*
     96      1.1  christos          * Tests for AcpiLoadTable and AcpiUnloadParentTable
     97      1.1  christos          */
     98      1.1  christos 
     99      1.1  christos         /* Attempt unload of DSDT, should fail */
    100      1.1  christos 
    101      1.1  christos         Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
    102      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    103      1.1  christos 
    104      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    105      1.1  christos         ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
    106      1.1  christos 
    107      1.1  christos         /* Load and unload SSDT4 */
    108      1.1  christos 
    109      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
    110      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    111      1.1  christos 
    112      1.1  christos         Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
    113      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    114      1.1  christos 
    115      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    116      1.1  christos         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
    117      1.1  christos 
    118      1.1  christos         /* Re-load SSDT4 */
    119      1.1  christos 
    120      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
    121      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    122      1.1  christos 
    123      1.1  christos         /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
    124      1.1  christos 
    125      1.1  christos         Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
    126      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    127      1.1  christos 
    128      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    129      1.1  christos         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
    130      1.1  christos 
    131      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
    132      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    133      1.1  christos 
    134      1.1  christos         /* Load OEM9 table (causes table override) */
    135      1.1  christos 
    136      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
    137      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    138      1.1  christos     }
    139      1.1  christos 
    140      1.1  christos     AeHardwareInterfaces ();
    141      1.1  christos     AeGenericRegisters ();
    142      1.1  christos     AeSetupConfiguration (Ssdt3Code);
    143      1.1  christos 
    144      1.1  christos     AeTestBufferArgument();
    145      1.1  christos     AeTestPackageArgument ();
    146      1.1  christos     AeMutexInterfaces ();
    147      1.1  christos     AeTestSleepData ();
    148      1.1  christos 
    149      1.1  christos     /* Test _OSI install/remove */
    150      1.1  christos 
    151      1.1  christos     Status = AcpiInstallInterface ("");
    152      1.1  christos     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
    153      1.1  christos 
    154      1.1  christos     Status = AcpiInstallInterface ("TestString");
    155      1.1  christos     ACPI_CHECK_OK (AcpiInstallInterface, Status);
    156      1.1  christos 
    157      1.1  christos     Status = AcpiInstallInterface ("TestString");
    158      1.1  christos     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
    159      1.1  christos 
    160      1.1  christos     Status = AcpiRemoveInterface ("Windows 2006");
    161      1.1  christos     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
    162      1.1  christos 
    163      1.1  christos     Status = AcpiRemoveInterface ("TestString");
    164      1.1  christos     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
    165      1.1  christos 
    166      1.1  christos     Status = AcpiRemoveInterface ("XXXXXX");
    167      1.1  christos     ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
    168      1.1  christos 
    169      1.1  christos     Status = AcpiInstallInterface ("AnotherTestString");
    170      1.1  christos     ACPI_CHECK_OK (AcpiInstallInterface, Status);
    171      1.1  christos 
    172      1.1  christos     /* Test _OSI execution */
    173      1.1  christos 
    174      1.1  christos     Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
    175      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    176      1.1  christos 
    177      1.1  christos     Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
    178      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    179      1.1  christos 
    180      1.1  christos     Status = ExecuteOSI ("MichiganTerminalSystem", 0);
    181      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    182      1.1  christos 
    183      1.1  christos 
    184      1.1  christos     ReturnBuf.Length = 32;
    185      1.1  christos     ReturnBuf.Pointer = Buffer;
    186      1.1  christos 
    187      1.1  christos     Status = AcpiGetName (ACPI_ROOT_OBJECT,
    188      1.1  christos         ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
    189      1.1  christos     ACPI_CHECK_OK (AcpiGetName, Status);
    190      1.1  christos 
    191      1.1  christos     /* Get Devices */
    192      1.1  christos 
    193      1.1  christos     Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
    194      1.1  christos     ACPI_CHECK_OK (AcpiGetDevices, Status);
    195      1.1  christos 
    196      1.1  christos     Status = AcpiGetStatistics (&Stats);
    197      1.1  christos     ACPI_CHECK_OK (AcpiGetStatistics, Status);
    198      1.1  christos 
    199      1.1  christos 
    200      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
    201      1.1  christos 
    202      1.1  christos     Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
    203      1.1  christos     ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
    204      1.1  christos 
    205      1.1  christos     /* If Hardware Reduced flag is set, we are all done */
    206      1.1  christos 
    207      1.1  christos     if (AcpiGbl_ReducedHardware)
    208      1.1  christos     {
    209      1.1  christos         return;
    210      1.1  christos     }
    211      1.1  christos 
    212      1.1  christos     Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
    213      1.1  christos     ACPI_CHECK_OK (AcpiEnableEvent, Status);
    214      1.1  christos 
    215      1.1  christos     /*
    216      1.1  christos      * GPEs: Handlers, enable/disable, etc.
    217      1.1  christos      */
    218      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0,
    219      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    220      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    221      1.1  christos 
    222      1.1  christos     Status = AcpiEnableGpe (NULL, 0);
    223      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    224      1.1  christos 
    225      1.1  christos     Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
    226      1.1  christos     ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
    227      1.1  christos 
    228      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0,
    229      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    230      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    231      1.1  christos 
    232      1.1  christos     Status = AcpiEnableGpe (NULL, 0);
    233      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    234      1.1  christos 
    235      1.1  christos     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
    236      1.1  christos     ACPI_CHECK_OK (AcpiSetGpe, Status);
    237      1.1  christos 
    238      1.1  christos     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
    239      1.1  christos     ACPI_CHECK_OK (AcpiSetGpe, Status);
    240      1.1  christos 
    241      1.1  christos 
    242      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 1,
    243      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    244      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    245      1.1  christos 
    246      1.1  christos     Status = AcpiEnableGpe (NULL, 1);
    247      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    248      1.1  christos 
    249      1.1  christos 
    250      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 2,
    251      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    252      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    253      1.1  christos 
    254      1.1  christos     Status = AcpiEnableGpe (NULL, 2);
    255      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    256      1.1  christos 
    257      1.1  christos 
    258      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 3,
    259      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    260      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    261      1.1  christos 
    262      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 4,
    263      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    264      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    265      1.1  christos 
    266      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 5,
    267      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    268      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    269      1.1  christos 
    270      1.1  christos     Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
    271      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
    272      1.1  christos 
    273      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 5);
    274      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    275      1.1  christos 
    276      1.1  christos     Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
    277      1.1  christos     ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
    278      1.1  christos 
    279      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 6);
    280      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    281      1.1  christos 
    282      1.1  christos     Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
    283      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    284      1.1  christos 
    285      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 9);
    286      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    287      1.1  christos 
    288      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0x19,
    289      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    290      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    291      1.1  christos 
    292      1.1  christos     Status = AcpiEnableGpe (NULL, 0x19);
    293      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    294      1.1  christos 
    295      1.1  christos 
    296      1.1  christos     /* GPE block 1 */
    297      1.1  christos 
    298      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 101,
    299      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    300      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    301      1.1  christos 
    302      1.1  christos     Status = AcpiEnableGpe (NULL, 101);
    303      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    304      1.1  christos 
    305      1.1  christos     Status = AcpiDisableGpe (NULL, 101);
    306      1.1  christos     ACPI_CHECK_OK (AcpiDisableGpe, Status);
    307      1.1  christos 
    308      1.1  christos     AfInstallGpeBlock ();
    309      1.1  christos 
    310      1.1  christos     /* Here is where the GPEs are actually "enabled" */
    311      1.1  christos 
    312      1.1  christos     Status = AcpiUpdateAllGpes ();
    313      1.1  christos     ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
    314      1.1  christos 
    315      1.1  christos     Status = AcpiGetHandle (NULL, "RSRC", &Handle);
    316      1.1  christos     if (ACPI_SUCCESS (Status))
    317      1.1  christos     {
    318      1.1  christos         ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
    319      1.1  christos 
    320      1.1  christos         Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
    321      1.1  christos         if (ACPI_SUCCESS (Status))
    322      1.1  christos         {
    323      1.1  christos             AcpiOsFree (ReturnBuf.Pointer);
    324      1.1  christos         }
    325      1.1  christos     }
    326      1.1  christos 
    327      1.1  christos     /* Test global lock */
    328      1.1  christos 
    329      1.1  christos     Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
    330      1.1  christos     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
    331      1.1  christos 
    332      1.1  christos     Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
    333      1.1  christos     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
    334      1.1  christos 
    335      1.1  christos     Status = AcpiReleaseGlobalLock (LockHandle1);
    336      1.1  christos     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
    337      1.1  christos 
    338      1.1  christos     Status = AcpiReleaseGlobalLock (LockHandle2);
    339      1.1  christos     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
    340      1.1  christos 
    341      1.1  christos     /* Test timer interfaces */
    342      1.1  christos 
    343      1.1  christos     Status = AcpiGetTimerResolution (&Temp);
    344      1.1  christos     ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
    345      1.1  christos 
    346      1.1  christos     Status = AcpiGetTimer (&Temp);
    347      1.1  christos     ACPI_CHECK_OK (AcpiGetTimer, Status);
    348      1.1  christos 
    349      1.1  christos     Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
    350      1.1  christos     ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
    351      1.1  christos 
    352      1.1  christos 
    353      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    354      1.1  christos }
    355      1.1  christos 
    356      1.1  christos 
    357      1.1  christos /******************************************************************************
    358      1.1  christos  *
    359      1.1  christos  * FUNCTION:    AeMutexInterfaces
    360      1.1  christos  *
    361      1.1  christos  * DESCRIPTION: Exercise the AML mutex access interfaces
    362      1.1  christos  *
    363      1.1  christos  *****************************************************************************/
    364      1.1  christos 
    365      1.1  christos static void
    366      1.1  christos AeMutexInterfaces (
    367      1.1  christos     void)
    368      1.1  christos {
    369      1.1  christos     ACPI_STATUS             Status;
    370      1.1  christos     ACPI_HANDLE             MutexHandle;
    371      1.1  christos 
    372      1.1  christos 
    373      1.1  christos     /* Get a handle to an AML mutex */
    374      1.1  christos 
    375      1.1  christos     Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
    376      1.1  christos     if (Status == AE_NOT_FOUND)
    377      1.1  christos     {
    378      1.1  christos         return;
    379      1.1  christos     }
    380      1.1  christos 
    381      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
    382      1.1  christos     if (ACPI_FAILURE (Status))
    383      1.1  christos     {
    384      1.1  christos         return;
    385      1.1  christos     }
    386      1.1  christos 
    387      1.1  christos     /* Acquire the  mutex */
    388      1.1  christos 
    389      1.1  christos     Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
    390      1.1  christos     ACPI_CHECK_OK (AcpiAcquireMutex, Status);
    391      1.1  christos     if (ACPI_FAILURE (Status))
    392      1.1  christos     {
    393      1.1  christos         return;
    394      1.1  christos     }
    395      1.1  christos 
    396      1.1  christos     /* Release mutex with different parameters */
    397      1.1  christos 
    398      1.1  christos     Status = AcpiReleaseMutex (MutexHandle, NULL);
    399      1.1  christos     ACPI_CHECK_OK (AcpiReleaseMutex, Status);
    400      1.1  christos }
    401      1.1  christos 
    402      1.1  christos 
    403      1.1  christos /******************************************************************************
    404      1.1  christos  *
    405      1.1  christos  * FUNCTION:    AeHardwareInterfaces
    406      1.1  christos  *
    407      1.1  christos  * DESCRIPTION: Call various hardware support interfaces
    408      1.1  christos  *
    409      1.1  christos  *****************************************************************************/
    410      1.1  christos 
    411      1.1  christos static void
    412      1.1  christos AeHardwareInterfaces (
    413      1.1  christos     void)
    414      1.1  christos {
    415      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
    416      1.1  christos 
    417      1.1  christos     ACPI_STATUS             Status;
    418      1.1  christos     UINT32                  Value;
    419      1.1  christos 
    420      1.1  christos 
    421      1.1  christos     /* If Hardware Reduced flag is set, we are all done */
    422      1.1  christos 
    423      1.1  christos     if (AcpiGbl_ReducedHardware)
    424      1.1  christos     {
    425      1.1  christos         return;
    426      1.1  christos     }
    427      1.1  christos 
    428      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
    429      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    430      1.1  christos 
    431      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
    432      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    433      1.1  christos 
    434      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
    435      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    436      1.1  christos 
    437      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
    438      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    439      1.1  christos 
    440      1.1  christos 
    441      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
    442      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    443      1.1  christos 
    444      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
    445      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    446      1.1  christos 
    447      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
    448      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    449      1.1  christos 
    450      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
    451      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    452      1.1  christos 
    453      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    454      1.1  christos }
    455      1.1  christos 
    456      1.1  christos 
    457      1.1  christos /******************************************************************************
    458      1.1  christos  *
    459      1.1  christos  * FUNCTION:    AeTestSleepData
    460      1.1  christos  *
    461      1.1  christos  * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
    462      1.1  christos  *
    463      1.1  christos  *****************************************************************************/
    464      1.1  christos 
    465      1.1  christos static void
    466      1.1  christos AeTestSleepData (
    467      1.1  christos     void)
    468      1.1  christos {
    469      1.1  christos     int                     State;
    470      1.1  christos     UINT8                   TypeA;
    471      1.1  christos     UINT8                   TypeB;
    472      1.1  christos     ACPI_STATUS             Status;
    473      1.1  christos 
    474      1.1  christos 
    475      1.1  christos     /* Attempt to get sleep data for all known sleep states */
    476      1.1  christos 
    477      1.1  christos     for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
    478      1.1  christos     {
    479      1.1  christos         Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
    480      1.1  christos 
    481      1.1  christos         /* All sleep methods are optional */
    482      1.1  christos 
    483      1.1  christos         if (Status != AE_NOT_FOUND)
    484      1.1  christos         {
    485      1.1  christos             ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
    486      1.1  christos         }
    487      1.1  christos     }
    488      1.1  christos }
    489