Home | History | Annotate | Line # | Download | only in acpiexec
aetests.c revision 1.1.1.3
      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.3  christos  * Copyright (C) 2000 - 2019, 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.1.3  christos static void
     64  1.1.1.3  christos AeGlobalAddressRangeCheck(
     65  1.1.1.3  christos     void);
     66  1.1.1.3  christos 
     67      1.1  christos 
     68      1.1  christos /******************************************************************************
     69      1.1  christos  *
     70      1.1  christos  * FUNCTION:    AeMiscellaneousTests
     71      1.1  christos  *
     72      1.1  christos  * DESCRIPTION: Various ACPICA validation tests.
     73      1.1  christos  *
     74      1.1  christos  *****************************************************************************/
     75      1.1  christos 
     76      1.1  christos void
     77      1.1  christos AeMiscellaneousTests (
     78      1.1  christos     void)
     79      1.1  christos {
     80      1.1  christos     ACPI_BUFFER             ReturnBuf;
     81      1.1  christos     char                    Buffer[32];
     82      1.1  christos     ACPI_STATUS             Status;
     83      1.1  christos     ACPI_STATISTICS         Stats;
     84      1.1  christos     ACPI_HANDLE             Handle;
     85      1.1  christos 
     86      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
     87      1.1  christos     UINT32                  Temp;
     88      1.1  christos     UINT32                  LockHandle1;
     89      1.1  christos     UINT32                  LockHandle2;
     90      1.1  christos     ACPI_VENDOR_UUID        Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
     91      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
     92      1.1  christos 
     93      1.1  christos 
     94      1.1  christos     Status = AcpiGetHandle (NULL, "\\", &Handle);
     95      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
     96      1.1  christos 
     97      1.1  christos     if (AcpiGbl_DoInterfaceTests)
     98      1.1  christos     {
     99      1.1  christos         /*
    100      1.1  christos          * Tests for AcpiLoadTable and AcpiUnloadParentTable
    101      1.1  christos          */
    102      1.1  christos 
    103      1.1  christos         /* Attempt unload of DSDT, should fail */
    104      1.1  christos 
    105      1.1  christos         Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
    106      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    107      1.1  christos 
    108      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    109      1.1  christos         ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
    110      1.1  christos 
    111      1.1  christos         /* Load and unload SSDT4 */
    112      1.1  christos 
    113      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
    114      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    115      1.1  christos 
    116      1.1  christos         Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
    117      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    118      1.1  christos 
    119      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    120      1.1  christos         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
    121      1.1  christos 
    122      1.1  christos         /* Re-load SSDT4 */
    123      1.1  christos 
    124      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
    125      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    126      1.1  christos 
    127      1.1  christos         /* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
    128      1.1  christos 
    129      1.1  christos         Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
    130      1.1  christos         ACPI_CHECK_OK (AcpiGetHandle, Status);
    131      1.1  christos 
    132      1.1  christos         Status = AcpiUnloadParentTable (Handle);
    133      1.1  christos         ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
    134      1.1  christos 
    135      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
    136      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    137      1.1  christos 
    138      1.1  christos         /* Load OEM9 table (causes table override) */
    139      1.1  christos 
    140      1.1  christos         Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
    141      1.1  christos         ACPI_CHECK_OK (AcpiLoadTable, Status);
    142      1.1  christos     }
    143      1.1  christos 
    144      1.1  christos     AeHardwareInterfaces ();
    145      1.1  christos     AeGenericRegisters ();
    146      1.1  christos     AeSetupConfiguration (Ssdt3Code);
    147      1.1  christos 
    148      1.1  christos     AeTestBufferArgument();
    149      1.1  christos     AeTestPackageArgument ();
    150      1.1  christos     AeMutexInterfaces ();
    151      1.1  christos     AeTestSleepData ();
    152      1.1  christos 
    153      1.1  christos     /* Test _OSI install/remove */
    154      1.1  christos 
    155      1.1  christos     Status = AcpiInstallInterface ("");
    156      1.1  christos     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
    157      1.1  christos 
    158      1.1  christos     Status = AcpiInstallInterface ("TestString");
    159      1.1  christos     ACPI_CHECK_OK (AcpiInstallInterface, Status);
    160      1.1  christos 
    161      1.1  christos     Status = AcpiInstallInterface ("TestString");
    162      1.1  christos     ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
    163      1.1  christos 
    164      1.1  christos     Status = AcpiRemoveInterface ("Windows 2006");
    165      1.1  christos     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
    166      1.1  christos 
    167      1.1  christos     Status = AcpiRemoveInterface ("TestString");
    168      1.1  christos     ACPI_CHECK_OK (AcpiRemoveInterface, Status);
    169      1.1  christos 
    170      1.1  christos     Status = AcpiRemoveInterface ("XXXXXX");
    171      1.1  christos     ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
    172      1.1  christos 
    173      1.1  christos     Status = AcpiInstallInterface ("AnotherTestString");
    174      1.1  christos     ACPI_CHECK_OK (AcpiInstallInterface, Status);
    175      1.1  christos 
    176      1.1  christos     /* Test _OSI execution */
    177      1.1  christos 
    178      1.1  christos     Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
    179      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    180      1.1  christos 
    181      1.1  christos     Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
    182      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    183      1.1  christos 
    184      1.1  christos     Status = ExecuteOSI ("MichiganTerminalSystem", 0);
    185      1.1  christos     ACPI_CHECK_OK (ExecuteOSI, Status);
    186      1.1  christos 
    187      1.1  christos 
    188      1.1  christos     ReturnBuf.Length = 32;
    189      1.1  christos     ReturnBuf.Pointer = Buffer;
    190      1.1  christos 
    191      1.1  christos     Status = AcpiGetName (ACPI_ROOT_OBJECT,
    192      1.1  christos         ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
    193      1.1  christos     ACPI_CHECK_OK (AcpiGetName, Status);
    194      1.1  christos 
    195      1.1  christos     /* Get Devices */
    196      1.1  christos 
    197      1.1  christos     Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
    198      1.1  christos     ACPI_CHECK_OK (AcpiGetDevices, Status);
    199      1.1  christos 
    200      1.1  christos     Status = AcpiGetStatistics (&Stats);
    201      1.1  christos     ACPI_CHECK_OK (AcpiGetStatistics, Status);
    202      1.1  christos 
    203      1.1  christos 
    204      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
    205      1.1  christos 
    206      1.1  christos     Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
    207      1.1  christos     ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
    208      1.1  christos 
    209      1.1  christos     /* If Hardware Reduced flag is set, we are all done */
    210      1.1  christos 
    211      1.1  christos     if (AcpiGbl_ReducedHardware)
    212      1.1  christos     {
    213      1.1  christos         return;
    214      1.1  christos     }
    215      1.1  christos 
    216      1.1  christos     Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
    217      1.1  christos     ACPI_CHECK_OK (AcpiEnableEvent, Status);
    218      1.1  christos 
    219      1.1  christos     /*
    220      1.1  christos      * GPEs: Handlers, enable/disable, etc.
    221      1.1  christos      */
    222      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0,
    223      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    224      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    225      1.1  christos 
    226      1.1  christos     Status = AcpiEnableGpe (NULL, 0);
    227      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    228      1.1  christos 
    229      1.1  christos     Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
    230      1.1  christos     ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
    231      1.1  christos 
    232      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0,
    233      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    234      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    235      1.1  christos 
    236      1.1  christos     Status = AcpiEnableGpe (NULL, 0);
    237      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    238      1.1  christos 
    239      1.1  christos     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
    240      1.1  christos     ACPI_CHECK_OK (AcpiSetGpe, Status);
    241      1.1  christos 
    242      1.1  christos     Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
    243      1.1  christos     ACPI_CHECK_OK (AcpiSetGpe, Status);
    244      1.1  christos 
    245      1.1  christos 
    246      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 1,
    247      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    248      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    249      1.1  christos 
    250      1.1  christos     Status = AcpiEnableGpe (NULL, 1);
    251      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    252      1.1  christos 
    253      1.1  christos 
    254      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 2,
    255      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    256      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    257      1.1  christos 
    258      1.1  christos     Status = AcpiEnableGpe (NULL, 2);
    259      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    260      1.1  christos 
    261      1.1  christos 
    262      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 3,
    263      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    264      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    265      1.1  christos 
    266      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 4,
    267      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    268      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    269      1.1  christos 
    270      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 5,
    271      1.1  christos         ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
    272      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    273      1.1  christos 
    274      1.1  christos     Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
    275      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
    276      1.1  christos 
    277      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 5);
    278      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    279      1.1  christos 
    280      1.1  christos     Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
    281      1.1  christos     ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
    282      1.1  christos 
    283      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 6);
    284      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    285      1.1  christos 
    286      1.1  christos     Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
    287      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    288      1.1  christos 
    289      1.1  christos     Status = AcpiSetupGpeForWake (Handle, NULL, 9);
    290      1.1  christos     ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
    291      1.1  christos 
    292      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 0x19,
    293      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    294      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    295      1.1  christos 
    296      1.1  christos     Status = AcpiEnableGpe (NULL, 0x19);
    297      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    298      1.1  christos 
    299      1.1  christos 
    300      1.1  christos     /* GPE block 1 */
    301      1.1  christos 
    302      1.1  christos     Status = AcpiInstallGpeHandler (NULL, 101,
    303      1.1  christos         ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
    304      1.1  christos     ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
    305      1.1  christos 
    306      1.1  christos     Status = AcpiEnableGpe (NULL, 101);
    307      1.1  christos     ACPI_CHECK_OK (AcpiEnableGpe, Status);
    308      1.1  christos 
    309      1.1  christos     Status = AcpiDisableGpe (NULL, 101);
    310      1.1  christos     ACPI_CHECK_OK (AcpiDisableGpe, Status);
    311      1.1  christos 
    312      1.1  christos     AfInstallGpeBlock ();
    313      1.1  christos 
    314      1.1  christos     /* Here is where the GPEs are actually "enabled" */
    315      1.1  christos 
    316      1.1  christos     Status = AcpiUpdateAllGpes ();
    317      1.1  christos     ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
    318      1.1  christos 
    319      1.1  christos     Status = AcpiGetHandle (NULL, "RSRC", &Handle);
    320      1.1  christos     if (ACPI_SUCCESS (Status))
    321      1.1  christos     {
    322      1.1  christos         ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
    323      1.1  christos 
    324      1.1  christos         Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
    325      1.1  christos         if (ACPI_SUCCESS (Status))
    326      1.1  christos         {
    327      1.1  christos             AcpiOsFree (ReturnBuf.Pointer);
    328      1.1  christos         }
    329      1.1  christos     }
    330      1.1  christos 
    331      1.1  christos     /* Test global lock */
    332      1.1  christos 
    333      1.1  christos     Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
    334      1.1  christos     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
    335      1.1  christos 
    336      1.1  christos     Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
    337      1.1  christos     ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
    338      1.1  christos 
    339      1.1  christos     Status = AcpiReleaseGlobalLock (LockHandle1);
    340      1.1  christos     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
    341      1.1  christos 
    342      1.1  christos     Status = AcpiReleaseGlobalLock (LockHandle2);
    343      1.1  christos     ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
    344      1.1  christos 
    345      1.1  christos     /* Test timer interfaces */
    346      1.1  christos 
    347      1.1  christos     Status = AcpiGetTimerResolution (&Temp);
    348      1.1  christos     ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
    349      1.1  christos 
    350      1.1  christos     Status = AcpiGetTimer (&Temp);
    351      1.1  christos     ACPI_CHECK_OK (AcpiGetTimer, Status);
    352      1.1  christos 
    353      1.1  christos     Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
    354      1.1  christos     ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
    355      1.1  christos 
    356      1.1  christos 
    357      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    358      1.1  christos }
    359      1.1  christos 
    360      1.1  christos 
    361      1.1  christos /******************************************************************************
    362      1.1  christos  *
    363      1.1  christos  * FUNCTION:    AeMutexInterfaces
    364      1.1  christos  *
    365      1.1  christos  * DESCRIPTION: Exercise the AML mutex access interfaces
    366      1.1  christos  *
    367      1.1  christos  *****************************************************************************/
    368      1.1  christos 
    369      1.1  christos static void
    370      1.1  christos AeMutexInterfaces (
    371      1.1  christos     void)
    372      1.1  christos {
    373      1.1  christos     ACPI_STATUS             Status;
    374      1.1  christos     ACPI_HANDLE             MutexHandle;
    375      1.1  christos 
    376      1.1  christos 
    377      1.1  christos     /* Get a handle to an AML mutex */
    378      1.1  christos 
    379      1.1  christos     Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
    380      1.1  christos     if (Status == AE_NOT_FOUND)
    381      1.1  christos     {
    382      1.1  christos         return;
    383      1.1  christos     }
    384      1.1  christos 
    385      1.1  christos     ACPI_CHECK_OK (AcpiGetHandle, Status);
    386      1.1  christos     if (ACPI_FAILURE (Status))
    387      1.1  christos     {
    388      1.1  christos         return;
    389      1.1  christos     }
    390      1.1  christos 
    391      1.1  christos     /* Acquire the  mutex */
    392      1.1  christos 
    393      1.1  christos     Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
    394      1.1  christos     ACPI_CHECK_OK (AcpiAcquireMutex, Status);
    395      1.1  christos     if (ACPI_FAILURE (Status))
    396      1.1  christos     {
    397      1.1  christos         return;
    398      1.1  christos     }
    399      1.1  christos 
    400      1.1  christos     /* Release mutex with different parameters */
    401      1.1  christos 
    402      1.1  christos     Status = AcpiReleaseMutex (MutexHandle, NULL);
    403      1.1  christos     ACPI_CHECK_OK (AcpiReleaseMutex, Status);
    404      1.1  christos }
    405      1.1  christos 
    406      1.1  christos 
    407      1.1  christos /******************************************************************************
    408      1.1  christos  *
    409      1.1  christos  * FUNCTION:    AeHardwareInterfaces
    410      1.1  christos  *
    411      1.1  christos  * DESCRIPTION: Call various hardware support interfaces
    412      1.1  christos  *
    413      1.1  christos  *****************************************************************************/
    414      1.1  christos 
    415      1.1  christos static void
    416      1.1  christos AeHardwareInterfaces (
    417      1.1  christos     void)
    418      1.1  christos {
    419      1.1  christos #if (!ACPI_REDUCED_HARDWARE)
    420      1.1  christos 
    421      1.1  christos     ACPI_STATUS             Status;
    422      1.1  christos     UINT32                  Value;
    423      1.1  christos 
    424      1.1  christos 
    425      1.1  christos     /* If Hardware Reduced flag is set, we are all done */
    426      1.1  christos 
    427      1.1  christos     if (AcpiGbl_ReducedHardware)
    428      1.1  christos     {
    429      1.1  christos         return;
    430      1.1  christos     }
    431      1.1  christos 
    432      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
    433      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    434      1.1  christos 
    435      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
    436      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    437      1.1  christos 
    438      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
    439      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    440      1.1  christos 
    441      1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
    442      1.1  christos     ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
    443      1.1  christos 
    444      1.1  christos 
    445      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
    446      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    447      1.1  christos 
    448      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
    449      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    450      1.1  christos 
    451      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
    452      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    453      1.1  christos 
    454      1.1  christos     Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
    455      1.1  christos     ACPI_CHECK_OK (AcpiReadBitRegister, Status);
    456      1.1  christos 
    457      1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    458      1.1  christos }
    459      1.1  christos 
    460      1.1  christos 
    461      1.1  christos /******************************************************************************
    462      1.1  christos  *
    463      1.1  christos  * FUNCTION:    AeTestSleepData
    464      1.1  christos  *
    465      1.1  christos  * DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
    466      1.1  christos  *
    467      1.1  christos  *****************************************************************************/
    468      1.1  christos 
    469      1.1  christos static void
    470      1.1  christos AeTestSleepData (
    471      1.1  christos     void)
    472      1.1  christos {
    473      1.1  christos     int                     State;
    474      1.1  christos     UINT8                   TypeA;
    475      1.1  christos     UINT8                   TypeB;
    476      1.1  christos     ACPI_STATUS             Status;
    477      1.1  christos 
    478      1.1  christos 
    479      1.1  christos     /* Attempt to get sleep data for all known sleep states */
    480      1.1  christos 
    481      1.1  christos     for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
    482      1.1  christos     {
    483      1.1  christos         Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
    484      1.1  christos 
    485      1.1  christos         /* All sleep methods are optional */
    486      1.1  christos 
    487      1.1  christos         if (Status != AE_NOT_FOUND)
    488      1.1  christos         {
    489      1.1  christos             ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
    490      1.1  christos         }
    491      1.1  christos     }
    492      1.1  christos }
    493  1.1.1.3  christos 
    494  1.1.1.3  christos 
    495  1.1.1.3  christos /******************************************************************************
    496  1.1.1.3  christos  *
    497  1.1.1.3  christos  * FUNCTION:    AeLateTest
    498  1.1.1.3  christos  *
    499  1.1.1.3  christos  * DESCRIPTION: Exercise tests that should be performed before shutdown.
    500  1.1.1.3  christos  *
    501  1.1.1.3  christos  *****************************************************************************/
    502  1.1.1.3  christos 
    503  1.1.1.3  christos void
    504  1.1.1.3  christos AeLateTest (
    505  1.1.1.3  christos     void)
    506  1.1.1.3  christos {
    507  1.1.1.3  christos     AeGlobalAddressRangeCheck();
    508  1.1.1.3  christos }
    509  1.1.1.3  christos 
    510  1.1.1.3  christos 
    511  1.1.1.3  christos /******************************************************************************
    512  1.1.1.3  christos  *
    513  1.1.1.3  christos  * FUNCTION:    AeGlobalAddressRangeCheck
    514  1.1.1.3  christos  *
    515  1.1.1.3  christos  * DESCRIPTION: There have been some issues in the past with adding and
    516  1.1.1.3  christos  *              removing items to the global address list from
    517  1.1.1.3  christos  *              OperationRegions declared in control methods. This test loops
    518  1.1.1.3  christos  *              over the list to ensure that dangling pointers do not exist in
    519  1.1.1.3  christos  *              the global address list.
    520  1.1.1.3  christos  *
    521  1.1.1.3  christos  *****************************************************************************/
    522  1.1.1.3  christos 
    523  1.1.1.3  christos static void
    524  1.1.1.3  christos AeGlobalAddressRangeCheck(
    525  1.1.1.3  christos     void)
    526  1.1.1.3  christos {
    527  1.1.1.3  christos     ACPI_STATUS             Status;
    528  1.1.1.3  christos     ACPI_ADDRESS_RANGE      *Current;
    529  1.1.1.3  christos     ACPI_BUFFER             ReturnBuffer;
    530  1.1.1.3  christos     UINT32                  i;
    531  1.1.1.3  christos 
    532  1.1.1.3  christos 
    533  1.1.1.3  christos     ReturnBuffer.Length = ACPI_ALLOCATE_BUFFER;
    534  1.1.1.3  christos     AcpiUtInitializeBuffer (&ReturnBuffer, ACPI_ALLOCATE_BUFFER);
    535  1.1.1.3  christos 
    536  1.1.1.3  christos     for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++)
    537  1.1.1.3  christos     {
    538  1.1.1.3  christos         Current = AcpiGbl_AddressRangeList[i];
    539  1.1.1.3  christos 
    540  1.1.1.3  christos         while (Current)
    541  1.1.1.3  christos         {
    542  1.1.1.3  christos             Status = AcpiGetName (Current->RegionNode, ACPI_SINGLE_NAME, &ReturnBuffer);
    543  1.1.1.3  christos             ACPI_CHECK_OK (AcpiGetname, Status);
    544  1.1.1.3  christos 
    545  1.1.1.3  christos             Current = Current->Next;
    546  1.1.1.3  christos         }
    547  1.1.1.3  christos     }
    548  1.1.1.3  christos }
    549