FreeBSD/sys/contrib/dev/acpica/components/hardware/hwsleep.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiHwLegacyWake
 *
 * PARAMETERS:  SleepState          - Which sleep state we just exited
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
 *              Called with interrupts ENABLED.
 *
 ******************************************************************************/
AcpiHwLegacyWake
PARAMETERS:  SleepState          - Which sleep state we just exited

Status

Perform OS-independent ACPI cleanup after a sleep
Called with interrupts ENABLED.
AcpiHwLegacyWake PARAMETERS : SleepState - Which sleep state we just exited Status Perform OS - independent ACPI cleanup after a sleep Called with interrupts ENABLED .
ACPI_STATUS
AcpiHwLegacyWake (
    UINT8                   SleepState)
{
    ACPI_STATUS             Status;
    ACPI_FUNCTION_TRACE (HwLegacyWake);
    AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID;
    AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WAKING);
    Status = AcpiHwDisableAllGpes ();
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }
    Status = AcpiHwEnableAllRuntimeGpes ();
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }
    AcpiHwExecuteSleepMethod (METHOD_PATHNAME__WAK, SleepState);
    (void) AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS,
        ACPI_CLEAR_STATUS);
    AcpiGbl_SystemAwakeAndRunning = TRUE;
    (void) AcpiWriteBitRegister(
            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
            ACPI_ENABLE_EVENT);
    (void) AcpiWriteBitRegister(
            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
            ACPI_CLEAR_STATUS);
    AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
    return_ACPI_STATUS (Status);
}
ACPI_STATUS AcpiHwLegacyWake ( UINT8 SleepState ) { ACPI_STATUS Status ; ACPI_FUNCTION_TRACE ( HwLegacyWake ) ; AcpiGbl_SleepTypeA = ACPI_SLEEP_TYPE_INVALID ; AcpiHwExecuteSleepMethod ( METHOD_PATHNAME__SST , ACPI_SST_WAKING ) ; Status = AcpiHwDisableAllGpes ( ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } Status = AcpiHwEnableAllRuntimeGpes ( ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } AcpiHwExecuteSleepMethod ( METHOD_PATHNAME__WAK , SleepState ) ; ( void ) AcpiWriteBitRegister ( ACPI_BITREG_WAKE_STATUS , ACPI_CLEAR_STATUS ) ; AcpiGbl_SystemAwakeAndRunning = TRUE ; ( void ) AcpiWriteBitRegister ( AcpiGbl_FixedEventInfo [ ACPI_EVENT_POWER_BUTTON ] . EnableRegisterId , ACPI_ENABLE_EVENT ) ; ( void ) AcpiWriteBitRegister ( AcpiGbl_FixedEventInfo [ ACPI_EVENT_POWER_BUTTON ] . StatusRegisterId , ACPI_CLEAR_STATUS ) ; AcpiHwExecuteSleepMethod ( METHOD_PATHNAME__SST , ACPI_SST_WORKING ) ; return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiHwLegacyWake
 PARAMETERS:  SleepState          - Which sleep state we just exited
FUNCTION : AcpiHwLegacyWake PARAMETERS : SleepState - Which sleep state we just exited
/* Ensure EnterSleepStatePrep -> EnterSleepState ordering */ /*
     * GPEs must be enabled before _WAK is called as GPEs
     * might get fired there
     *
     * Restore the GPEs:
     * 1) Disable/Clear all GPEs
     * 2) Enable all runtime GPEs
     */ /*
     * Now we can execute _WAK, etc. Some machines require that the GPEs
     * are enabled before the wake methods are executed.
     */ /*
     * Some BIOS code assumes that WAK_STS will be cleared on resume
     * and use it to determine whether the system is rebooting or
     * resuming. Clear WAK_STS for compatibility.
     */ /* Enable power button */