From owner-acpi-jp@jp.FreeBSD.org Wed Dec 19 22:46:40 2001
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id fBJDkei26107;
	Wed, 19 Dec 2001 22:46:40 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from black.hc.dnsalias.com (i217036.ppp.asahi-net.or.jp [61.125.217.36])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id fBJDkeH26102
	for <acpi-jp@jp.freebsd.org>; Wed, 19 Dec 2001 22:46:40 +0900 (JST)
	(envelope-from hkimu-tky@umin.ac.jp)
Received: from localhost (localhost [127.0.0.1])
	by black.hc.dnsalias.com (Postfix) with ESMTP id E7FCABF95
	for <acpi-jp@jp.freebsd.org>; Wed, 19 Dec 2001 22:46:32 +0900 (JST)
Received: from localhost (duaron.hc.dnsalias.com [192.168.1.4])
	by black.hc.dnsalias.com (Postfix) with ESMTP id D98DFBF7E
	for <acpi-jp@jp.freebsd.org>; Wed, 19 Dec 2001 22:46:12 +0900 (JST)
Date: Wed, 19 Dec 2001 22:46:07 +0900 (JST)
Message-Id: <20011219.224607.85387193.hkimu-tky@umin.ac.jp>
To: acpi-jp@jp.FreeBSD.org
From: KIM Hyeong Cheol <hkimu-tky@umin.ac.jp>
X-Mailer: Mew version 2.1.52 on Emacs 21.1 / Mule 5.0 (SAKAKI)
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+011218
X-Sequence: acpi-jp 1549
Subject: [acpi-jp 1549] Problem with Thinkpad s30.
Errors-To: owner-acpi-jp@jp.FreeBSD.org
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: hkimu-tky@umin.ac.jp

Hi.

I own an IBM Thinkpad s30 (B5 size notebook, with PIII-600MHZ,
440MX chipset. This model seems to be shipped only in Japan),
and tested ACPI of 5.0-CURRENT kernel on this machine.
TPs30 supports _S1_, _S3_ and _S4_ object, but S4bios
is not supported.

(You can get asl file and dsdt file of this machine from
http://www.jp.freebsd.org/cgi/cvsweb.cgi/ACPI/data/?cvsroot=freebsd-jp
under the names of tpis30.(asl|dsdt).)

First, I applied a patch, written by Iwasaki-san,
to fix some bugs on DSDT. (Without this patch, the kernel
causes a panic at boot with AE_AML_NAME_NOT_FOUND.)

-----
--- s30.asl	2001/12/12 16:22:17	1.1
+++ s30.asl	2001/12/12 16:26:25	1.2
@@ -468,11 +468,11 @@
             Return(0xf)
         }
         Method(_INI) {
-            BreakPoint
+            // BreakPoint
             Store("=============================================", Debug)
             Store("==================================== PCI _INI", Debug)
             Store("=============================================", Debug)
             Store(0x0, \_SB_.BAT1.ACCH)
             If(LEqual(\_SB_.SCMP(\_OS_, "Microsoft WindowsME: Millennium Edition"), Zero)) {
                 Store(0x1, \_SB_.BAT1.BCMP)
                 Store(0x1, \_SB_.OSTY)
@@ -877,7 +881,7 @@
                 Release(PSMX)
                 Return(Local0)
             }
-            Scope(_SB_) {
+            Scope(\_SB_) {
                 Name(OKEC, 0x0)
                 Name(Q20F, 0x1)
             }
-----
With this patch applied, ACPI enabled kernel became to be able to
boot up, and successfully go to / resume from S1 state,
but I couldn't get any informations on AC Line / Battery status.

So I took a look at dsdt file, and found that some methods, especially
those related to AC Line / Battery status, work differently depending
on the running OS.
Under Windows*, \_SB_.HCT_ is set to 0. Otherwise, it is set to 1.
And there are many methods that have

If(\SB_.HCT_){
}
Else{
}

routines.
So I wrote a patch to set \_SB_.HCT_ to 0 under FreeBSD,
and it made it possible to get AC Line / Battery Status.
(Simply deleting "Store(0x1, HCT_)" line should work too.)

------
--- s30.asl.orig	Fri Dec 14 17:10:24 2001
+++ s30.asl	Mon Dec 17 01:02:59 2001
@@ -330,10 +330,15 @@
                 If(LEqual(SCMP(\_OS_, "Microsoft WindowsME: Millennium Edition"), Zero)) {
                     Store(0x0, MYOS)
                 }
-                Else {
-                    Store(0x0, MYOS)
-                    Store(0x1, HCT_)
-                }
+		Else {
+		    If(LEqual(SCMP(\_OS_, "FreeBSD"), Zero)) {
+	    		Store(0x0, MYOS)
+		    }
+	            Else {
+        	        Store(0x0, MYOS)
+                	Store(0x1, HCT_)
+               	    }
+		}
             }
         }
     }
----

Now, I have a problem in resuming from S3 state.
When I set hw.acpi.sleep_button_state to S3 and push Sleep Button,
the machine seems to go to S3 state successfully, but it will never
wake up. When I push the power button, harddrive and CPU FAN start to rotate,
but the machine freezes there.

So I checked the value of *AcpiGbl_FACS->FirmwareWakingVector after the
call of AcpiSetFirmwareWakingVector() (in sys/i386/acpica/acpi_machdep.c:
acpi_sleep_machdep()). The value was 0x1000, and dd if=/dev/mem | hexdump
shows that acpi_wakecode.bin is correctly written to that place.

Any idea what to try next?
