Misc fixes. Use _SST method; clear wake status only if SleepState is

not s5.  Also fixed some comments.


date	2003.12.02.19.17.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:57:58 +00:00
parent 15ae15968c
commit 3cc550bfc0

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 1.55 $
* $Revision: 1.57 $
*
*****************************************************************************/
@ -262,6 +262,14 @@ AcpiEnterSleepStatePrep (
return_ACPI_STATUS (Status);
}
/* Set the system indicators to show the desired sleep state. */
Status = AcpiEvaluateObject (NULL, "\\_SI._SST", &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
}
return_ACPI_STATUS (AE_OK);
}
@ -302,19 +310,21 @@ AcpiEnterSleepState (
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A);
SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
/* Clear wake status */
Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
if (SleepState != ACPI_STATE_S5)
{
return_ACPI_STATUS (Status);
/* Clear wake status */
Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
Status = AcpiHwClearAcpiStatus();
Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -388,12 +398,14 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
/*
* Wait a second, then try again. This is to get S4/5 to work on all machines.
*/
if (SleepState > ACPI_STATE_S3)
{
/*
* We wanted to sleep > S3, but it didn't happen (by virtue of the fact that
* we are still executing!)
*
* Wait ten seconds, then try again. This is to get S4/S5 to work on all machines.
*
* We wait so long to allow chipsets that poll this reg very slowly to
* still read the right value. Ideally, this entire block would go
* away entirely.
@ -449,8 +461,9 @@ AcpiEnterSleepStateS4bios (
ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios");
AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
AcpiHwClearAcpiStatus();
AcpiHwClearAcpiStatus(ACPI_MTX_DO_NOT_LOCK);
AcpiHwDisableNonWakeupGpes();
@ -503,12 +516,18 @@ AcpiLeaveSleepState (
ArgList.Count = 1;
ArgList.Pointer = &Arg;
Arg.Type = ACPI_TYPE_INTEGER;
Arg.Integer.Value = SleepState;
/* Ignore any errors from these methods */
Arg.Integer.Value = 0;
Status = AcpiEvaluateObject (NULL, "\\_SI._SST", &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
}
Arg.Integer.Value = SleepState;
Status = AcpiEvaluateObject (NULL, "\\_BFS", &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
@ -529,7 +548,8 @@ AcpiLeaveSleepState (
return_ACPI_STATUS (Status);
}
/* Disable BM arbitration */
/* Enable BM arbitration */
Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
return_ACPI_STATUS (Status);