From owner-acpi-jp@jp.freebsd.org  Mon Nov  5 23:01:51 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id XAA66737;
	Mon, 5 Nov 2001 23:01:51 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (root@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id XAA66732
	for <acpi-jp@jp.freebsd.org>; Mon, 5 Nov 2001 23:01:49 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (iwasaki.imasy.or.jp [202.227.24.92])
	(authenticated as iwa with CRAM-MD5)
	by tasogare.imasy.or.jp (8.11.6+3.4W/8.11.6/tasogare) with ESMTP/inet id fA5E1lW81634;
	Mon, 5 Nov 2001 23:01:47 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Date: Mon, 05 Nov 2001 23:01:44 +0900 (JST)
Message-Id: <20011105.230144.41626631.iwasaki@jp.FreeBSD.org>
To: acpi-jp@jp.freebsd.org, andrew.grover@intel.com
Cc: jhb@FreeBSD.org, acpi@phobos.fachschaften.tu-muenchen.de
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
In-Reply-To: <59885C5E3098D511AD690002A5072D3C42D6CC@orsmsx111.jf.intel.com>
References: <59885C5E3098D511AD690002A5072D3C42D6CC@orsmsx111.jf.intel.com>
X-Mailer: Mew version 2.0 on Emacs 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1435
Subject: [acpi-jp 1435] Re: Libretto L2
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

Hi, Andrew.

> I made that change on 8/31 with the checkin comment: "fix compiler error".
> This is both incorrect and unhelpful. ;-)
> 
> Soooo....I'll make the change, but it would be great if you could keep
> digging on why this should cause problems, or if someone wants to speak up
> for why I made this change in the first place?

I've noticed that the previous patche is not enough for some machines.
i.e.Some BIOSes don't set WAK_STS bit, so it can be Infinite loop in
S1 sleep case.
In FreeBSD, we have this workaround, I think it would be useful for
Linux people too.

Thanks

Index: hwsleep.c
===================================================================
RCS file: /home/ncvs/src/sys/contrib/dev/acpica/hwsleep.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 hwsleep.c
--- hwsleep.c	4 Oct 2001 23:12:11 -0000	1.1.1.9
+++ hwsleep.c	5 Nov 2001 13:26:46 -0000
@@ -237,6 +237,7 @@
     UINT8               TypeB;
     UINT16              PM1AControl;
     UINT16              PM1BControl;
+    UINT32              Retry;
 
 
     FUNCTION_TRACE ("AcpiEnterSleepState");
@@ -318,9 +319,16 @@
 
     /* wait until we enter sleep state */
 
+    Retry = 1000;
     do 
     {
-        AcpiOsStall(10000);
+        /*
+         * Some BIOSes don't set WAK_STS at all,
+         * give up waiting for wakeup if we time out.
+         */
+         if (Retry-- == 0) {
+             break;             /* giving up */
+         }
     }
     while (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, WAK_STS));
 
