From owner-acpi-jp@jp.freebsd.org  Sat Oct  7 20:53:05 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id UAA14028;
	Sat, 7 Oct 2000 20:53:05 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (shidahara1.planet.sci.kobe-u.ac.jp [133.30.50.200])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id UAA14023
	for <acpi-jp@jp.freebsd.org>; Sat, 7 Oct 2000 20:53:04 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Received: from shidahara1.planet.sci.kobe-u.ac.jp (localhost [127.0.0.1])
	by shidahara1.planet.sci.kobe-u.ac.jp (8.9.3/8.9.3) with ESMTP id UAA57059
	for <acpi-jp@jp.freebsd.org>; Sat, 7 Oct 2000 20:51:24 +0900 (JST)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Message-Id: <200010071151.UAA57059@shidahara1.planet.sci.kobe-u.ac.jp>
To: acpi-jp@jp.freebsd.org
In-reply-to: Your message of "Sat, 07 Oct 2000 12:18:32 JST."
             <200010070318.MAA55793@shidahara1.planet.sci.kobe-u.ac.jp>
Date: Sat, 07 Oct 2000 20:51:24 +0900
From: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 819
Subject: [acpi-jp 819] Re: acpica-bsd-20001005 megapatch up
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: takawata@shidahara1.planet.sci.kobe-u.ac.jp

In message <200010070318.MAA55793@shidahara1.planet.sci.kobe-u.ac.jp>, Takanori
 Watanabe $B$5$s$$$o$/(B:
>I have some fix for this.
>In machine ,the polling loop is time out.
>And sometimes, it drops query. 
>I fixed these problem. With this fix,this laptop supports AC-adapter
> attaching and detaching as I mentioned before. Cool! 


I found fatal bug in the patch 

>
>--- dev/acpica/acpi_ec.c	Thu Oct  5 20:01:35 2000
>+++ /home/takawata/src/sys/dev/acpica/acpi_ec.c	Sat Oct  7 12:00:26 200
>0
>@@ -371,31 +371,38 @@
> 
>     /*
>      * Check EC_SCI.
>-     *
>-     * Make sure this is a 'real' EC SCI by checking the EC_SCI bit of the
>-     * status register.  Note that this function should only be called when
>+     * 
>+     * Loop while the EC_SCI bit of the status register is set.
>+     * Note that this function should only be called when
>      * this bit is set (polling is used to detect IBE/OBF events).
>      */
>-    EcStatus = EC_GET_CSR(sc);
>-    if (EcStatus & EC_EVENT_SCI) {
>+    
>+    while ( EC_GET_CSR(sc) & EC_EVENT_SCI) {
> 	Status = EcQuery(sc, &Data);
>-    } else {
>-	Status = AE_ERROR;
>-    }
> 
>+	/*
>+	 * Signal the semaphore to indicate transaction completion.
>+	 */
>+	AcpiOsSignalSemaphore(sc->ec_semaphore, 1);
>+
>+	/*
>+	 * Evaluate _Qxx if appropriate.
>+	 */
>+	if (Status == AE_OK) {
>+	    sprintf(qxx, "_Q%02x", Data);
>+	    strupr(qxx);
>+	    AcpiEvaluateObject(sc->ec_handle, qxx, NULL, NULL);
>+	}
HERE!. This code is needed after this.
	else {
		return;
	}


Or hangs when It fails to query.

Takanori Watanabe
<a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html">
Public Key</a>
Key fingerprint =  2C 51 E2 78 2C E1 C5 2D  0F F1 20 A3 11 3A 62 2A 

