From owner-acpi-jp@jp.freebsd.org  Fri Oct 19 01:50:52 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id BAA10596;
	Fri, 19 Oct 2001 01:50:52 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (root@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id BAA10591
	for <acpi-jp@jp.freebsd.org>; Fri, 19 Oct 2001 01:50:51 +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.6+3.4W/8.11.6/tasogare) with ESMTP/inet id f9IGomm53591
	for <acpi-jp@jp.freebsd.org>; Fri, 19 Oct 2001 01:50:48 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Date: Fri, 19 Oct 2001 01:50:46 +0900 (JST)
Message-Id: <20011019.015046.71086948.iwasaki@jp.FreeBSD.org>
To: acpi-jp@jp.freebsd.org
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
In-Reply-To: <20011018.211502.74754977.iwasaki@jp.FreeBSD.org>
References: <20011016.223207.74756782.iwasaki@jp.FreeBSD.org>
	<200110171348.WAA91918@shidahara1.planet.sci.kobe-u.ac.jp>
	<20011018.211502.74754977.iwasaki@jp.FreeBSD.org>
X-Mailer: Mew version 2.0 on Emacs 20.7 / Mule 4.0 (HANANOEN)
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+010328
X-Sequence: acpi-jp 1354
Subject: [acpi-jp 1354] Re: DSDT Override
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

> > >Cool!  You really did :-)  Thanks watanabe-san.
> > ># do you remember our discussion over a year ago at shimbashi-station?
> > 
> > I remembered. We may have to enhance our ACPI disassembler 
> > so that it can produce the output that can be used as ASL compiler output.
> 
> OK, I'll try it coming weekend.  If I fail, somebody please help me. :)

I've just finished for some reason.  It seems that we can compile dumped
ASL files with iasl (and my aslc).  I haven't test them with MS asl.exe yet,
but should be OK.
I'll commit this coming weekend if no objections.

Thanks

Index: acpidump/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- acpidump/Makefile	20 Jul 2001 06:20:30 -0000	1.5
+++ acpidump/Makefile	18 Oct 2001 14:45:53 -0000
@@ -4,7 +4,11 @@
 PROG=	acpidump
 MAN=	acpidump.8
 SRCS=	acpi.c acpi_user.c asl_dump.c aml_dump.c acpidump.c
+SRCS+=	aml_name.c aml_parse.c aml_amlmem.c aml_memman.c aml_obj.c
+SRCS+=	aml_common.c aml_evalobj.c aml_store.c
 
-#DEBUG_FLAGS= -g
+.PATH:	${.CURDIR}/../amldb/aml ${.CURDIR}/../amldb
+
+CFLAGS+=	-I${.CURDIR}/../amldb
 
 .include <bsd.prog.mk>
Index: acpidump/acpi.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpi.c,v
retrieving revision 1.3
diff -u -r1.3 acpi.c
--- acpidump/acpi.c	8 Nov 2000 02:37:00 -0000	1.3
+++ acpidump/acpi.c	18 Oct 2001 16:28:24 -0000
@@ -39,6 +39,50 @@
 
 #include "acpidump.h"
 
