From owner-acpi-jp@jp.freebsd.org  Tue Dec 12 18:11:58 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id SAA63632;
	Tue, 12 Dec 2000 18:11:58 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (daemon@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id SAA63627
	for <acpi-jp@jp.freebsd.org>; Tue, 12 Dec 2000 18:11:56 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (iwasaki.imasy.or.jp [202.227.24.92])
	by tasogare.imasy.or.jp (8.11.1+3.4W/3.7W-tasogare/smtpfeed 1.07) with ESMTP id eBC9Brk96966;
	Tue, 12 Dec 2000 18:11:54 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
To: andrew.grover@intel.com
Cc: acpi-jp@jp.freebsd.org
In-Reply-To: <4148FEAAD879D311AC5700A0C969E8905DE3A0@orsmsx35.jf.intel.com>
References: <4148FEAAD879D311AC5700A0C969E8905DE3A0@orsmsx35.jf.intel.com>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20001212181152T.iwasaki@jp.FreeBSD.org>
Date: Tue, 12 Dec 2000 18:11:52 +0900
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
X-Dispatcher: imput version 20000228(IM140)
Lines: 67
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 959
Subject: [acpi-jp 959] patch for "naturally aligned accesses" for AnyAcc
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

Hi, Andrew.  Do you still remember this?

I've made the patch for "naturally aligned accesses" for AnyAcc of
Field objects.  Please review this.

From: "Grover, Andrew" <andrew.grover@intel.com>
Subject: RE: ACPICA workaround? (Re: [acpi-jp 777] Re: ACPI megapatch )
Date: Thu, 5 Oct 2000 09:39:32 -0700 
Message-ID: <4148FEAAD879D311AC5700A0C969E8905DE3A0@orsmsx35.jf.intel.com>

> Hello Iwasaki-san,
> 
> Acpi 2.0 section 16.2.3.3.1.11 seems to say that on AnyAcc we should be
> doing "naturally aligned accesses". This makes me think that fixing this
> wouldn't be a workaround, it would be a bug fix.
> 
> While I'll try to get this fixed, a patch would certainly speed things.
> 
> ;-)
> 
> Regards -- Andy

I've tested this on my TOSHIBA PORTEGE, it seems OK on the Field access.
But this didn't solve my problem; the system hang up after wakeup from S1.
I'll look into this more...

Index: amprep.c
===================================================================
RCS file: /home/ncvs/src/sys/contrib/dev/acpica/Subsystem/Interpreter/amprep.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 amprep.c
--- amprep.c	2000/12/08 09:20:39	1.1.1.3
+++ amprep.c	2000/12/09 05:55:31
@@ -142,13 +142,21 @@
 
 static UINT32
 AcpiAmlDecodeFieldAccessType (
-    UINT32                  Access)
+    UINT32                  Access,
+    UINT16                  Length)
 {
 
     switch (Access)
     {
     case ACCESS_ANY_ACC:
-        return (8);
+        if (Length <= 8)
+            return (8);
+        else if (Length <= 16)
+            return (16);
+        else if (Length <= 32)
+            return (32);
+        else
+            return (8);
         break;
 
     case ACCESS_BYTE_ACC:
@@ -229,7 +237,7 @@
 
     /* Decode the access type so we can compute offsets */
 
-    Granularity = AcpiAmlDecodeFieldAccessType (ObjDesc->Field.Access);
+    Granularity = AcpiAmlDecodeFieldAccessType (ObjDesc->Field.Access, ObjDesc->Field.Length);
     if (!Granularity)
     {
         return_ACPI_STATUS (AE_AML_OPERAND_VALUE);

