From owner-acpi-jp@jp.freebsd.org  Wed May 24 01:51:07 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA78161;
	Wed, 24 May 2000 01:51:07 +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 BAA78154
	for <acpi-jp@jp.freebsd.org>; Wed, 24 May 2000 01:51:06 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (isdn16.imasy.or.jp [202.227.24.208])
	by tasogare.imasy.or.jp (8.9.3+3.2W/3.7W-tasogare/smtpfeed 1.04) with ESMTP id BAA55542
	for <acpi-jp@jp.freebsd.org>; Wed, 24 May 2000 01:51:02 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
To: acpi-jp@jp.freebsd.org
In-Reply-To: <200005222005.FAA04835@libr.scitec.kobe-u.ac.jp>
References: <20000523023819Z.iwasaki@jp.FreeBSD.org>
	<200005222005.FAA04835@libr.scitec.kobe-u.ac.jp>
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Message-Id: <20000524015059P.iwasaki@jp.FreeBSD.org>
Date: Wed, 24 May 2000 01:50:59 +0900
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
X-Dispatcher: imput version 20000228(IM140)
Lines: 166
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 308
Subject: [acpi-jp 308] Re: schedule 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

> > 0. $B5!G=DI2C(B
> > 1. ACPI tree $B$K(B -current $B$r(B import
> > 2. acpiconf $B$rK\Mh$N(B acpiconf $B$H(B acpidb $B$XJ,N%(B
> 
> $B<h$j4:$($:!"(Bacpidb$B$KJQ99$9$k;~E@$G!"(B@sys/i386/acpi/aml$BJU$j$K%j%]%8%H%j(B
> $B%3%T!<$9$k$Y$-$G$O!)(B

$B$=$&$G$9$M!"%j%]%8%H%j%3%T!<$NF@0U$JJ}$K<jEA$C$F$b$i$$$^$7$g$&!#(B
# $B$\$/$O$$$D$b(B cvs@freebsd.org $B$K$*4j$$$7$F$d$C$F$b$i$C$F$k$N$G(B :-)
# $B$"$i$$$5$s(B help?

> > 3. kernel/userland $BN>J}$G(B compile $B2DG=$J%3!<%I$K$9$k(B
> 
> $B$=$N8e!"$3$l$r$d$k$Y$-!)(B

takawata $B$5$s$N:n6H$r8+$k8B$j!"(Binterpreter $B$NItJ,$O(B
$B$J$s$H$+$J$j$=$&$J46$8$G$9$M!#$?$H$($P%a%b%j4IM}$N(B
$BItJ,$O$3$s$J46$8$G$9!#(B

Index: memman.c
===================================================================
RCS file: /home/cvs/ACPI/util/acpiconf/memman.c,v
retrieving revision 1.4
diff -u -r1.4 memman.c
--- memman.c	2000/03/21 19:30:11	1.4
+++ memman.c	2000/05/23 03:57:16
@@ -30,10 +30,19 @@
  * Generic Memory Management
  */
 
+#ifdef _KERNEL
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <i386/acpi/aml/memman.h>
+#else
 #include "memman.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#endif	/* _KERNEL */
 
 unsigned int	memid_unkown = 255;
 
@@ -54,7 +63,7 @@
 		tmp = (void *)block;
 		realblock = block + alloc_size;
 	} else {
-		tmp = malloc(alloc_size);
+		tmp = SYSMALLOC(alloc_size);
 		if (!tmp) {
 			return -1;
 		}
@@ -124,7 +133,7 @@
 
 	if (bmp->available == 0) {
 		alloc_size = roundup(bmp->size * MEMMAN_INCR_SIZE, ROUNDUP_UNIT);
-		block = malloc(alloc_size);
+		block = SYSMALLOC(alloc_size);
 		if (!block) {
 			goto malloc_fail;
 		}
@@ -206,9 +215,9 @@
 		return NULL;
 	}
 
-	if ((mem = malloc(size)) != NULL) {	/* XXX */
+	if ((mem = SYSMALLOC(size)) != NULL) {	/* XXX */
 
-		info = malloc(sizeof(struct memman_flexmem_info));
+		info = SYSMALLOC(sizeof(struct memman_flexmem_info));
 		if (info) {
 			if (!memman->flex_mem_initialized) {
 				LIST_INIT(&memman->flexmem_info_list);
@@ -283,7 +292,7 @@
 	
 	if (memman->max_memid <= id) {
 		printf("memman_free: invalid memory type id\n");
-		abort();
+		SYSABORT();
 		return;
 	}
 
@@ -324,13 +333,13 @@
 			bmp->available--;
 		}
 		block = memblock->block;
-		free(block);
+		SYSFREE(block);
 		memman->sfree_called++;
 
 		LIST_REMOVE(memblock, links);
 		memman->sfree_called++;
 		memman->reclaimed_mem += memblock->allocated_mem;
-		free(memblock);
+		SYSFREE(memblock);
 	}
 }
 
@@ -343,14 +352,14 @@
 		if (info->addr == chunk) {
 			memman->flex_reclaimed_mem += info->mem_size;
 			LIST_REMOVE(info, links);
-			free(info);
+			SYSFREE(info);
 			break;
 		}
 	}
 	/* XXX */
 	memman->flex_free_called++;
 	memman->flex_sfree_called++;
-	free(chunk);
+	SYSFREE(chunk);
 }
 
 void
@@ -376,7 +385,7 @@
 			if (!memblock->static_mem) {
 				memman->sfree_called++;
 				memman->reclaimed_mem += memblock->allocated_mem;
-				free(memblock);
+				SYSFREE(memblock);
 			}
 		}
 		bmp->initialized = 0;
Index: memman.h
===================================================================
RCS file: /home/cvs/ACPI/util/acpiconf/memman.h,v
retrieving revision 1.4
diff -u -r1.4 memman.h
--- memman.h	2000/03/21 19:30:11	1.4
+++ memman.h	2000/05/23 03:56:13
@@ -157,5 +157,20 @@
 void	memman_freeall(struct memman *);
 void	memman_statistics(struct memman *);
 size_t	memman_memid2size(struct memman *, unsigned int);
+
+#ifdef _KERNEL
+MALLOC_DEFINE(M_AMLPARSE, "aml", "AML Parser");
+#define SYSMALLOC(size) malloc(size, M_AMLPARSE, M_WAITOK) 
+#define SYSFREE(ptr)    free(ptr, M_AMLPARSE)
+#define SYSABORT()
+ 
+#else 
+ 
+#define SYSMALLOC(size) malloc(size)
+#define SYSFREE(ptr)    free(ptr)
+#define SYSABORT()  	abort()
+ 
+#endif  /* _KERNEL */
+
 #endif
 
> > 6. kernel $B$G$N(B I/O $B<BAu(B
> 
> struct aml_env$B$K!"(Bdevice_t dev$B$J%a%s%P$rIU$12C$($F(BOpRegion$B$KBP$7$F!"(B
> bus_alloc_resource$B$G3NJ]$7$F$_$k$H$3$^$G$O$d$C$F$_$?$s$G$9$1$I!"(B
> $B:rF|$N(BCommit$B$r%^!<%8$9$k=j$G!"<j85$N%3!<%I$r%G%0%l!<%I$7$F$7$^$$$^$7$?(B....(;_;)

$B$3$3$OB>$N(B OS $B$X$b4JC1$K;}$C$F$$$1$k$h$&$KCm0U$7$F$d$j$?$$$G$9$M!#(B

$B$"$H!"(BMutex $B$J$I$NF14|5!9=4X78$N<BAu$H$+$b$^$@$G$9$M!#(B
$B$3$N$X$s!"$I$&<BAu$9$k$+%"%$%G%#%"$"$j$^$9(B?
# [acpi-jp 148] $B$"$?$j$K$H$j$"$($:$NLuJ8$,$"$j$^$9!#(B
