From owner-acpi-jp@jp.freebsd.org  Sun Jan 30 03:06:03 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id DAA70049;
	Sun, 30 Jan 2000 03:06:03 +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 DAA70044
	for <acpi-jp@jp.freebsd.org>; Sun, 30 Jan 2000 03:06:03 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (isdn42.imasy.or.jp [202.227.24.234])
	by tasogare.imasy.or.jp (8.9.3+3.2W/3.7W-tasogare/smtpfeed 1.01) with ESMTP id DAA24243
	for <acpi-jp@jp.freebsd.org>; Sun, 30 Jan 2000 03:05:59 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Message-Id: <200001291805.DAA24243@tasogare.imasy.or.jp>
To: acpi-jp@jp.freebsd.org
In-Reply-To: Your message of "Sat, 29 Jan 2000 00:10:25 +0900"
	<200001281510.AAA01502@libr.scitec.kobe-u.ac.jp>
References: <200001281510.AAA01502@libr.scitec.kobe-u.ac.jp>
X-Mailer: Mew version 1.93 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Date: Sun, 30 Jan 2000 03:05:58 +0900
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
X-Dispatcher: imput version 980905(IM100)
Lines: 170
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+990727
X-Sequence: acpi-jp 256
Subject: [acpi-jp 256] Re: AML interpreter porting 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

