Give up unresponding hardware when entering sleep state.

from FreeBSD's local changes.
This commit is contained in:
kochi 2003-12-21 07:51:18 +00:00
parent d4eea31ad8
commit 2bd0af644b

View File

@ -116,7 +116,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hwsleep.c,v 1.9 2003/12/13 18:11:01 kochi Exp $");
__KERNEL_RCSID(0, "$NetBSD: hwsleep.c,v 1.10 2003/12/21 07:51:18 kochi Exp $");
#include "acpi.h"
@ -299,6 +299,7 @@ AcpiEnterSleepState (
ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo;
ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo;
UINT32 InValue;
UINT32 Retry;
ACPI_STATUS Status;
@ -425,6 +426,7 @@ AcpiEnterSleepState (
/* Wait until we enter sleep state */
Retry = 1000;
do
{
Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
@ -433,6 +435,15 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
/*
* Some BIOSs don't set WAK_STS at all. Give up waiting after
* 1000 retries if it still isn't set.
*/
if (Retry-- == 0)
{
break;
}
/* Spin until we wake */
} while (!InValue);