+#include "aml/aml_env.h"
+#include "aml/aml_common.h"
+
+#define BEGIN_COMMENT	"/*\n"
+#define END_COMMENT	" */\n"
+
+struct ACPIsdt	dsdt_header = {
+	"DSDT", 0, 1, 0, "OEMID", "OEMTBLID", 0x12345678, "CRTR", 0x12345678
+};
+
+static void
+acpi_trim_string(char *s, size_t length)
+{
+
+	/* Trim trailing spaces and NULLs */
+	while (length > 0 && (s[length - 1] == ' ' || s[length - 1] == '\0'))
+		s[length-- - 1] = '\0';
+}
+
+static void
+acpi_print_dsdt_definition(void)
+{
+	int	len;
+	char	*p;
+	char	oemid[6 + 1];
+	char	oemtblid[8 + 1];
+
+	acpi_trim_string(dsdt_header.oemid, 6);
+	acpi_trim_string(dsdt_header.oemtblid, 8);
+	strncpy(oemid, dsdt_header.oemid, 6);
+	oemid[6] = '\0';
+	strncpy(oemtblid, dsdt_header.oemtblid, 8);
+	oemtblid[8] = '\0';
+
+	printf("DefinitionBlock (
+	\"acpi_dsdt.aml\",	//Output filename
+	\"DSDT\",		//Signature
+	0x%x,			//DSDT Revision
+	\"%s\",			//OEMID
+	\"%s\",			//TABLE ID
+	0x%x			//OEM Revision\n)\n",
+	dsdt_header.rev, oemid, oemtblid, dsdt_header.oemrev);
+}
+
 static void
 acpi_print_string(char *s, size_t length)
 {
@@ -59,12 +103,14 @@
 {
 	u_int8_t       *dp;
 	u_int8_t       *end;
+	extern struct aml_environ	asl_env;
 
 	acpi_print_dsdt(dsdp);
+
 	dp = (u_int8_t *)dsdp->body;
 	end = (u_int8_t *)dsdp + dsdp->len;
-	asl_dump_objectlist(&dp, end, 0);
-	assert(dp == end);
+
+	acpi_dump_dsdt(dp, end);
 }
 
 static void
@@ -77,7 +123,21 @@
 	if (acpi_checksum(dsdp, dsdp->len))
 		errx(1, "DSDT is corrupt\n");
 	acpi_handle_dsdt(dsdp);
-	aml_dump(dsdp->body, dsdp->len - SIZEOF_SDT_HDR);
+	aml_dump(dsdp);
+}
+
+static void
+init_namespace()
+{
+	struct	aml_environ env;
+	struct	aml_name *newname;
+
+	aml_new_name_group(AML_NAME_GROUP_OS_DEFINED);
+	env.curname = aml_get_rootname();
+	newname = aml_create_name(&env, "\\_OS_");
+	newname->property = aml_alloc_object(aml_t_string, NULL);
+	newname->property->str.needfree = 0;
+	newname->property->str.string = "Microsoft Windows NT";
 }
 
 /*
@@ -85,11 +145,41 @@
  */
 
 void
+acpi_dump_dsdt(u_int8_t *dp, u_int8_t *end)
+{
+	extern struct aml_environ	asl_env;
+
+	acpi_print_dsdt_definition();
+
+	/* 1st stage: parse only w/o printing */
+	init_namespace();
+	aml_new_name_group((int)dp);
+	bzero(&asl_env, sizeof(asl_env));
+
+	asl_env.dp = dp;
+	asl_env.end = end;
+	asl_env.curname = aml_get_rootname();
+
+	aml_local_stack_push(aml_local_stack_create());
+	aml_parse_objectlist(&asl_env, 0);
+	aml_local_stack_delete(aml_local_stack_pop());
+
+	assert(asl_env.dp == asl_env.end);
+	asl_env.dp = dp;
+
+	/* 2nd stage: dump whole object list */
+	printf("\n{\n");
+	asl_dump_objectlist(&dp, end, 0);
+	printf("\n}\n");
+	assert(dp == end);
+}
+void
 acpi_print_sdt(struct ACPIsdt *sdp)
 {
 
+	printf(BEGIN_COMMENT);
 	acpi_print_string(sdp->signature, 4);
-	printf(": Lenth=%d, Revision=%d, Checksum=%d,\n",
+	printf(": Length=%d, Revision=%d, Checksum=%d,\n",
 	       sdp->len, sdp->rev, sdp->check);
 	printf("\tOEMID=");
 	acpi_print_string(sdp->oemid, 6);
@@ -99,6 +189,10 @@
 	printf("\tCreator ID=");
 	acpi_print_string(sdp->creator, 4);
 	printf(", Creator Revision=0x%x\n", sdp->crerev);
+	printf(END_COMMENT);
+	if (!memcmp(sdp->signature, "DSDT", 4)) {
+		memcpy(&dsdt_header, sdp, sizeof(dsdt_header));
+	}
 }
 
 void
@@ -108,6 +202,7 @@
 
 	acpi_print_sdt(rsdp);
 	entries = (rsdp->len - SIZEOF_SDT_HDR) / sizeof(u_int32_t);
+	printf(BEGIN_COMMENT);
 	printf("\tEntries={ ");
 	for (i = 0; i < entries; i++) {
 		if (i > 0)
@@ -115,6 +210,7 @@
 		printf("0x%08x", rsdp->body[i]);
 	}
 	printf(" }\n");
+	printf(END_COMMENT);
 }
 
 void
