From owner-acpi-jp@jp.freebsd.org  Tue Jan  2 19:17:27 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id TAA93739;
	Tue, 2 Jan 2001 19:17:27 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from freya.yggdrasil.com (freya.yggdrasil.com [209.249.10.20])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id TAA93734
	for <acpi-jp@jp.freebsd.org>; Tue, 2 Jan 2001 19:17:26 +0900 (JST)
	(envelope-from adam@yggdrasil.com)
Received: from baldur.yggdrasil.com (baldur.yggdrasil.com [209.249.10.12])
	by freya.yggdrasil.com (8.9.3/8.9.3) with ESMTP id CAA03582;
	Tue, 2 Jan 2001 02:13:41 -0800
Received: (from adam@localhost)
	by baldur.yggdrasil.com (8.9.3/8.9.3) id CAA03472;
	Tue, 2 Jan 2001 02:13:41 -0800
Date: Tue, 2 Jan 2001 02:13:41 -0800
From: "Adam J. Richter" <adam@yggdrasil.com>
To: takawata@shidahara1.planet.sci.kobe-u.ac.jp
Cc: peter@netplex.com.au, msmith@freebsd.org, acpi-jp@jp.freebsd.org,
        fudge_factor@hotmail.com, acme@conectiva.com.br,
        acpi@phobos.fachschaften.tu-muenchen.de
Message-ID: <20010102021341.A3451@baldur.yggdrasil.com>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD"
Content-Disposition: inline
User-Agent: Mutt/1.2i
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 1015
Subject: [acpi-jp 1015] Patch(?): Peter Wemm's Sony Vaio ACPI fix simplified and adapted to linux-2.4.0-prerelease
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: adam@yggdrasil.com


--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


	Many thanks to Peter Wemm for fixing the ACPI hangs that
occurred on some Sony Vaio computers and to Takanori Watanabe for
his help and forwarding Peter's patch to me.

	I have simplified Peter Wemm's patch so that it does
not need a new variable, a switch statement or a new goto target,
and I have made the change to linux-2.4.0-prerelease and verified
that it makes acpi work again on my Sony PictureBook PCG-1VN
(the Transmeta version), at least to the extent that it does not
hang at initialization and it shuts down the power when requested.

	I think that Peter's debugging print message changes are
not related to the Linux version, so the *BSD crowd should probably
still apply those separately.  As for the changes that are reflected
in this Linux patch, I recommend that *BSD people consider applying
an adaptation of these changes to the *BSD sources, as they are
substantially simpler.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="acpi.diffs"

--- linux-2.4.0-prerelease/drivers/acpi/interpreter/amfldio.c	Fri Dec 29 14:07:21 2000
+++ linux/drivers/acpi/interpreter/amfldio.c	Tue Jan  2 02:00:04 2001
@@ -391,9 +391,6 @@
 
 	merged_value = field_value;
 
-	/* Check if update rule needs to be applied (not if mask is all ones) */
-
-
 	/* Decode the update rule */
 
 	switch (obj_desc->field.update_rule)
@@ -402,12 +399,19 @@
 	case UPDATE_PRESERVE:
 
 		/*
-		 * Read the current contents of the byte/word/dword containing
-		 * the field, and merge with the new field value.
+	  	 * Check if update rule needs to be applied (not if mask
+		 * is all ones).  If so, read the current contents of
+		 * the byte/word/dword containing the field, and merge
+		 * with the new field value.
 		 */
-		status = acpi_aml_read_field_data (obj_desc, this_field_byte_offset,
+
+
+		if (((1UL << bit_granularity)-1) & ~mask) {
+			status = acpi_aml_read_field_data (obj_desc,
+				   this_field_byte_offset,
 				   bit_granularity, &current_value);
-		merged_value |= (current_value & ~mask);
+			merged_value |= (current_value & ~mask);
+		}
 		break;
 
 

--HlL+5n6rz5pIUxbD--
