FreeBSD/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiEnterSleepStatePrep
 *
 * PARAMETERS:  SleepState          - Which sleep state to enter
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Prepare to enter a system sleep state.
 *              This function must execute with interrupts enabled.
 *              We break sleeping into 2 stages so that OSPM can handle
 *              various OS-specific tasks between the two steps.
 *
 ******************************************************************************/
AcpiEnterSleepStatePrep
PARAMETERS:  SleepState          - Which sleep state to enter

Status

Prepare to enter a system sleep state.
This function must execute with interrupts enabled.
We break sleeping into 2 stages so that OSPM can handle
various OS-specific tasks between the two steps.
AcpiEnterSleepStatePrep PARAMETERS : SleepState - Which sleep state to enter Status Prepare to enter a system sleep state . This function must execute with interrupts enabled . We break sleeping into 2 stages so that OSPM can handle various OS - specific tasks between the two steps .
ACPI_STATUS
AcpiEnterSleepStatePrep (
    UINT8                   SleepState)
{
    ACPI_STATUS             Status;
    ACPI_OBJECT_LIST        ArgList;
    ACPI_OBJECT             Arg;
    UINT32                  SstValue;
    ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
    Status = AcpiGetSleepTypeData (SleepState,
        &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }
    ArgList.Count = 1;
    ArgList.Pointer = &Arg;
    Arg.Type = ACPI_TYPE_INTEGER;
    Arg.Integer.Value = SleepState;
    Status = AcpiEvaluateObject (NULL, METHOD_PATHNAME__PTS, &ArgList, NULL);
    if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
    {
        return_ACPI_STATUS (Status);
    }
    switch (SleepState)
    {
    case ACPI_STATE_S0:
        SstValue = ACPI_SST_WORKING;
        break;
    case ACPI_STATE_S1:
    case ACPI_STATE_S2:
    case ACPI_STATE_S3:
        SstValue = ACPI_SST_SLEEPING;
        break;
    case ACPI_STATE_S4:
        SstValue = ACPI_SST_SLEEP_CONTEXT;
        break;
    default:
        SstValue = ACPI_SST_INDICATOR_OFF; 
        break;
    }
    AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, SstValue);
    return_ACPI_STATUS (AE_OK);
}
ACPI_STATUS AcpiEnterSleepStatePrep ( UINT8 SleepState ) { ACPI_STATUS Status ; ACPI_OBJECT_LIST ArgList ; ACPI_OBJECT Arg ; UINT32 SstValue ; ACPI_FUNCTION_TRACE ( AcpiEnterSleepStatePrep ) ; Status = AcpiGetSleepTypeData ( SleepState , & AcpiGbl_SleepTypeA , & AcpiGbl_SleepTypeB ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } ArgList . Count = 1 ; ArgList . Pointer = & Arg ; Arg . Type = ACPI_TYPE_INTEGER ; Arg . Integer . Value = SleepState ; Status = AcpiEvaluateObject ( NULL , METHOD_PATHNAME__PTS , & ArgList , NULL ) ; if ( ACPI_FAILURE ( Status ) && Status != AE_NOT_FOUND ) { return_ACPI_STATUS ( Status ) ; } switch ( SleepState ) { case ACPI_STATE_S0 : SstValue = ACPI_SST_WORKING ; break ; case ACPI_STATE_S1 : case ACPI_STATE_S2 : case ACPI_STATE_S3 : SstValue = ACPI_SST_SLEEPING ; break ; case ACPI_STATE_S4 : SstValue = ACPI_SST_SLEEP_CONTEXT ; break ; default : SstValue = ACPI_SST_INDICATOR_OFF ; break ; } AcpiHwExecuteSleepMethod ( METHOD_PATHNAME__SST , SstValue ) ; return_ACPI_STATUS ( AE_OK ) ; }
FUNCTION:    AcpiEnterSleepStatePrep
 PARAMETERS:  SleepState          - Which sleep state to enter
FUNCTION : AcpiEnterSleepStatePrep PARAMETERS : SleepState - Which sleep state to enter
/* Execute the _PTS method (Prepare To Sleep) */ /* Setup the argument to the _SST method (System STatus) */ /* Default is off */ /*
     * Set the system indicators to show the desired sleep state.
     * _SST is an optional method (return no error if not found)
     */