@@ -122,6 +218,7 @@
 {
 	char	sep;
 
+	printf(BEGIN_COMMENT);
 	printf("\tDSDT=0x%x\n", facp->dsdt_ptr);
 	printf("\tINT_MODEL=%s\n", facp->int_model ? "APIC" : "PIC");
 	printf("\tSCI_INT=%d\n", facp->sci_int);
@@ -193,6 +290,7 @@
 #undef PRINTFLAG
 
 	printf("}\n");
+	printf(END_COMMENT);
 }
 
 void
@@ -230,9 +328,11 @@
 acpi_print_rsd_ptr(struct ACPIrsdp *rp)
 {
 
+	printf(BEGIN_COMMENT);
 	printf("RSD PTR: Checksum=%d, OEMID=", rp->sum);
 	acpi_print_string(rp->oem, 6);
 	printf(", RsdtAddress=0x%08x\n", rp->addr);
+	printf(END_COMMENT);
 }
 
 void
@@ -255,3 +355,86 @@
 		}
 	}
 }
+
+/*
+ *	Dummy functions
+ */
+
+void
+aml_dbgr(struct aml_environ *env1, struct aml_environ *env2)
+{
+	/* do nothing */
+}
+
+int
+aml_region_read_simple(struct aml_region_handle *h, vm_offset_t offset,
+    u_int32_t *valuep)
+{
+	return (0);
+}
+
+int
+aml_region_write_simple(struct aml_region_handle *h, vm_offset_t offset,
+    u_int32_t value)
+{
+	return (0);
+}
+
+u_int32_t
+aml_region_prompt_read(struct aml_region_handle *h, u_int32_t value)
+{
+	return (0);
+}
+
+u_int32_t
+aml_region_prompt_write(struct aml_region_handle *h, u_int32_t value)
+{
+	return (0);
+}
+
+int
+aml_region_prompt_update_value(u_int32_t orgval, u_int32_t value,
+    struct aml_region_handle *h)
+{
+	return (0);
+}
+
+u_int32_t
+aml_region_read(struct aml_environ *env, int regtype, u_int32_t flags,
+    u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen)
+{
+	return (0);
+}
+
+int
+aml_region_write(struct aml_environ *env, int regtype, u_int32_t flags,
+    u_int32_t value, u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen)
+{
+	return (0);
+}
+
+int
+aml_region_write_from_buffer(struct aml_environ *env, int regtype,
+    u_int32_t flags, u_int8_t *buffer, u_int32_t addr, u_int32_t bitoffset,
+    u_int32_t bitlen)
+{
+	return (0);
+}
+
+int
+aml_region_bcopy(struct aml_environ *env, int regtype, u_int32_t flags,
+    u_int32_t addr, u_int32_t bitoffset, u_int32_t bitlen,
+    u_int32_t dflags, u_int32_t daddr,
+    u_int32_t dbitoffset, u_int32_t dbitlen)
+{
+	return (0);
+}
+
+int
+aml_region_read_into_buffer(struct aml_environ *env, int regtype,
+    u_int32_t flags, u_int32_t addr, u_int32_t bitoffset,
+    u_int32_t bitlen, u_int8_t *buffer)
+{
+	return (0);
+}
+
Index: acpidump/acpi_user.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpi_user.c,v
retrieving revision 1.3
diff -u -r1.3 acpi_user.c
--- acpidump/acpi_user.c	8 Nov 2000 02:37:00 -0000	1.3
+++ acpidump/acpi_user.c	18 Oct 2001 16:30:04 -0000
@@ -149,14 +149,11 @@
 		errx(1, "mmap %s\n", dumpfile);
 	}
 