> $B;d$b!"$"$s$^$j$$$B$C$F$^$;$s$,!"(B1/14$BF|$N(BCURRENT$B$K(BACPI$B%Q%C%AFM$C9~$s$@(B
> $B>e(BESS Solo$B$rG'<1$5$;$k$h$&$K$7$?J*$O$"$j$^$9!#(B
> $B!t$G$b%Q%C%A$H$7$F$O$^$@:n$C$F$^$;$s(B.....

$B@h$[$I(B PORTEGE 3110CT $BMQ$NAH$_9~$_(B _PTS, _WAK $B$r:G=*HG$H$7$F(B
commit $B$7$?$D$$$G$K!":#F|;~E@$N(B -CURRENT $B$+$i$N(B ACPI $B%Q%C%A$r(B
$B:n$C$F$_$?$N$GE:IU$7$^$9!#(B
files.i386 $B$H(B options.i386 $B$N0LCV$,JQ$C$?!"(Bcontroller -> device
$B$0$i$$$,JQ99E@$G$7$g$&$+!#(B
$B$"$H!"(Bsys/i386/include/pc/acpi.h $B$N(B #ifdef KERNEL -> #ifdef _KERNEL
$B$K5$$r$D$1$l$P$H$j$"$($:Bg>fIW$G$7$g$&!#(B

Index: conf/files.i386
===================================================================
RCS file: /home/ncvs/src/sys/conf/files.i386,v
retrieving revision 1.302
diff -u -r1.302 files.i386
--- conf/files.i386	2000/01/25 22:25:52	1.302
+++ conf/files.i386	2000/01/29 14:42:55
@@ -135,6 +135,7 @@
 gnu/i386/isa/dgb.c		optional	dgb
 gnu/i386/isa/dgm.c		optional	dgm
 gnu/i386/isa/sound/awe_wave.c	optional	awe
+i386/acpi/acpi.c		optional	acpi
 i386/apm/apm.c			optional	apm
 i386/i386/atomic.c		standard				\
 	compile-with	"${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}"
Index: conf/options.i386
===================================================================
RCS file: /home/ncvs/src/sys/conf/options.i386,v
retrieving revision 1.132
diff -u -r1.132 options.i386
--- conf/options.i386	2000/01/14 00:17:49	1.132
+++ conf/options.i386	2000/01/29 14:42:55
@@ -197,5 +197,9 @@
 PNPBIOS			opt_pnp.h
 
 # -------------------------------
+# ACPI Debug options
+# -------------------------------
+ACPI_DEBUG		opt_acpi.h
+# -------------------------------
 # EOF
 # -------------------------------
Index: i386/conf/LINT
===================================================================
RCS file: /home/ncvs/src/sys/i386/conf/LINT,v
retrieving revision 1.737
diff -u -r1.737 LINT
--- i386/conf/LINT	2000/01/27 19:28:15	1.737
+++ i386/conf/LINT	2000/01/29 14:42:55
@@ -1050,6 +1050,9 @@
 # Flag 0x08 automatically disables the i586 optimized routines.
 #
 
+#ACPI Experimental Driver
+device		acpi0
+options		ACPI_DEBUG
 #
 # Optional ISA and EISA devices:
 #
Index: i386/i386/bios.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/bios.c,v
retrieving revision 1.29
diff -u -r1.29 bios.c
--- i386/i386/bios.c	1999/12/26 16:21:17	1.29
+++ i386/i386/bios.c	2000/01/29 14:43:10
@@ -31,6 +31,7 @@
  * Code for dealing with the BIOS in x86 PC systems.
  */
 
+#include "acpi.h"
 #include "opt_pnp.h"
 
 #include "isa.h"
@@ -53,6 +54,10 @@
 #include <isa/isavar.h>
 #endif
 
+#if NACPI > 0
+#include <machine/pc/acpi.h>
+#endif
+
 #define BIOS_START	0xe0000
 #define BIOS_SIZE	0x20000
 
@@ -136,11 +141,29 @@
 	    printf("pnpbios: Bad PnP BIOS data checksum\n");
 	}
     }
+#if NACPI>0
+    /*
+     * ACPI BIOS
+     * acpi_rsdp is GLOBAL and holds RSD PTR signature
+     */
+    if ((sigaddr = bios_sigsearch(0, "RSD PTR ", 8, 16, 0)) != 0) {
+ 	/* get a virtual pointer to the structure */
+      acpi_rsdp = (struct ACPIrsdp *)(uintptr_t)BIOS_PADDRTOVADDR(sigaddr);
+      for (cv = (u_int8_t *)acpi_rsdp, ck = 0, i = 0; i < sizeof(struct ACPIrsdp); i++) {
+ 	    ck += cv[i];
+      }
+      
+      /* If checksum is NG, disable it */
+ 	if (ck != 0) {
+ 	  printf("ACPI: Bad ACPI BIOS data checksum\n");
+ 	  acpi_rsdp=NULL;/* 0xa0000<=RSD_PTR<0x100000*/
+        }
+    }
+#endif
 
     if (bootverbose) {
 	    /* look for other know signatures */
 	    printf("Other BIOS signatures found:\n");
-	    printf("ACPI: %08x\n", bios_sigsearch(0, "RSD PTR ", 8, 16, 0));
     }
 }
 
Index: i386/i386/machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.382
diff -u -r1.382 machdep.c
--- i386/i386/machdep.c	1999/12/06 04:53:03	1.382
+++ i386/i386/machdep.c	2000/01/29 14:43:24
@@ -37,7 +37,7 @@
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
  * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.382 1999/12/06 04:53:03 luoqi Exp $
  */
-
+#include "acpi.h"
 #include "apm.h"
 #include "ether.h"
 #include "npx.h"
@@ -129,6 +129,10 @@
 #include <sys/ptrace.h>
 #include <machine/sigframe.h>
 
+#if NACPI > 0
+#include <machine/pc/acpi.h>
+#endif
+
 extern void init386 __P((int first));
 extern void dblfault_handler __P((void));
 
@@ -1456,6 +1460,9 @@
 	smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT));
 	vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di);
 
+#if NACPI > 0
+	acpi_init_addr_range();
+#endif
 	physmap_idx = 0;
 	vmf.vmf_ebx = 0;
 	do {
@@ -1472,7 +1479,13 @@
 				(u_int32_t)smap->base,
 				*(u_int32_t *)((char *)&smap->length + 4),
 				(u_int32_t)smap->length);
-
+#if NACPI > 0
+		/* Save ACPI related memory Info */
+		if (smap->type == 0x03 || smap->type == 0x04) {
+			acpi_register_addr_range(smap->base,
+						 smap->length, smap->type);
+		}
+#endif
 		if (smap->type != 0x01)
 			goto next_run;
 
