From 2bd0af644b5c13f192fd5136a2417587de97b60c Mon Sep 17 00:00:00 2001 From: kochi Date: Sun, 21 Dec 2003 07:51:18 +0000 Subject: Give up unresponding hardware when entering sleep state. from FreeBSD's local changes. --- sys/dev/acpi/acpica/Subsystem/hwsleep.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/dev') diff --git a/sys/dev/acpi/acpica/Subsystem/hwsleep.c b/sys/dev/acpi/acpica/Subsystem/hwsleep.c index 2dd9f564a2e..08a9420888f 100644 --- a/sys/dev/acpi/acpica/Subsystem/hwsleep.c +++ b/sys/dev/acpi/acpica/Subsystem/hwsleep.c @@ -116,7 +116,7 @@ *****************************************************************************/ #include -__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); -- cgit