-	/*
-	 * Microsoft asl.exe generates 0x23 byte additional info.
-	 * at the begining of the file, so just ignore it.
-	 */
-        if (strncmp(dp, "DSDT", 4) == 0) {
-                dp += 0x23;
-		sb.st_size -= 0x23;
-        }
+	if (strncmp(dp, "DSDT", 4) == 0) {
+		memcpy(&dsdt_header, dp, SIZEOF_SDT_HDR);
+		dp += SIZEOF_SDT_HDR;
+		sb.st_size -= SIZEOF_SDT_HDR;
+	}
 
 	end = (u_int8_t *) dp + sb.st_size;
 	*dpp = dp;
Index: acpidump/acpidump.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpidump.8,v
retrieving revision 1.9
diff -u -r1.9 acpidump.8
--- acpidump/acpidump.8	5 Sep 2001 19:21:25 -0000	1.9
+++ acpidump/acpidump.8	18 Oct 2001 13:10:14 -0000
@@ -133,10 +133,6 @@
 doesn't dump any information of Firmware ACPI Control Structure
 (FACS)
 specified by a pointer in FACP.
-Some parts of output in ASL are incomplete.  To obtain a complete
-output, it would need to change the implementation into another one
-that analyzes a whole DSDT and builds an ACPI namespace as preprocess,
-and then interprets the DSDT again referring to namespace.
 .Sh FILES
 .Bl -tag -width /dev/mem
 .It Pa /dev/mem
Index: acpidump/acpidump.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpidump.c,v
retrieving revision 1.3
diff -u -r1.3 acpidump.c
--- acpidump/acpidump.c	8 Nov 2000 02:37:00 -0000	1.3
+++ acpidump/acpidump.c	18 Oct 2001 12:58:53 -0000
@@ -41,9 +41,10 @@
 {
 	u_int8_t	*dp;
 	u_int8_t	*end;
+	struct	ACPIsdt *dsdt;
 
 	acpi_load_dsdt(file, &dp, &end);
-	asl_dump_objectlist(&dp, end, 0);
+	acpi_dump_dsdt(dp, end);
 }
 
 static void
Index: acpidump/acpidump.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/acpidump.h,v
retrieving revision 1.2
diff -u -r1.2 acpidump.h
--- acpidump/acpidump.h	8 Nov 2000 02:37:00 -0000	1.2
+++ acpidump/acpidump.h	18 Oct 2001 16:18:51 -0000
@@ -169,11 +169,12 @@
 void		 asl_dump_termobj(u_int8_t **, int);
 void		 asl_dump_objectlist(u_int8_t **, u_int8_t *, int);
 
-void		 aml_dump(u_int32_t *, int);
+void		 aml_dump(struct ACPIsdt *);
 
 void    	 acpi_handle_rsdt(struct ACPIsdt *);
 void		 acpi_load_dsdt(char *, u_int8_t **, u_int8_t **);
-
+void		 acpi_dump_dsdt(u_int8_t *, u_int8_t *);
 extern char	*aml_dumpfile;
+extern struct	ACPIsdt dsdt_header;
 
 #endif	/* !_ACPIDUMP_H_ */
Index: acpidump/aml_dump.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/aml_dump.c,v
retrieving revision 1.3
diff -u -r1.3 aml_dump.c
--- acpidump/aml_dump.c	8 Nov 2000 02:37:00 -0000	1.3
+++ acpidump/aml_dump.c	18 Oct 2001 16:18:39 -0000
@@ -39,7 +39,7 @@
 char	*aml_dumpfile = NULL;
 
 void
-aml_dump(u_int32_t *ptr, int len)
+aml_dump(struct ACPIsdt *dsdp)
 {
 	int	fd;
 	mode_t	mode;
@@ -49,10 +49,12 @@
 	}
 
 	mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-	fd = open(aml_dumpfile, O_WRONLY | O_CREAT, mode);
+	fd = open(aml_dumpfile, O_WRONLY | O_CREAT | O_TRUNC, mode);
 	if (fd == -1) {
 		return;
 	}
