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