Home | History | Annotate | Line # | Download | only in hardware
hwxfsleep.c revision 1.6
      1  1.1  christos /******************************************************************************
      2  1.1  christos  *
      3  1.1  christos  * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces
      4  1.1  christos  *
      5  1.1  christos  *****************************************************************************/
      6  1.1  christos 
      7  1.1  christos /*
      8  1.6  christos  * Copyright (C) 2000 - 2016, 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 #define EXPORT_ACPI_INTERFACES
     45  1.1  christos 
     46  1.1  christos #include "acpi.h"
     47  1.1  christos #include "accommon.h"
     48  1.1  christos 
     49  1.1  christos #define _COMPONENT          ACPI_HARDWARE
     50  1.1  christos         ACPI_MODULE_NAME    ("hwxfsleep")
     51  1.1  christos 
     52  1.1  christos /* Local prototypes */
     53  1.1  christos 
     54  1.5  christos #if (!ACPI_REDUCED_HARDWARE)
     55  1.5  christos static ACPI_STATUS
     56  1.5  christos AcpiHwSetFirmwareWakingVector (
     57  1.5  christos     ACPI_TABLE_FACS         *Facs,
     58  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
     59  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress64);
     60  1.5  christos #endif
     61  1.5  christos 
     62  1.1  christos static ACPI_STATUS
     63  1.1  christos AcpiHwSleepDispatch (
     64  1.1  christos     UINT8                   SleepState,
     65  1.1  christos     UINT32                  FunctionId);
     66  1.1  christos 
     67  1.1  christos /*
     68  1.1  christos  * Dispatch table used to efficiently branch to the various sleep
     69  1.1  christos  * functions.
     70  1.1  christos  */
     71  1.1  christos #define ACPI_SLEEP_FUNCTION_ID          0
     72  1.1  christos #define ACPI_WAKE_PREP_FUNCTION_ID      1
     73  1.1  christos #define ACPI_WAKE_FUNCTION_ID           2
     74  1.1  christos 
     75  1.1  christos /* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
     76  1.1  christos 
     77  1.1  christos static ACPI_SLEEP_FUNCTIONS         AcpiSleepDispatch[] =
     78  1.1  christos {
     79  1.1  christos     {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacySleep),    AcpiHwExtendedSleep},
     80  1.1  christos     {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep), AcpiHwExtendedWakePrep},
     81  1.1  christos     {ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake),     AcpiHwExtendedWake}
     82  1.1  christos };
     83  1.1  christos 
     84  1.1  christos 
     85  1.1  christos /*
     86  1.1  christos  * These functions are removed for the ACPI_REDUCED_HARDWARE case:
     87  1.1  christos  *      AcpiSetFirmwareWakingVector
     88  1.1  christos  *      AcpiEnterSleepStateS4bios
     89  1.1  christos  */
     90  1.1  christos 
     91  1.1  christos #if (!ACPI_REDUCED_HARDWARE)
     92  1.1  christos /*******************************************************************************
     93  1.1  christos  *
     94  1.5  christos  * FUNCTION:    AcpiHwSetFirmwareWakingVector
     95  1.1  christos  *
     96  1.5  christos  * PARAMETERS:  Facs                - Pointer to FACS table
     97  1.5  christos  *              PhysicalAddress     - 32-bit physical address of ACPI real mode
     98  1.5  christos  *                                    entry point
     99  1.5  christos  *              PhysicalAddress64   - 64-bit physical address of ACPI protected
    100  1.5  christos  *                                    entry point
    101  1.1  christos  *
    102  1.1  christos  * RETURN:      Status
    103  1.1  christos  *
    104  1.5  christos  * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS
    105  1.1  christos  *
    106  1.1  christos  ******************************************************************************/
    107  1.1  christos 
    108  1.5  christos static ACPI_STATUS
    109  1.5  christos AcpiHwSetFirmwareWakingVector (
    110  1.5  christos     ACPI_TABLE_FACS         *Facs,
    111  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
    112  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress64)
    113  1.1  christos {
    114  1.5  christos     ACPI_FUNCTION_TRACE (AcpiHwSetFirmwareWakingVector);
    115  1.1  christos 
    116  1.1  christos 
    117  1.1  christos     /*
    118  1.1  christos      * According to the ACPI specification 2.0c and later, the 64-bit
    119  1.1  christos      * waking vector should be cleared and the 32-bit waking vector should
    120  1.1  christos      * be used, unless we want the wake-up code to be called by the BIOS in
    121  1.1  christos      * Protected Mode. Some systems (for example HP dv5-1004nr) are known
    122  1.1  christos      * to fail to resume if the 64-bit vector is used.
    123  1.1  christos      */
    124  1.1  christos 
    125  1.1  christos     /* Set the 32-bit vector */
    126  1.1  christos 
    127  1.5  christos     Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
    128  1.1  christos 
    129  1.5  christos     if (Facs->Length > 32)
    130  1.5  christos     {
    131  1.5  christos         if (Facs->Version >= 1)
    132  1.5  christos         {
    133  1.5  christos             /* Set the 64-bit vector */
    134  1.5  christos 
    135  1.5  christos             Facs->XFirmwareWakingVector = PhysicalAddress64;
    136  1.5  christos         }
    137  1.5  christos         else
    138  1.5  christos         {
    139  1.5  christos             /* Clear the 64-bit vector if it exists */
    140  1.1  christos 
    141  1.5  christos             Facs->XFirmwareWakingVector = 0;
    142  1.5  christos         }
    143  1.1  christos     }
    144  1.1  christos 
    145  1.1  christos     return_ACPI_STATUS (AE_OK);
    146  1.1  christos }
    147  1.1  christos 
    148  1.1  christos 
    149  1.1  christos /*******************************************************************************
    150  1.1  christos  *
    151  1.5  christos  * FUNCTION:    AcpiSetFirmwareWakingVector
    152  1.1  christos  *
    153  1.5  christos  * PARAMETERS:  PhysicalAddress     - 32-bit physical address of ACPI real mode
    154  1.5  christos  *                                    entry point
    155  1.5  christos  *              PhysicalAddress64   - 64-bit physical address of ACPI protected
    156  1.5  christos  *                                    entry point
    157  1.1  christos  *
    158  1.1  christos  * RETURN:      Status
    159  1.1  christos  *
    160  1.5  christos  * DESCRIPTION: Sets the FirmwareWakingVector fields of the FACS
    161  1.1  christos  *
    162  1.1  christos  ******************************************************************************/
    163  1.1  christos 
    164  1.1  christos ACPI_STATUS
    165  1.5  christos AcpiSetFirmwareWakingVector (
    166  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
    167  1.5  christos     ACPI_PHYSICAL_ADDRESS   PhysicalAddress64)
    168  1.1  christos {
    169  1.1  christos 
    170  1.5  christos     ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
    171  1.1  christos 
    172  1.6  christos     if (AcpiGbl_FACS)
    173  1.5  christos     {
    174  1.6  christos         (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_FACS,
    175  1.6  christos             PhysicalAddress, PhysicalAddress64);
    176  1.5  christos     }
    177  1.1  christos 
    178  1.1  christos     return_ACPI_STATUS (AE_OK);
    179  1.1  christos }
    180  1.1  christos 
    181  1.5  christos ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
    182  1.1  christos 
    183  1.1  christos 
    184  1.1  christos /*******************************************************************************
    185  1.1  christos  *
    186  1.1  christos  * FUNCTION:    AcpiEnterSleepStateS4bios
    187  1.1  christos  *
    188  1.1  christos  * PARAMETERS:  None
    189  1.1  christos  *
    190  1.1  christos  * RETURN:      Status
    191  1.1  christos  *
    192  1.1  christos  * DESCRIPTION: Perform a S4 bios request.
    193  1.1  christos  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
    194  1.1  christos  *
    195  1.1  christos  ******************************************************************************/
    196  1.1  christos 
    197  1.1  christos ACPI_STATUS
    198  1.1  christos AcpiEnterSleepStateS4bios (
    199  1.1  christos     void)
    200  1.1  christos {
    201  1.1  christos     UINT32                  InValue;
    202  1.1  christos     ACPI_STATUS             Status;
    203  1.1  christos 
    204  1.1  christos 
    205  1.1  christos     ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
    206  1.1  christos 
    207  1.1  christos 
    208  1.1  christos     /* Clear the wake status bit (PM1) */
    209  1.1  christos 
    210  1.1  christos     Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
    211  1.1  christos     if (ACPI_FAILURE (Status))
    212  1.1  christos     {
    213  1.1  christos         return_ACPI_STATUS (Status);
    214  1.1  christos     }
    215  1.1  christos 
    216  1.1  christos     Status = AcpiHwClearAcpiStatus ();
    217  1.1  christos     if (ACPI_FAILURE (Status))
    218  1.1  christos     {
    219  1.1  christos         return_ACPI_STATUS (Status);
    220  1.1  christos     }
    221  1.1  christos 
    222  1.1  christos     /*
    223  1.1  christos      * 1) Disable/Clear all GPEs
    224  1.1  christos      * 2) Enable all wakeup GPEs
    225  1.1  christos      */
    226  1.1  christos     Status = AcpiHwDisableAllGpes ();
    227  1.1  christos     if (ACPI_FAILURE (Status))
    228  1.1  christos     {
    229  1.1  christos         return_ACPI_STATUS (Status);
    230  1.1  christos     }
    231  1.1  christos     AcpiGbl_SystemAwakeAndRunning = FALSE;
    232  1.1  christos 
    233  1.1  christos     Status = AcpiHwEnableAllWakeupGpes ();
    234  1.1  christos     if (ACPI_FAILURE (Status))
    235  1.1  christos     {
    236  1.1  christos         return_ACPI_STATUS (Status);
    237  1.1  christos     }
    238  1.1  christos 
    239  1.1  christos     ACPI_FLUSH_CPU_CACHE ();
    240  1.1  christos 
    241  1.1  christos     Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
    242  1.6  christos         (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
    243  1.1  christos 
    244  1.1  christos     do {
    245  1.1  christos         AcpiOsStall (ACPI_USEC_PER_MSEC);
    246  1.1  christos         Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
    247  1.1  christos         if (ACPI_FAILURE (Status))
    248  1.1  christos         {
    249  1.1  christos             return_ACPI_STATUS (Status);
    250  1.1  christos         }
    251  1.6  christos 
    252  1.1  christos     } while (!InValue);
    253  1.1  christos 
    254  1.1  christos     return_ACPI_STATUS (AE_OK);
    255  1.1  christos }
    256  1.1  christos 
    257  1.1  christos ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
    258  1.1  christos 
    259  1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    260  1.1  christos 
    261  1.1  christos 
    262  1.1  christos /*******************************************************************************
    263  1.1  christos  *
    264  1.1  christos  * FUNCTION:    AcpiHwSleepDispatch
    265  1.1  christos  *
    266  1.1  christos  * PARAMETERS:  SleepState          - Which sleep state to enter/exit
    267  1.1  christos  *              FunctionId          - Sleep, WakePrep, or Wake
    268  1.1  christos  *
    269  1.1  christos  * RETURN:      Status from the invoked sleep handling function.
    270  1.1  christos  *
    271  1.1  christos  * DESCRIPTION: Dispatch a sleep/wake request to the appropriate handling
    272  1.1  christos  *              function.
    273  1.1  christos  *
    274  1.1  christos  ******************************************************************************/
    275  1.1  christos 
    276  1.1  christos static ACPI_STATUS
    277  1.1  christos AcpiHwSleepDispatch (
    278  1.1  christos     UINT8                   SleepState,
    279  1.1  christos     UINT32                  FunctionId)
    280  1.1  christos {
    281  1.1  christos     ACPI_STATUS             Status;
    282  1.1  christos     ACPI_SLEEP_FUNCTIONS    *SleepFunctions = &AcpiSleepDispatch[FunctionId];
    283  1.1  christos 
    284  1.1  christos 
    285  1.1  christos #if (!ACPI_REDUCED_HARDWARE)
    286  1.1  christos     /*
    287  1.1  christos      * If the Hardware Reduced flag is set (from the FADT), we must
    288  1.1  christos      * use the extended sleep registers (FADT). Note: As per the ACPI
    289  1.1  christos      * specification, these extended registers are to be used for HW-reduced
    290  1.1  christos      * platforms only. They are not general-purpose replacements for the
    291  1.1  christos      * legacy PM register sleep support.
    292  1.1  christos      */
    293  1.1  christos     if (AcpiGbl_ReducedHardware)
    294  1.1  christos     {
    295  1.1  christos         Status = SleepFunctions->ExtendedFunction (SleepState);
    296  1.1  christos     }
    297  1.1  christos     else
    298  1.1  christos     {
    299  1.1  christos         /* Legacy sleep */
    300  1.1  christos 
    301  1.1  christos         Status = SleepFunctions->LegacyFunction (SleepState);
    302  1.1  christos     }
    303  1.1  christos 
    304  1.1  christos     return (Status);
    305  1.1  christos 
    306  1.1  christos #else
    307  1.1  christos     /*
    308  1.1  christos      * For the case where reduced-hardware-only code is being generated,
    309  1.1  christos      * we know that only the extended sleep registers are available
    310  1.1  christos      */
    311  1.1  christos     Status = SleepFunctions->ExtendedFunction (SleepState);
    312  1.1  christos     return (Status);
    313  1.1  christos 
    314  1.1  christos #endif /* !ACPI_REDUCED_HARDWARE */
    315  1.1  christos }
    316  1.1  christos 
    317  1.1  christos 
    318  1.1  christos /*******************************************************************************
    319  1.1  christos  *
    320  1.1  christos  * FUNCTION:    AcpiEnterSleepStatePrep
    321  1.1  christos  *
    322  1.1  christos  * PARAMETERS:  SleepState          - Which sleep state to enter
    323  1.1  christos  *
    324  1.1  christos  * RETURN:      Status
    325  1.1  christos  *
    326  1.1  christos  * DESCRIPTION: Prepare to enter a system sleep state.
    327  1.1  christos  *              This function must execute with interrupts enabled.
    328  1.1  christos  *              We break sleeping into 2 stages so that OSPM can handle
    329  1.1  christos  *              various OS-specific tasks between the two steps.
    330  1.1  christos  *
    331  1.1  christos  ******************************************************************************/
    332  1.1  christos 
    333  1.1  christos ACPI_STATUS
    334  1.1  christos AcpiEnterSleepStatePrep (
    335  1.1  christos     UINT8                   SleepState)
    336  1.1  christos {
    337  1.1  christos     ACPI_STATUS             Status;
    338  1.1  christos     ACPI_OBJECT_LIST        ArgList;
    339  1.1  christos     ACPI_OBJECT             Arg;
    340  1.1  christos     UINT32                  SstValue;
    341  1.1  christos 
    342  1.1  christos 
    343  1.1  christos     ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
    344  1.1  christos 
    345  1.1  christos 
    346  1.1  christos     Status = AcpiGetSleepTypeData (SleepState,
    347  1.6  christos         &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
    348  1.1  christos     if (ACPI_FAILURE (Status))
    349  1.1  christos     {
    350  1.1  christos         return_ACPI_STATUS (Status);
    351  1.1  christos     }
    352  1.1  christos 
    353  1.1  christos     /* Execute the _PTS method (Prepare To Sleep) */
    354  1.1  christos 
    355  1.1  christos     ArgList.Count = 1;
    356  1.1  christos     ArgList.Pointer = &Arg;
    357  1.1  christos     Arg.Type = ACPI_TYPE_INTEGER;
    358  1.1  christos     Arg.Integer.Value = SleepState;
    359  1.1  christos 
    360  1.1  christos     Status = AcpiEvaluateObject (NULL, METHOD_PATHNAME__PTS, &ArgList, NULL);
    361  1.1  christos     if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
    362  1.1  christos     {
    363  1.1  christos         return_ACPI_STATUS (Status);
    364  1.1  christos     }
    365  1.1  christos 
    366  1.1  christos     /* Setup the argument to the _SST method (System STatus) */
    367  1.1  christos 
    368  1.1  christos     switch (SleepState)
    369  1.1  christos     {
    370  1.1  christos     case ACPI_STATE_S0:
    371  1.1  christos 
    372  1.1  christos         SstValue = ACPI_SST_WORKING;
    373  1.1  christos         break;
    374  1.1  christos 
    375  1.1  christos     case ACPI_STATE_S1:
    376  1.1  christos     case ACPI_STATE_S2:
    377  1.1  christos     case ACPI_STATE_S3:
    378  1.1  christos 
    379  1.1  christos         SstValue = ACPI_SST_SLEEPING;
    380  1.1  christos         break;
    381  1.1  christos 
    382  1.1  christos     case ACPI_STATE_S4:
    383  1.1  christos 
    384  1.1  christos         SstValue = ACPI_SST_SLEEP_CONTEXT;
    385  1.1  christos         break;
    386  1.1  christos 
    387  1.1  christos     default:
    388  1.1  christos 
    389  1.1  christos         SstValue = ACPI_SST_INDICATOR_OFF; /* Default is off */
    390  1.1  christos         break;
    391  1.1  christos     }
    392  1.1  christos 
    393  1.1  christos     /*
    394  1.1  christos      * Set the system indicators to show the desired sleep state.
    395  1.1  christos      * _SST is an optional method (return no error if not found)
    396  1.1  christos      */
    397  1.2  christos     AcpiHwExecuteSleepMethod (__UNCONST(METHOD_PATHNAME__SST), SstValue);
    398  1.1  christos     return_ACPI_STATUS (AE_OK);
    399  1.1  christos }
    400  1.1  christos 
    401  1.1  christos ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
    402  1.1  christos 
    403  1.1  christos 
    404  1.1  christos /*******************************************************************************
    405  1.1  christos  *
    406  1.1  christos  * FUNCTION:    AcpiEnterSleepState
    407  1.1  christos  *
    408  1.1  christos  * PARAMETERS:  SleepState          - Which sleep state to enter
    409  1.1  christos  *
    410  1.1  christos  * RETURN:      Status
    411  1.1  christos  *
    412  1.1  christos  * DESCRIPTION: Enter a system sleep state
    413  1.1  christos  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
    414  1.1  christos  *
    415  1.1  christos  ******************************************************************************/
    416  1.1  christos 
    417  1.1  christos ACPI_STATUS
    418  1.1  christos AcpiEnterSleepState (
    419  1.1  christos     UINT8                   SleepState)
    420  1.1  christos {
    421  1.1  christos     ACPI_STATUS             Status;
    422  1.1  christos 
    423  1.1  christos 
    424  1.1  christos     ACPI_FUNCTION_TRACE (AcpiEnterSleepState);
    425  1.1  christos 
    426  1.1  christos 
    427  1.1  christos     if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
    428  1.1  christos         (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
    429  1.1  christos     {
    430  1.1  christos         ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X",
    431  1.1  christos             AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
    432  1.1  christos         return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
    433  1.1  christos     }
    434  1.1  christos 
    435  1.1  christos     Status = AcpiHwSleepDispatch (SleepState, ACPI_SLEEP_FUNCTION_ID);
    436  1.1  christos     return_ACPI_STATUS (Status);
    437  1.1  christos }
    438  1.1  christos 
    439  1.1  christos ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
    440  1.1  christos 
    441  1.1  christos 
    442  1.1  christos /*******************************************************************************
    443  1.1  christos  *
    444  1.1  christos  * FUNCTION:    AcpiLeaveSleepStatePrep
    445  1.1  christos  *
    446  1.1  christos  * PARAMETERS:  SleepState          - Which sleep state we are exiting
    447  1.1  christos  *
    448  1.1  christos  * RETURN:      Status
    449  1.1  christos  *
    450  1.1  christos  * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
    451  1.1  christos  *              sleep. Called with interrupts DISABLED.
    452  1.1  christos  *              We break wake/resume into 2 stages so that OSPM can handle
    453  1.1  christos  *              various OS-specific tasks between the two steps.
    454  1.1  christos  *
    455  1.1  christos  ******************************************************************************/
    456  1.1  christos 
    457  1.1  christos ACPI_STATUS
    458  1.1  christos AcpiLeaveSleepStatePrep (
    459  1.1  christos     UINT8                   SleepState)
    460  1.1  christos {
    461  1.1  christos     ACPI_STATUS             Status;
    462  1.1  christos 
    463  1.1  christos 
    464  1.1  christos     ACPI_FUNCTION_TRACE (AcpiLeaveSleepStatePrep);
    465  1.1  christos 
    466  1.1  christos 
    467  1.1  christos     Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_PREP_FUNCTION_ID);
    468  1.1  christos     return_ACPI_STATUS (Status);
    469  1.1  christos }
    470  1.1  christos 
    471  1.1  christos ACPI_EXPORT_SYMBOL (AcpiLeaveSleepStatePrep)
    472  1.1  christos 
    473  1.1  christos 
    474  1.1  christos /*******************************************************************************
    475  1.1  christos  *
    476  1.1  christos  * FUNCTION:    AcpiLeaveSleepState
    477  1.1  christos  *
    478  1.1  christos  * PARAMETERS:  SleepState          - Which sleep state we are exiting
    479  1.1  christos  *
    480  1.1  christos  * RETURN:      Status
    481  1.1  christos  *
    482  1.1  christos  * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
    483  1.1  christos  *              Called with interrupts ENABLED.
    484  1.1  christos  *
    485  1.1  christos  ******************************************************************************/
    486  1.1  christos 
    487  1.1  christos ACPI_STATUS
    488  1.1  christos AcpiLeaveSleepState (
    489  1.1  christos     UINT8                   SleepState)
    490  1.1  christos {
    491  1.1  christos     ACPI_STATUS             Status;
    492  1.1  christos 
    493  1.1  christos 
    494  1.1  christos     ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
    495  1.1  christos 
    496  1.1  christos 
    497  1.1  christos     Status = AcpiHwSleepDispatch (SleepState, ACPI_WAKE_FUNCTION_ID);
    498  1.1  christos     return_ACPI_STATUS (Status);
    499  1.1  christos }
    500  1.1  christos 
    501  1.1  christos ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState)
    502