-	write(fd, ptr, len);
+	write(fd, dsdp, SIZEOF_SDT_HDR);
+	write(fd, dsdp->body, dsdp->len - SIZEOF_SDT_HDR);
 	close(fd);
 }
+
Index: acpidump/asl_dump.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/acpidump/asl_dump.c,v
retrieving revision 1.3
diff -u -r1.3 asl_dump.c
--- acpidump/asl_dump.c	8 Nov 2000 02:37:00 -0000	1.3
+++ acpidump/asl_dump.c	18 Oct 2001 14:12:11 -0000
@@ -36,6 +36,10 @@
 
 #include "acpidump.h"
 
+#include "aml/aml_env.h"
+
+struct aml_environ	asl_env;
+
 static u_int32_t
 asl_dump_pkglength(u_int8_t **dpp)
 {
@@ -184,6 +188,19 @@
 		printf("    ");
 }
 
+#define ASL_ENTER_SCOPE(dp_orig, old_name) do {				\
+	u_int8_t	*dp_copy;					\
+	u_int8_t	*name;						\
+	old_name = asl_env.curname;					\
+	dp_copy = dp_orig;						\
+	name = asl_dump_namestring(&dp_copy);				\
+	asl_env.curname = aml_search_name(&asl_env, name);		\
+} while(0)
+
+#define ASL_LEAVE_SCOPE(old_name) do {					\
+	asl_env.curname = old_name;					\
+} while(0)
+
 static void
 asl_dump_defscope(u_int8_t **dpp, int indent)
 {
@@ -191,12 +208,14 @@
 	u_int8_t	*start;
 	u_int8_t	*end;
 	u_int32_t	pkglength;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
 	pkglength = asl_dump_pkglength(&dp);
 
 	printf("Scope(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	printf(") {\n");
 	end = start + pkglength;
@@ -205,7 +224,7 @@
 	printf("}");
 
 	assert(dp == end);
-
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -263,6 +282,8 @@
 	*dpp = dp;
 }
 
+int	scope_within_method = 0;
+
 static void
 asl_dump_defmethod(u_int8_t **dpp, int indent)
 {
@@ -271,12 +292,14 @@
 	u_int8_t	*end;
 	u_int8_t	flags;
 	u_int32_t	pkglength;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
 	pkglength = asl_dump_pkglength(&dp);
 
 	printf("Method(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	flags = *dp++;
 	if (flags) {
@@ -287,12 +310,14 @@
 	}
 	printf(") {\n");
 	end = start + pkglength;
+	scope_within_method = 1;
 	asl_dump_objectlist(&dp, end, indent + 1);
+	scope_within_method = 0;
 	print_indent(indent);
 	printf("}");
 
 	assert(dp == end);
-
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -506,6 +531,7 @@
 	u_int8_t	*start;
 	u_int8_t	*end;
 	u_int32_t	pkglength;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
@@ -513,6 +539,7 @@
 	end = start + pkglength;
 
 	printf("Device(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	printf(") {\n");
 	asl_dump_objectlist(&dp, end, indent + 1);
@@ -521,6 +548,7 @@
 
 	assert(dp == end);
 
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -534,6 +562,7 @@
 	u_int8_t        pblklen;
 	u_int32_t       pkglength;
 	u_int32_t       pblkaddr;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
@@ -541,6 +570,7 @@
 	end = start + pkglength;
 
 	printf("Processor(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	procid = asl_dump_bytedata(&dp);
 	pblkaddr = asl_dump_dworddata(&dp);
@@ -552,6 +582,7 @@
 
 	assert(dp == end);
 
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -564,6 +595,7 @@
 	u_int8_t	systemlevel;
 	u_int16_t	resourceorder;
 	u_int32_t	pkglength;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
@@ -571,6 +603,7 @@
 	end = start + pkglength;
 
 	printf("PowerResource(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	systemlevel = asl_dump_bytedata(&dp);
 	resourceorder = asl_dump_worddata(&dp);
@@ -581,6 +614,7 @@
 
 	assert(dp == end);
 
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -591,6 +625,7 @@
 	u_int8_t	*start;
 	u_int8_t	*end;
 	u_int32_t	pkglength;
+	struct	aml_name *oname;
 
 	dp = *dpp;
 	start = dp;
@@ -598,6 +633,7 @@
 	end = start + pkglength;
 
 	printf("ThermalZone(");
+	ASL_ENTER_SCOPE(dp, oname);
 	asl_dump_termobj(&dp, indent);
 	printf(") {\n");
 	asl_dump_objectlist(&dp, end, indent + 1);
@@ -606,6 +642,7 @@
 
 	assert(dp == end);
 
+	ASL_LEAVE_SCOPE(oname);
 	*dpp = dp;
 }
 
@@ -690,7 +727,9 @@
 asl_dump_termobj(u_int8_t **dpp, int indent)
 {
 	u_int8_t	*dp;
+	u_int8_t	*name;
 	u_int8_t	opcode;
+	struct	aml_name *method;
 	const	char *matchstr[] = {
 		"MTR", "MEQ", "MLE", "MLT", "MGE", "MGT",
 	};
@@ -713,7 +752,23 @@
 	case '_':
 	case '.':
 		dp--;
-		print_namestring(asl_dump_namestring(&dp));
+		print_namestring((name = asl_dump_namestring(&dp)));
+		method = aml_search_name(&asl_env, name);
+		if (scope_within_method == 1 && method != NULL && method->property) {
+			if (method->property->type == aml_t_method) {
+				int	i, argnum;
+
+				argnum = method->property->meth.argnum & 7;
+				printf("(");
+				for (i = 0; i < argnum; i++) {
+					asl_dump_termobj(&dp, indent);
+					if (i < (argnum-1)) {
+						printf(", ");
+					}
+				}
+				printf(")");
+			}
+		}
 		break;
 	case 0x0a:		/* BytePrefix */
 		printf("0x%x", asl_dump_bytedata(&dp));
@@ -925,8 +980,8 @@
 		OPTARG();
 		printf(")");
 		break;
-	case 0x73:		/* ConcatOp */
-		printf("Concat(");
+	case 0x73:		/* ConcatenateOp */
+		printf("Concatenate(");
 		asl_dump_termobj(&dp, indent);
 		printf(", ");
 		asl_dump_termobj(&dp, indent);
@@ -1058,7 +1113,7 @@
 		printf(")");
 		break;
 	case 0x87:		/* SizeOfOp */
-		printf("Sizeof(");
+		printf("SizeOf(");
 		asl_dump_termobj(&dp, indent);
 		printf(")");
 		break;
Index: amldb/Makefile
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- amldb/Makefile	20 Jul 2001 06:20:31 -0000	1.6
+++ amldb/Makefile	18 Oct 2001 13:18:51 -0000
@@ -7,7 +7,6 @@
 SRCS+=	aml_parse.c aml_name.c aml_amlmem.c aml_memman.c aml_store.c \
 	aml_obj.c aml_evalobj.c aml_common.c
 
-#DEBUG_FLAGS= -g
 CFLAGS+= -I${.CURDIR}
 
 .include <bsd.prog.mk>
Index: amldb/amldb.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/acpi/amldb/amldb.c,v
retrieving revision 1.2
diff -u -r1.2 amldb.c
--- amldb/amldb.c	9 Nov 2000 06:24:40 -0000	1.2
+++ amldb/amldb.c	18 Oct 2001 16:42:46 -0000
@@ -94,12 +94,9 @@
 	aml_new_name_group((int)code);
 	bzero(&env, sizeof(env));
 
-	/*
-	 * Microsoft asl.exe generates 0x23 byte additional info.
-	 * at the begining of the file, so just ignore it.   
-	 */
+#define SIZEOF_SDT_HDR 36	/* struct size except body */
 	if (strncmp(code, "DSDT", 4) == 0) {
-		env.dp = code + 0x23;
+		env.dp = code + SIZEOF_SDT_HDR;
 	} else {
 		env.dp = code;
 	}
