changeset 9980:13d7f3eec672

6836969 acpica: update to Intel ACPI CA 20090521 6387741 process_master_file() causes kmem panics given a bogus master file 6837274 acpica: acpi_enum.c creates non-IEEE-1275 'compatible' properties
author Dana Myers <Dana.Myers@Sun.COM>
date Fri, 26 Jun 2009 17:26:34 -0700
parents 006c3455a081
children b4907297e740
files usr/src/uts/i86pc/io/ppm/acpisleep.c usr/src/uts/i86pc/os/cpupm/cpu_acpi.c usr/src/uts/i86pc/sys/cpu_acpi.h usr/src/uts/intel/Makefile.files usr/src/uts/intel/acpica/Makefile usr/src/uts/intel/ia32/ml/modstubs.s usr/src/uts/intel/io/acpica/acpi_enum.c usr/src/uts/intel/io/acpica/changes.txt usr/src/uts/intel/io/acpica/cmp_ca.sh usr/src/uts/intel/io/acpica/debugger/dbcmds.c usr/src/uts/intel/io/acpica/debugger/dbdisply.c usr/src/uts/intel/io/acpica/debugger/dbexec.c usr/src/uts/intel/io/acpica/debugger/dbfileio.c usr/src/uts/intel/io/acpica/debugger/dbhistry.c usr/src/uts/intel/io/acpica/debugger/dbinput.c usr/src/uts/intel/io/acpica/debugger/dbstats.c usr/src/uts/intel/io/acpica/debugger/dbutils.c usr/src/uts/intel/io/acpica/debugger/dbxface.c usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c usr/src/uts/intel/io/acpica/disassembler/dmnames.c usr/src/uts/intel/io/acpica/disassembler/dmobject.c usr/src/uts/intel/io/acpica/disassembler/dmopcode.c usr/src/uts/intel/io/acpica/disassembler/dmresrc.c usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c usr/src/uts/intel/io/acpica/disassembler/dmutils.c usr/src/uts/intel/io/acpica/disassembler/dmwalk.c usr/src/uts/intel/io/acpica/dispatcher/dsfield.c usr/src/uts/intel/io/acpica/dispatcher/dsinit.c usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c usr/src/uts/intel/io/acpica/dispatcher/dsobject.c usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c usr/src/uts/intel/io/acpica/dispatcher/dsutils.c usr/src/uts/intel/io/acpica/dispatcher/dswexec.c usr/src/uts/intel/io/acpica/dispatcher/dswload.c usr/src/uts/intel/io/acpica/dispatcher/dswscope.c usr/src/uts/intel/io/acpica/dispatcher/dswstate.c usr/src/uts/intel/io/acpica/events/evevent.c usr/src/uts/intel/io/acpica/events/evgpe.c usr/src/uts/intel/io/acpica/events/evgpeblk.c usr/src/uts/intel/io/acpica/events/evmisc.c usr/src/uts/intel/io/acpica/events/evregion.c usr/src/uts/intel/io/acpica/events/evrgnini.c usr/src/uts/intel/io/acpica/events/evsci.c usr/src/uts/intel/io/acpica/events/evxface.c usr/src/uts/intel/io/acpica/events/evxfevnt.c usr/src/uts/intel/io/acpica/events/evxfregn.c usr/src/uts/intel/io/acpica/executer/exconfig.c usr/src/uts/intel/io/acpica/executer/exconvrt.c usr/src/uts/intel/io/acpica/executer/excreate.c usr/src/uts/intel/io/acpica/executer/exdump.c usr/src/uts/intel/io/acpica/executer/exfield.c usr/src/uts/intel/io/acpica/executer/exfldio.c usr/src/uts/intel/io/acpica/executer/exmisc.c usr/src/uts/intel/io/acpica/executer/exmutex.c usr/src/uts/intel/io/acpica/executer/exnames.c usr/src/uts/intel/io/acpica/executer/exoparg1.c usr/src/uts/intel/io/acpica/executer/exoparg2.c usr/src/uts/intel/io/acpica/executer/exoparg3.c usr/src/uts/intel/io/acpica/executer/exoparg6.c usr/src/uts/intel/io/acpica/executer/exprep.c usr/src/uts/intel/io/acpica/executer/exregion.c usr/src/uts/intel/io/acpica/executer/exresnte.c usr/src/uts/intel/io/acpica/executer/exresolv.c usr/src/uts/intel/io/acpica/executer/exresop.c usr/src/uts/intel/io/acpica/executer/exstore.c usr/src/uts/intel/io/acpica/executer/exstoren.c usr/src/uts/intel/io/acpica/executer/exstorob.c usr/src/uts/intel/io/acpica/executer/exsystem.c usr/src/uts/intel/io/acpica/executer/exutils.c usr/src/uts/intel/io/acpica/hardware/hwacpi.c usr/src/uts/intel/io/acpica/hardware/hwgpe.c usr/src/uts/intel/io/acpica/hardware/hwregs.c usr/src/uts/intel/io/acpica/hardware/hwsleep.c usr/src/uts/intel/io/acpica/hardware/hwtimer.c usr/src/uts/intel/io/acpica/hardware/hwvalid.c usr/src/uts/intel/io/acpica/hardware/hwxface.c usr/src/uts/intel/io/acpica/master_ops.c usr/src/uts/intel/io/acpica/namespace/nsaccess.c usr/src/uts/intel/io/acpica/namespace/nsalloc.c usr/src/uts/intel/io/acpica/namespace/nsdump.c usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c usr/src/uts/intel/io/acpica/namespace/nseval.c usr/src/uts/intel/io/acpica/namespace/nsinit.c usr/src/uts/intel/io/acpica/namespace/nsload.c usr/src/uts/intel/io/acpica/namespace/nsnames.c usr/src/uts/intel/io/acpica/namespace/nsobject.c usr/src/uts/intel/io/acpica/namespace/nsparse.c usr/src/uts/intel/io/acpica/namespace/nspredef.c usr/src/uts/intel/io/acpica/namespace/nssearch.c usr/src/uts/intel/io/acpica/namespace/nsutils.c usr/src/uts/intel/io/acpica/namespace/nswalk.c usr/src/uts/intel/io/acpica/namespace/nsxfeval.c usr/src/uts/intel/io/acpica/namespace/nsxfname.c usr/src/uts/intel/io/acpica/namespace/nsxfobj.c usr/src/uts/intel/io/acpica/osl.c usr/src/uts/intel/io/acpica/parser/psargs.c usr/src/uts/intel/io/acpica/parser/psloop.c usr/src/uts/intel/io/acpica/parser/psopcode.c usr/src/uts/intel/io/acpica/parser/psparse.c usr/src/uts/intel/io/acpica/parser/psscope.c usr/src/uts/intel/io/acpica/parser/pstree.c usr/src/uts/intel/io/acpica/parser/psutils.c usr/src/uts/intel/io/acpica/parser/pswalk.c usr/src/uts/intel/io/acpica/parser/psxface.c usr/src/uts/intel/io/acpica/resources/rsaddr.c usr/src/uts/intel/io/acpica/resources/rscalc.c usr/src/uts/intel/io/acpica/resources/rscreate.c usr/src/uts/intel/io/acpica/resources/rsdump.c usr/src/uts/intel/io/acpica/resources/rsinfo.c usr/src/uts/intel/io/acpica/resources/rsio.c usr/src/uts/intel/io/acpica/resources/rsirq.c usr/src/uts/intel/io/acpica/resources/rslist.c usr/src/uts/intel/io/acpica/resources/rsmemory.c usr/src/uts/intel/io/acpica/resources/rsmisc.c usr/src/uts/intel/io/acpica/resources/rsutils.c usr/src/uts/intel/io/acpica/resources/rsxface.c usr/src/uts/intel/io/acpica/tables/tbfadt.c usr/src/uts/intel/io/acpica/tables/tbfind.c usr/src/uts/intel/io/acpica/tables/tbinstal.c usr/src/uts/intel/io/acpica/tables/tbutils.c usr/src/uts/intel/io/acpica/tables/tbxface.c usr/src/uts/intel/io/acpica/tables/tbxfroot.c usr/src/uts/intel/io/acpica/utilities/utalloc.c usr/src/uts/intel/io/acpica/utilities/utcache.c usr/src/uts/intel/io/acpica/utilities/utclib.c usr/src/uts/intel/io/acpica/utilities/utcopy.c usr/src/uts/intel/io/acpica/utilities/utdebug.c usr/src/uts/intel/io/acpica/utilities/utdelete.c usr/src/uts/intel/io/acpica/utilities/uteval.c usr/src/uts/intel/io/acpica/utilities/utglobal.c usr/src/uts/intel/io/acpica/utilities/utinit.c usr/src/uts/intel/io/acpica/utilities/utlock.c usr/src/uts/intel/io/acpica/utilities/utmath.c usr/src/uts/intel/io/acpica/utilities/utmisc.c usr/src/uts/intel/io/acpica/utilities/utmutex.c usr/src/uts/intel/io/acpica/utilities/utobject.c usr/src/uts/intel/io/acpica/utilities/utresrc.c usr/src/uts/intel/io/acpica/utilities/utstate.c usr/src/uts/intel/io/acpica/utilities/uttrack.c usr/src/uts/intel/io/acpica/utilities/utxface.c usr/src/uts/intel/sys/acpi/acapps.h usr/src/uts/intel/sys/acpi/accommon.h usr/src/uts/intel/sys/acpi/acconfig.h usr/src/uts/intel/sys/acpi/acdebug.h usr/src/uts/intel/sys/acpi/acdisasm.h usr/src/uts/intel/sys/acpi/acdispat.h usr/src/uts/intel/sys/acpi/acevents.h usr/src/uts/intel/sys/acpi/acexcep.h usr/src/uts/intel/sys/acpi/acglobal.h usr/src/uts/intel/sys/acpi/achware.h usr/src/uts/intel/sys/acpi/acinterp.h usr/src/uts/intel/sys/acpi/aclocal.h usr/src/uts/intel/sys/acpi/acmacros.h usr/src/uts/intel/sys/acpi/acnames.h usr/src/uts/intel/sys/acpi/acnamesp.h usr/src/uts/intel/sys/acpi/acobject.h usr/src/uts/intel/sys/acpi/acopcode.h usr/src/uts/intel/sys/acpi/acoutput.h usr/src/uts/intel/sys/acpi/acparser.h usr/src/uts/intel/sys/acpi/acpi.h usr/src/uts/intel/sys/acpi/acpiosxf.h usr/src/uts/intel/sys/acpi/acpixf.h usr/src/uts/intel/sys/acpi/acpredef.h usr/src/uts/intel/sys/acpi/acresrc.h usr/src/uts/intel/sys/acpi/acrestyp.h usr/src/uts/intel/sys/acpi/acstruct.h usr/src/uts/intel/sys/acpi/actables.h usr/src/uts/intel/sys/acpi/actbl.h usr/src/uts/intel/sys/acpi/actbl1.h usr/src/uts/intel/sys/acpi/actbl2.h usr/src/uts/intel/sys/acpi/actypes.h usr/src/uts/intel/sys/acpi/acutils.h usr/src/uts/intel/sys/acpi/amlcode.h usr/src/uts/intel/sys/acpi/amlresrc.h usr/src/uts/intel/sys/acpi/platform/accygwin.h usr/src/uts/intel/sys/acpi/platform/acefi.h usr/src/uts/intel/sys/acpi/platform/acenv.h usr/src/uts/intel/sys/acpi/platform/acfreebsd.h usr/src/uts/intel/sys/acpi/platform/acgcc.h usr/src/uts/intel/sys/acpi/platform/acintel.h usr/src/uts/intel/sys/acpi/platform/aclinux.h usr/src/uts/intel/sys/acpi/platform/acmsvc.h usr/src/uts/intel/sys/acpi/platform/acnetbsd.h usr/src/uts/intel/sys/acpi/platform/acos2.h usr/src/uts/intel/sys/acpi/platform/acsolaris.h usr/src/uts/intel/sys/acpi/platform/acwin.h usr/src/uts/intel/sys/acpi/platform/acwin64.h usr/src/uts/intel/sys/acpica.h
diffstat 190 files changed, 9330 insertions(+), 3974 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/io/ppm/acpisleep.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/i86pc/io/ppm/acpisleep.c	Fri Jun 26 17:26:34 2009 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -103,7 +103,7 @@
 	}
 	if (acpi_rtc_wake > 0) {
 		/* clear the RTC bit first */
-		(void) AcpiSetRegister(ACPI_BITREG_RT_CLOCK_STATUS, 1);
+		(void) AcpiWriteBitRegister(ACPI_BITREG_RT_CLOCK_STATUS, 1);
 		PT(PT_RTCW);
 		if (AcpiEnableEvent(ACPI_EVENT_RTC, 0) != AE_OK) {
 			PT(PT_RTCW_FAIL);
--- a/usr/src/uts/i86pc/os/cpupm/cpu_acpi.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/i86pc/os/cpupm/cpu_acpi.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1071,13 +1071,13 @@
 void
 cpu_acpi_set_register(uint32_t bitreg, uint32_t value)
 {
-	AcpiSetRegister(bitreg, value);
+	AcpiWriteBitRegister(bitreg, value);
 }
 
 void
 cpu_acpi_get_register(uint32_t bitreg, uint32_t *value)
 {
-	AcpiGetRegister(bitreg, value);
+	AcpiReadBitRegister(bitreg, value);
 }
 
 /*
--- a/usr/src/uts/i86pc/sys/cpu_acpi.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/i86pc/sys/cpu_acpi.h	Fri Jun 26 17:26:34 2009 -0700
@@ -28,8 +28,8 @@
 
 #include <sys/cpuvar.h>
 #include <sys/acpi/acpi.h>
+#include <sys/acpi/accommon.h>
 #include <sys/acpi/acresrc.h>
-#include <sys/acpi/acglobal.h>
 #include <sys/acpica.h>
 
 #ifdef __cplusplus
--- a/usr/src/uts/intel/Makefile.files	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/Makefile.files	Fri Jun 26 17:26:34 2009 -0700
@@ -214,7 +214,8 @@
 		   master_ops.o osl.o osl_ml.o acpica_ec.o utcache.o \
 		   utmutex.o utstate.o dmbuffer.o dmnames.o dmobject.o \
 		   dmopcode.o dmresrc.o dmresrcl.o dmresrcs.o dmutils.o \
-		   dmwalk.o psloop.o
+		   dmwalk.o psloop.o nspredef.o hwxface.o hwvalid.o \
+		   utlock.o
 
 AGP_OBJS += agpmaster.o
 FBT_OBJS += fbt.o
--- a/usr/src/uts/intel/acpica/Makefile	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/acpica/Makefile	Fri Jun 26 17:26:34 2009 -0700
@@ -1,8 +1,7 @@
 #
-# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
 #
 #	This makefile drives the production of the ACPI CA services
 #	kernel module.
@@ -24,6 +23,7 @@
 ROOTMODULE	= $(ROOT_MISC_DIR)/$(MODULE)
 INC_PATH        += -I$(UTSBASE)/intel/sys/acpi
 INC_PATH	+= -I$(UTSBASE)/i86pc
+INC_PATH	+= -I$(SRC)/common
 
 #
 #	Include common rules.
--- a/usr/src/uts/intel/ia32/ml/modstubs.s	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/ia32/ml/modstubs.s	Fri Jun 26 17:26:34 2009 -0700
@@ -1336,8 +1336,8 @@
 	NO_UNLOAD_STUB(acpica, AcpiRemoveNotifyHandler, nomod_minus_one) ;
 	NO_UNLOAD_STUB(acpica, AcpiEvaluateObject, nomod_minus_one) ;
 	NO_UNLOAD_STUB(acpica, AcpiEvaluateObjectTyped, nomod_minus_one) ;
-	NO_UNLOAD_STUB(acpica, AcpiSetRegister, nomod_minus_one) ;
-	NO_UNLOAD_STUB(acpica, AcpiGetRegister, nomod_minus_one) ;
+	NO_UNLOAD_STUB(acpica, AcpiWriteBitRegister, nomod_minus_one) ;
+	NO_UNLOAD_STUB(acpica, AcpiReadBitRegister, nomod_minus_one) ;
 	NO_UNLOAD_STUB(acpica, AcpiOsFree, nomod_minus_one) ;
 	NO_UNLOAD_STUB(acpica, acpica_get_handle_cpu, nomod_minus_one) ;
 	NO_UNLOAD_STUB(acpica, acpica_get_global_FADT, nomod_minus_one) ;
--- a/usr/src/uts/intel/io/acpica/acpi_enum.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/acpi_enum.c	Fri Jun 26 17:26:34 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -31,13 +31,10 @@
 #include <sys/sunddi.h>
 #include <sys/sunndi.h>
 #include <sys/note.h>
-#include "acpi.h"
+#include <sys/acpi/acpi.h>
 #include <sys/acpica.h>
+#include <util/sscanf.h>
 
-extern void free_master_data();
-extern void process_master_file();
-extern int master_file_lookup(char *, char **, char **, char **);
-extern int master_file_lookups(char *, char **, char **, char **, int);
 
 static char keyboard_alias[] = "keyboard";
 static char mouse_alias[] = "mouse";
@@ -605,40 +602,23 @@
 
 /*
  * put content of properties (if any) to dev info tree at branch xdip
+ * return non-zero if a "compatible" property was processed, zero otherwise
  *
  */
-static void
-process_properties(dev_info_t *xdip, char *properties)
+static int
+process_properties(dev_info_t *xdip, property_t *properties)
 {
-	char *tmp, *value, *org1;
+	int	rv = 0;
 
-	if (properties == NULL) {
-		return; /* nothing to add */
-	}
-	org1 = tmp = strchr(properties, '=');
-	if (tmp == NULL) {
-		cmn_err(CE_WARN, "!master_ops: incorrect properties: %s\n",
-		    properties);
-		return; /* don't know how to process this */
+	while (properties != NULL) {
+		(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
+		    properties->name, properties->value);
+		if (strcmp(properties->name, "compatible") == 0)
+			rv = 1;
+		properties = properties->next;
 	}
-	*tmp = '\0';
-	tmp++;
-	if (*tmp == '"') {
-		tmp++;
-	}
-	value = tmp;
-	tmp = strchr(value, '"');
-	if (tmp != NULL) {
-		*tmp = '\0';
-	}
-	(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip, properties, value);
-	/* put back original value to avoid kmem corruption */
-	if (org1 != NULL) {
-		*org1 = '=';
-	}
-	if (tmp != NULL) {
-		*tmp = '"';
-	}
+
+	return (rv);
 }
 
 void
@@ -649,8 +629,8 @@
 	/*
 	 *  Expand an EISA device name:
 	 *
-	 * This is the inverse of the above routine.  It converts a 32-bit EISA
-	 * device "id" to a 7-byte ASCII device name, which is stored at "np".
+	 * This routine converts a 32-bit EISA device "id" to a
+	 * 7-byte ASCII device name, which is stored at "np".
 	 */
 
 	*np++ = '@' + ((id >> 2)  & 0x1F);
@@ -667,51 +647,35 @@
  * process_cids() -- process multiple CIDs in a package
  */
 static void
-process_cids(ACPI_OBJECT *rv, char **cidstr, int *cidstr_size)
+process_cids(ACPI_OBJECT *rv, device_id_t **dd)
 {
-	char *tmp_cidstr;
+	device_id_t *d;
+	char tmp_cidstr[8];	/* 7-character EISA ID */
 	int i;
 
-	*cidstr_size = 0;
-	*cidstr = NULL;
-	if ((rv->Package.Count == 0) || rv->Package.Elements == NULL) {
+	if ((rv->Package.Count == 0) || rv->Package.Elements == NULL)
 		return; /* empty package */
-	}
 
-	/* figure out the total cid size needed */
-	for (i = 0; i < rv->Package.Count; i++) {
-		/* total up all CIDs size */
-		ACPI_OBJECT obj = rv->Package.Elements[i];
-		switch (obj.Type) {
-		case ACPI_TYPE_INTEGER:
-			*cidstr_size += EISA_ID_SIZE + 1;
-			break;
-		case ACPI_TYPE_STRING:
-			*cidstr_size += obj.String.Length + 1;
-			break;
-		default:
-			break;
-		}
-	}
-	*cidstr = kmem_zalloc(*cidstr_size, KM_SLEEP);
-	tmp_cidstr = *cidstr;
-	for (i = 0; i < rv->Package.Count; i++) {
+	/*
+	 * Work the package 'backwards' so the resulting list is
+	 * in original order of preference.
+	 */
+	for (i = rv->Package.Count - 1; i >= 0; i--) {
 		/* get the actual acpi_object */
 		ACPI_OBJECT obj = rv->Package.Elements[i];
 		switch (obj.Type) {
 		case ACPI_TYPE_INTEGER:
 			eisa_to_str(obj.Integer.Value, tmp_cidstr);
-			if (acpi_enum_debug & PROCESS_CIDS) {
-				cmn_err(CE_NOTE, "integer CID: %s", tmp_cidstr);
-			}
-			tmp_cidstr += EISA_ID_SIZE + 1;
+			d = mf_alloc_device_id();
+			d->id = strdup(tmp_cidstr);
+			d->next = *dd;
+			*dd = d;
 			break;
 		case ACPI_TYPE_STRING:
-			(void) strcpy(tmp_cidstr, obj.String.Pointer);
-			if (acpi_enum_debug & PROCESS_CIDS) {
-				cmn_err(CE_NOTE, "string CID: %s", tmp_cidstr);
-			}
-			tmp_cidstr += strlen(obj.String.Pointer) + 1;
+			d = mf_alloc_device_id();
+			d->id = strdup(obj.String.Pointer);
+			d->next = *dd;
+			*dd = d;
 			break;
 		default:
 			if (acpi_enum_debug & PROCESS_CIDS) {
@@ -721,9 +685,70 @@
 			break;
 		}
 	}
-	if (acpi_enum_debug & PROCESS_CIDS) {
-		cmn_err(CE_NOTE, "total CIDs: %d", rv->Package.Count);
+}
+
+/*
+ * Convert "raw" PNP and ACPI IDs to IEEE 1275-compliant form.
+ * Some liberty is taken here, treating "ACPI" as a special form
+ * of PNP vendor ID.  strsize specifies size of buffer.
+ */
+static void
+convert_to_pnp1275(char *pnpid, char *str, int strsize)
+{
+	char	vendor[5];
+	uint_t	id;
+
+	if (strncmp(pnpid, "ACPI", 4) == 0) {
+		/* Assume ACPI ID: ACPIxxxx */
+		sscanf(pnpid, "%4s%x", vendor, &id);
+	} else {
+		/* Assume PNP ID: aaaxxxx */
+		sscanf(pnpid, "%3s%x", vendor, &id);
 	}
+
+	snprintf(str, strsize, "pnp%s,%x", vendor, id);
+}
+
+/*
+ * Given a list of device ID elements in most-to-least-specific
+ * order, create a "compatible" property.
+ */
+static void
+create_compatible_property(dev_info_t *dip, device_id_t *ids)
+{
+	char		**strs;
+	int		list_len, i;
+	device_id_t	*d;
+
+	/* count list length */
+	list_len = 0;
+	d = ids;
+	while (d != NULL) {
+		list_len++;
+		d = d->next;
+	}
+
+	/* create string array */
+	strs = (char **)kmem_zalloc(list_len * sizeof (char *), KM_SLEEP);
+	i = 0;
+	d = ids;
+	while (d != NULL) {
+		/* strlen("pnpXXXX,xxxx") + 1 = 13 */
+		strs[i] = kmem_zalloc(13, KM_SLEEP);
+		convert_to_pnp1275(d->id, strs[i++], 13);
+		d = d->next;
+	}
+
+	/* update property */
+	(void) ndi_prop_update_string_array(DDI_DEV_T_NONE, dip,
+	    "compatible", strs, list_len);
+
+
+	/* free memory */
+	for (i = 0; i < list_len; i++)
+		kmem_free(strs[i], 13);
+
+	kmem_free(strs, list_len * sizeof (char *));
 }
 
 /*
@@ -738,14 +763,13 @@
 	ACPI_BUFFER	rb;
 	ACPI_DEVICE_INFO *info = NULL;
 	char		*path = NULL;
-	char 		*devname = NULL;
 	char		*hidstr = NULL;
-	char		*cidstr = NULL;
-	int		cidstr_size = 0;
-	char		*description = NULL;
-	char		*properties = NULL;
+	char		tmp_cidstr[8];	/* EISAID size */
 	dev_info_t	*dip = (dev_info_t *)a;
 	dev_info_t	*xdip = NULL;
+	device_id_t	*d, *device_ids = NULL;
+	const master_rec_t	*m;
+	int		compatible_present = 0;
 
 	/*
 	 * get full ACPI pathname for object
@@ -809,17 +833,20 @@
 
 		switch (rv->Type) {
 		case ACPI_TYPE_INTEGER:
-			cidstr_size = 8;
-			cidstr = kmem_zalloc(cidstr_size, KM_SLEEP);
-			eisa_to_str(rv->Integer.Value, cidstr);
+			eisa_to_str(rv->Integer.Value, tmp_cidstr);
+			d = mf_alloc_device_id();
+			d->id = strdup(tmp_cidstr);
+			d->next = device_ids;
+			device_ids = d;
 			break;
 		case ACPI_TYPE_STRING:
-			cidstr_size = strlen(rv->String.Pointer) + 1;
-			cidstr = kmem_zalloc(cidstr_size, KM_SLEEP);
-			(void) strcpy(cidstr, rv->String.Pointer);
+			d = mf_alloc_device_id();
+			d->id = strdup(rv->String.Pointer);
+			d->next = device_ids;
+			device_ids = d;
 			break;
 		case ACPI_TYPE_PACKAGE:
-			process_cids(rv, &cidstr, &cidstr_size);
+			process_cids(rv, &device_ids);
 			break;
 		default:
 			break;
@@ -827,27 +854,29 @@
 		AcpiOsFree(rb.Pointer);
 	}
 
+	/*
+	 * Add _HID last so it's at the head of the list
+	 */
+	d = mf_alloc_device_id();
+	d->id = strdup(hidstr);
+	d->next = device_ids;
+	device_ids = d;
 
 	/*
-	 * Note carefully: expressions are evaluated left to right, so
-	 * this first checks for _HID and then for _CID match
+	 * master_file_lookup() expects _HID first in device_ids
 	 */
-	if (master_file_lookup(hidstr, &devname, &description, &properties) ||
-	    master_file_lookups(cidstr, &devname, &description, &properties,
-	    cidstr_size)) {
+	if ((m = master_file_lookup(device_ids)) !=  NULL) {
 		/* PNP description found in master table */
 		if (!(strncmp(hidstr, "ACPI", 4))) {
 			dip = ddi_root_node();
 		} else {
-			dip = get_bus_dip(devname, dip);
+			dip = get_bus_dip(m->name, dip);
 		}
-		ndi_devi_alloc_sleep(dip, devname,
+		ndi_devi_alloc_sleep(dip, m->name,
 		    (pnode_t)DEVI_SID_NODEID, &xdip);
 		(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
-		    "compatible", hidstr);
-		(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
-		    "model", description);
-		(void) process_properties(xdip, properties);
+		    "model", m->description);
+		compatible_present = process_properties(xdip, m->properties);
 	} else {
 		/* for ISA devices not known to the master file */
 		if (!(strncmp(hidstr, "PNP03", 5))) {
@@ -870,77 +899,59 @@
 				(void) ndi_prop_update_string(DDI_DEV_T_NONE,
 				    xdip, "model", "PNP0Fxx mouse");
 			} else {
-				if (acpi_enum_debug & DEVICES_NOT_ENUMED) {
-					cmn_err(CE_WARN,
-					    "Not enum HID(%s), CID(%s)\n",
-					    hidstr, cidstr);
-				}
 				(void) parse_resources(ObjHandle, xdip);
 				goto done;
 			}
 		}
 	}
-	if (acpi_enum_debug & MASTER_LOOKUP_DEBUG) {
-		cmn_err(CE_NOTE, "ACPI devname=(%s), HID(%s), CID(%s)\n",
-		    devname, hidstr, cidstr);
-		cmn_err(CE_NOTE, "description=(%s) properties=(%s)\n",
-		    description, properties);
-	}
+
 	(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip, "acpi-namespace",
 	    path);
-	if (cidstr) {
-		char *cids[ACPI_ELEMENT_PACKAGE_LIMIT];
-		char *t = cidstr;
-		int i = 0;
-		while (t < (cidstr + cidstr_size)) {
-			if (*t == NULL) {
-				t++;
-				continue;
-			}
-			cids[i++] = t;
-			t += strlen(t);
-		}
-		(void) ndi_prop_update_string_array(DDI_DEV_T_NONE, xdip,
-		    "_CID", (char **)cids, i);
-	}
 
 	(void) parse_resources(ObjHandle, xdip);
 
 	/* Special processing for mouse and keyboard devices per IEEE 1275 */
 	/* if master entry doesn't contain "compatible" then we add default */
-	if (strcmp(devname, keyboard_alias) == 0) {
+	if (strcmp(m->name, keyboard_alias) == 0) {
 		(void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip, "reg", 0);
 		(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
 		    "device-type", keyboard_alias);
-		if (strncmp(properties, "compatible", 10)) {
+		if (!compatible_present)
 			(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
 			    "compatible", "pnpPNP,303");
-		}
-	} else if (strcmp(devname, mouse_alias) == 0) {
+	} else if (strcmp(m->name, mouse_alias) == 0) {
 		(void) ndi_prop_update_int(DDI_DEV_T_NONE, xdip, "reg", 1);
 		(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
 		    "device-type", mouse_alias);
-		if (strncmp(properties, "compatible", 10)) {
+		if (!compatible_present)
 			(void) ndi_prop_update_string(DDI_DEV_T_NONE, xdip,
 			    "compatible", "pnpPNP,f03");
-		}
 	}
 
+	/*
+	 * Create default "compatible" property if required
+	 */
+	if (!ddi_prop_exists(DDI_DEV_T_ANY, xdip,
+	    DDI_PROP_DONTPASS, "compatible"))
+		create_compatible_property(xdip, device_ids);
+
 	(void) ndi_devi_bind_driver(xdip, 0);
 
 done:
+	/* discard _HID/_CID list */
+	d = device_ids;
+	while (d != NULL) {
+		device_id_t *next;
+
+		next = d->next;
+		mf_free_device_id(d);
+		d = next;
+	}
+
 	if (path != NULL)
 		AcpiOsFree(path);
 	if (info != NULL)
 		AcpiOsFree(info);
-	if (cidstr != NULL)
-		kmem_free(cidstr, cidstr_size);
-	if (devname != NULL)
-		kmem_free(devname, strlen(devname) + 1);
-	if (description != NULL)
-		kmem_free(description, strlen(description) + 1);
-	if (properties != NULL)
-		kmem_free(properties, strlen(properties) + 1);
 
 	return (AE_OK);
 }
--- a/usr/src/uts/intel/io/acpica/changes.txt	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/changes.txt	Fri Jun 26 17:26:34 2009 -0700
@@ -1,4 +1,557 @@
 ----------------------------------------
+21 May 2009. Summary of changes for version 20090521:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Disabled the preservation of the SCI enable bit in the PM1 control register. 
+The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to be 
+a "preserved" bit - "OSPM always preserves this bit position", section 
+4.7.3.2.1. However, some machines fail if this bit is in fact preserved 
+because the bit needs to be explicitly set by the OS as a workaround. No 
+machines fail if the bit is not preserved. Therefore, ACPICA no longer 
+attempts to preserve this bit.
+
+Fixed a problem in AcpiRsGetPciRoutingTableLength where an invalid or 
+incorrectly formed _PRT package could cause a fault. Added validation to 
+ensure that each package element is actually a sub-package.
+
+Implemented a new interface to install or override a single control method, 
+AcpiInstallMethod. This interface is useful when debugging in order to repair 
+an existing method or to install a missing method without having to override 
+the entire ACPI table. See the ACPICA Programmer Reference for use and 
+examples. Lin Ming, Bob Moore.
+
+Fixed several reference count issues with the DdbHandle object that is 
+created from a Load or LoadTable operator. Prevent premature deletion of the 
+object. Also, mark the object as invalid once the table has been unloaded. 
+This is needed because the handle itself may not be deleted after the table 
+unload, depending on whether it has been stored in a named object by the 
+caller. Lin Ming.
+
+Fixed a problem with Mutex Sync Levels. Fixed a problem where if multiple 
+mutexes of the same sync level are acquired but then not released in strict 
+opposite order, the internally maintained Current Sync Level becomes confused 
+and can cause subsequent execution errors. ACPICA BZ 471.
+
+Changed the allowable release order for ASL mutex objects. The ACPI 4.0 
+specification has been changed to make the SyncLevel for mutex objects more 
+useful. When releasing a mutex, the SyncLevel of the mutex must now be the 
+same as the current sync level. This makes more sense than the previous rule 
+(SyncLevel less than or equal). This change updates the code to match the 
+specification.
+
+Fixed a problem with the local version of the AcpiOsPurgeCache function. The 
+(local) cache must be locked during all cache object deletions. Andrew 
+Baumann.
+
+Updated the Load operator to use operation region interfaces. This replaces 
+direct memory mapping with region access calls. Now, all region accesses go 
+through the installed region handler as they should.
+
+Simplified and optimized the NsGetNextNode function. Reduced parameter count 
+and reduced code for this frequently used function.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  82.8K Code, 17.5K Data, 100.3K Total
+    Debug Version:     158.0K Code, 49.9K Data, 207.9K Total
+  Current Release:
+    Non-Debug Version:  83.4K Code, 17.5K Data, 100.9K Total
+    Debug Version:     158.9K Code, 50.0K Data, 208.9K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Fixed some issues with DMAR, HEST, MADT tables. Some problems 
+with sub-table disassembly and handling invalid sub-tables. Attempt recovery 
+after an invalid sub-table ID.
+
+----------------------------------------
+22 April 2009. Summary of changes for version 20090422:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Fixed a compatibility issue with the recently released I/O port protection 
+mechanism. For windows compatibility, 1) On a port protection violation, 
+simply ignore the request and do not return an exception (allow the control 
+method to continue execution.) 2) If only part of the request overlaps a 
+protected port, read/write the individual ports that are not protected. Linux 
+BZ 13036. Lin Ming
+
+Enhanced the execution of the ASL/AML BreakPoint operator so that it actually 
+breaks into the AML debugger if the debugger is present. This matches the 
+ACPI-defined behavior.
+
+Fixed several possible warnings related to the use of the configurable 
+ACPI_THREAD_ID. This type can now be configured as either an integer or a 
+pointer with no warnings. Also fixes several warnings in printf-like 
+statements for the 64-bit build when the type is configured as a pointer. 
+ACPICA BZ 766, 767.
+
+Fixed a number of possible warnings when compiling with gcc 4+ (depending on 
+warning options.) Examples include printf formats, aliasing, unused globals, 
+missing prototypes, missing switch default statements, use of non-ANSI 
+library functions, use of non-ANSI constructs. See generate/unix/Makefile for 
+a list of warning options used with gcc 3 and 4. ACPICA BZ 735.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  82.6K Code, 17.6K Data, 100.2K Total
+    Debug Version:     157.7K Code, 49.9K Data, 207.6K Total
+  Current Release:
+    Non-Debug Version:  82.8K Code, 17.5K Data, 100.3K Total
+    Debug Version:     158.0K Code, 49.9K Data, 207.9K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings on 
+the 64-bit build.
+
+iASL: Fixed a problem where the Unix/Linux versions of the compiler could not 
+correctly digest Windows/DOS formatted files (with CR/LF).
+
+iASL: Added a new option for "quiet mode" (-va) that produces only the 
+compilation summary, not individual errors and warnings. Useful for large 
+batch compilations.
+
+AcpiExec: Implemented a new option (-z) to enable a forced semaphore/mutex 
+timeout that can be used to detect hang conditions during execution of AML 
+code (includes both internal semaphores and AML-defined mutexes and events.)
+
+Added new makefiles for the generation of acpica in a generic unix-like 
+environment. These makefiles are intended to generate the acpica tools and 
+utilities from the original acpica git source tree structure.
+
+Test Suites: Updated and cleaned up the documentation files. Updated the 
+copyrights to 2009, affecting all source files. Use the new version of iASL 
+with quiet mode. Increased the number of available semaphores in the Windows 
+OSL, allowing the aslts to execute fully on Windows. For the Unix OSL, added 
+an alternate implementation of the semaphore timeout to allow aslts to 
+execute fully on Cygwin.
+
+----------------------------------------
+20 March 2009. Summary of changes for version 20090320:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a possible race condition between AcpiWalkNamespace and dynamic table 
+unloads. Added a reader/writer locking mechanism to allow multiple concurrent 
+namespace walks (readers), but block a dynamic table unload until it can gain 
+exclusive write access to the namespace. This fixes a problem where a table 
+unload could (possibly catastrophically) delete the portion of the namespace 
+that is currently being examined by a walk. Adds a new file, utlock.c, that 
+implements the reader/writer lock mechanism. ACPICA BZ 749.
+
+Fixed a regression introduced in version 20090220 where a change to the FADT 
+handling could cause the ACPICA subsystem to access non-existent I/O ports.
+
+Modified the handling of FADT register and table (FACS/DSDT) addresses. The 
+FADT can contain both 32-bit and 64-bit versions of these addresses. 
+Previously, the 64-bit versions were favored, meaning that if both 32 and 64 
+versions were valid, but not equal, the 64-bit version was used. This was 
+found to cause some machines to fail. Now, in this case, the 32-bit version 
+is used instead. This now matches the Windows behavior.
+
+Implemented a new mechanism to protect certain I/O ports. Provides Microsoft 
+compatibility and protects the standard PC I/O ports from access via AML 
+code. Adds a new file, hwvalid.c
+
+Fixed a possible extraneous warning message from the FADT support. The 
+message warns of a 32/64 length mismatch between the legacy and GAS 
+definitions for a register.
+
+Removed the obsolete AcpiOsValidateAddress OSL interface. This interface is 
+made obsolete by the port protection mechanism above. It was previously used 
+to validate the entire address range of an operation region, which could be 
+incorrect if the range included illegal ports, but fields within the 
+operation region did not actually access those ports. Validation is now 
+performed on a per-field basis instead of the entire region.
+
+Modified the handling of the PM1 Status Register ignored bit (bit 11.) 
+Ignored bits must be "preserved" according to the ACPI spec. Usually, this 
+means a read/modify/write when writing to the register. However, for status 
+registers, writing a one means clear the event. Writing a zero means preserve 
+the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec, 
+and the ACPICA code now simply always writes a zero to the ignored bit.
+
+Modified the handling of ignored bits for the PM1 A/B Control Registers. As 
+per the ACPI specification, for the control registers, preserve 
+(read/modify/write) all bits that are defined as either reserved or ignored.
+
+Updated the handling of write-only bits in the PM1 A/B Control Registers. 
+When reading the register, zero the write-only bits as per the ACPI spec. 
+ACPICA BZ 443. Lin Ming.
+
+Removed "Linux" from the list of supported _OSI strings. Linux no longer 
+wants to reply true to this request. The Windows strings are the only paths 
+through the AML that are tested and known to work properly.
+
+  Previous Release:
+    Non-Debug Version:  82.0K Code, 17.5K Data,  99.5K Total
+    Debug Version:     156.9K Code, 49.8K Data, 206.7K Total
+  Current Release:
+    Non-Debug Version:  82.6K Code, 17.6K Data, 100.2K Total
+    Debug Version:     157.7K Code, 49.9K Data, 207.6K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+Acpiexec: Split the large aeexec.c file into two new files, aehandlers.c and 
+aetables.c
+
+----------------------------------------
+20 February 2009. Summary of changes for version 20090220:
+
+1) ACPI CA Core Subsystem:
+
+Optimized the ACPI register locking. Removed locking for reads from the ACPI 
+bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock is 
+not required when reading the single-bit registers. The 
+AcpiGetRegisterUnlocked function is no longer needed and has been removed. 
+This will improve performance for reads on these registers. ACPICA BZ 760.
+
+Fixed the parameter validation for AcpiRead/Write. Now return 
+AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if 
+the register has an address of zero. Previously, these cases simply returned 
+AE_OK. For optional registers such as PM1B status/enable/control, the caller 
+should check for a valid register address before calling. ACPICA BZ 748.
+
+Renamed the external ACPI bit register access functions. Renamed 
+AcpiGetRegister and AcpiSetRegister to clarify the purpose of these 
+functions. The new names are AcpiReadBitRegister and AcpiWriteBitRegister. 
+Also, restructured the code for these functions by simplifying the code path 
+and condensing duplicate code to reduce code size.
+
+Added new functions to transparently handle the possibly split PM1 A/B 
+registers. AcpiHwReadMultiple and AcpiHwWriteMultiple. These two functions 
+now handle the split registers for PM1 Status, Enable, and Control. ACPICA BZ 
+746.
+
+Added a function to handle the PM1 control registers, AcpiHwWritePm1Control. 
+This function writes both of the PM1 control registers (A/B). These registers 
+are different than the PM1 A/B status and enable registers in that different 
+values can be written to the A/B registers. Most notably, the SLP_TYP bits 
+can be different, as per the values returned from the _Sx predefined methods.
+
+Removed an extra register write within AcpiHwClearAcpiStatus. This function 
+was writing an optional PM1B status register twice. The existing call to the 
+low-level AcpiHwRegisterWrite automatically handles a possibly split PM1 A/B 
+register. ACPICA BZ 751.
+
+Split out the PM1 Status registers from the FADT. Added new globals for these 
+registers (A/B), similar to the way the PM1 Enable registers are handled. 
+Instead of overloading the FADT Event Register blocks. This makes the code 
+clearer and less prone to error.
+
+Fixed the warning message for when the platform contains too many ACPI tables 
+for the default size of the global root table data structure. The calculation 
+for the truncation value was incorrect.
+
+Removed the ACPI_GET_OBJECT_TYPE macro. Removed all instances of this 
+obsolete macro, since it is now a simple reference to ->common.type. There 
+were about 150 invocations of the macro across 41 files. ACPICA BZ 755.
+
+Removed the redundant ACPI_BITREG_SLEEP_TYPE_B. This type is the same as 
+TYPE_A. Removed this and all related instances. Renamed SLEEP_TYPE_A to 
+simply SLEEP_TYPE. ACPICA BZ 754.
+
+Conditionally compile the AcpiSetFirmwareWakingVector64 function. This 
+function is only needed on 64-bit host operating systems and is thus not 
+included for 32-bit hosts.
+
+Debug output: print the input and result for invocations of the _OSI reserved 
+control method via the ACPI_LV_INFO debug level. Also, reduced some of the 
+verbosity of this debug level. Len Brown.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  82.3K Code, 17.5K Data,  99.8K Total
+    Debug Version:     157.3K Code, 49.8K Data, 207.1K Total
+  Current Release:
+    Non-Debug Version:  82.0K Code, 17.5K Data,  99.5K Total
+    Debug Version:     156.9K Code, 49.8K Data, 206.7K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Decode the FADT PM_Profile field. Emit ascii names for the 
+various legal performance profiles.
+
+----------------------------------------
+23 January 2009. Summary of changes for version 20090123:
+
+1) ACPI CA Core Subsystem:
+
+Added the 2009 copyright to all module headers and signons. This affects 
+virtually every file in the ACPICA core subsystem, the iASL compiler, and 
+the tools/utilities.
+
+Implemented a change to allow the host to override any ACPI table, including 
+dynamically loaded tables. Previously, only the DSDT could be replaced by the 
+host. With this change, the AcpiOsTableOverride interface is called for each 
+table found in the RSDT/XSDT during ACPICA initialization, and also whenever 
+a table is dynamically loaded via the AML Load operator.
+
+Updated FADT flag definitions, especially the Boot Architecture flags.
+
+Debugger: For the Find command, automatically pad the input ACPI name with 
+underscores if the name is shorter than 4 characters. This enables a match 
+with the actual namespace entry which is itself padded with underscores.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  82.3K Code, 17.4K Data,  99.7K Total
+    Debug Version:     157.1K Code, 49.7K Data, 206.8K Total
+  Current Release:
+    Non-Debug Version:  82.3K Code, 17.5K Data,  99.8K Total
+    Debug Version:     157.3K Code, 49.8K Data, 207.1K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fix build error under Bison-2.4.
+
+Dissasembler: Enhanced FADT support. Added decoding of the Boot Architecture 
+flags. Now decode all flags, regardless of the FADT version. Flag output 
+includes the FADT version which first defined each flag.
+
+The iASL -g option now dumps the RSDT to a file (in addition to the FADT and 
+DSDT). Windows only.
+
+----------------------------------------
+04 December 2008. Summary of changes for version 20081204:
+
+1) ACPI CA Core Subsystem:
+
+The ACPICA Programmer Reference has been completely updated and revamped for 
+this release. This includes updates to the external interfaces, OSL 
+interfaces, the overview sections, and the debugger reference.
+
+Several new ACPICA interfaces have been implemented and documented in the 
+programmer reference:
+AcpiReset - Writes the reset value to the FADT-defined reset register.
+AcpiDisableAllGpes - Disable all available GPEs.
+AcpiEnableAllRuntimeGpes - Enable all available runtime GPEs.
+AcpiGetGpeDevice - Get the GPE block device associated with a GPE.
+AcpiGbl_CurrentGpeCount - Tracks the current number of available GPEs.
+AcpiRead - Low-level read ACPI register (was HwLowLevelRead.)
+AcpiWrite - Low-level write ACPI register (was HwLowLevelWrite.)
+
+Most of the public ACPI hardware-related interfaces have been moved to a new 
+file, components/hardware/hwxface.c
+
+Enhanced the FADT parsing and low-level ACPI register access: The ACPI 
+register lengths within the FADT are now used, and the low level ACPI 
+register access no longer hardcodes the ACPI register lengths. Given that 
+there may be some risk in actually trusting the FADT register lengths, a run-
+time option was added to fall back to the default hardcoded lengths if the 
+FADT proves to contain incorrect values - UseDefaultRegisterWidths. This 
+option is set to true for now, and a warning is issued if a suspicious FADT 
+register length is overridden with the default value.
+
+Fixed a reference count issue in NsRepairObject. This problem was introduced 
+in version 20081031 as part of a fix to repair Buffer objects within 
+Packages. Lin Ming.
+
+Added semaphore support to the Linux/Unix application OS-services layer 
+(OSL). ACPICA BZ 448. Lin Ming.
+
+Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes will 
+be implemented in the OSL, or will binary semaphores be used instead.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  81.7K Code, 17.3K Data,  99.0K Total
+    Debug Version:     156.4K Code, 49.4K Data, 205.8K Total
+  Current Release:
+    Non-Debug Version:  82.3K Code, 17.4K Data,  99.7K Total
+    Debug Version:     157.1K Code, 49.7K Data, 206.8K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Completed the '-e' option to include additional ACPI tables in order to 
+aid with disassembly and External statement generation. ACPICA BZ 742. Lin 
+Ming.
+
+iASL: Removed the "named object in while loop" error. The compiler cannot 
+determine how many times a loop will execute. ACPICA BZ 730.
+
+Disassembler: Implemented support for FADT revision 2 (MS extension). ACPICA 
+BZ 743.
+
+Disassembler: Updates for several ACPI data tables (HEST, EINJ, and MCFG).
+
+----------------------------------------
+31 October 2008. Summary of changes for version 20081031:
+
+1) ACPI CA Core Subsystem:
+
+Restructured the ACPICA header files into public/private. acpi.h now includes 
+only the "public" acpica headers. All other acpica headers are "private" and 
+should not be included by acpica users. One new file, accommon.h is used to 
+include the commonly used private headers for acpica code generation. Future 
+plans include moving all private headers to a new subdirectory.
+
+Implemented an automatic Buffer->String return value conversion for 
+predefined ACPI methods. For these methods (such as _BIF), added automatic 
+conversion for return objects that are required to be a String, but a Buffer 
+was found instead. This can happen when reading string battery data from an 
+operation region, because it used to be difficult to convert the data from 
+buffer to string from within the ASL. Ensures that the host OS is provided 
+with a valid null-terminated string. Linux BZ 11822.
+
+Updated the FACS waking vector interfaces. Split AcpiSetFirmwareWakingVector 
+into two: one for the 32-bit vector, another for the 64-bit vector. This is 
+required because the host OS must setup the wake much differently for each 
+vector (real vs. protected mode, etc.) and the interface itself should not be 
+deciding which vector to use. Also, eliminated the GetFirmwareWakingVector 
+interface, as it served no purpose (only the firmware reads the vector, OS 
+only writes the vector.) ACPICA BZ 731.
+
+Implemented a mechanism to escape infinite AML While() loops. Added a loop 
+counter to force exit from AML While loops if the count becomes too large. 
+This can occur in poorly written AML when the hardware does not respond 
+within a while loop and the loop does not implement a timeout. The maximum 
+loop count is configurable. A new exception code is returned when a loop is 
+broken, AE_AML_INFINITE_LOOP. Alexey Starikovskiy, Bob Moore.
+
+Optimized the execution of AML While loops. Previously, a control state 
+object was allocated and freed for each execution of the loop. The 
+optimization is to simply reuse the control state for each iteration. This 
+speeds up the raw loop execution time by about 5%.
+
+Enhanced the implicit return mechanism. For Windows compatibility, return an 
+implicit integer of value zero for methods that contain no executable code. 
+Such methods are seen in the field as stubs (presumably), and can cause 
+drivers to fail if they expect a return value. Lin Ming.
+
+Allow multiple backslashes as root prefixes in namepaths. In a fully 
+qualified namepath, allow multiple backslash prefixes. This can happen (and 
+is seen in the field) because of the use of a double-backslash in strings 
+(since backslash is the escape character) causing confusion. ACPICA BZ 739 
+Lin Ming.
+
+Emit a warning if two different FACS or DSDT tables are discovered in the 
+FADT. Checks if there are two valid but different addresses for the FACS and 
+DSDT within the FADT (mismatch between the 32-bit and 64-bit fields.)
+
+Consolidated the method argument count validation code. Merged the code that 
+validates control method argument counts into the predefined validation 
+module. Eliminates possible multiple warnings for incorrect argument counts.
+
+Implemented ACPICA example code. Includes code for ACPICA initialization, 
+handler installation, and calling a control method. Available at 
+source/tools/examples.
+
+Added a global pointer for FACS table to simplify internal FACS access. Use 
+the global pointer instead of using AcpiGetTableByIndex for each FACS access. 
+This simplifies the code for the Global Lock and the Firmware Waking 
+Vector(s).
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  81.2K Code, 17.0K Data,  98.2K Total
+    Debug Version:     155.8K Code, 49.1K Data, 204.9K Total
+  Current Release:
+    Non-Debug Version:  81.7K Code, 17.3K Data,  99.0K Total
+    Debug Version:     156.4K Code, 49.4K Data, 205.8K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Improved disassembly of external method calls. Added the -e option to 
+allow the inclusion of additional ACPI tables to help with the disassembly of 
+method invocations and the generation of external declarations during the 
+disassembly. Certain external method invocations cannot be disassembled 
+properly without the actual declaration of the method. Use the -e option to 
+include the table where the external method(s) are actually declared. Most 
+useful for disassembling SSDTs that make method calls back to the master 
+DSDT. Lin Ming. Example: To disassemble an SSDT with calls to DSDT:  iasl -d 
+-e dsdt.aml ssdt1.aml
+
+iASL: Fix to allow references to aliases within ASL namepaths. Fixes a 
+problem where the use of an alias within a namepath would result in a not 
+found error or cause the compiler to fault. Also now allows forward 
+references from the Alias operator itself. ACPICA BZ 738.
+
+----------------------------------------
+26 September 2008. Summary of changes for version 20080926:
+
+1) ACPI CA Core Subsystem:
+
+Designed and implemented a mechanism to validate predefined ACPI methods and 
+objects. This code validates the predefined ACPI objects (objects whose names 
+start with underscore) that appear in the namespace, at the time they are 
+evaluated. The argument count and the type of the returned object are 
+validated against the ACPI specification. The purpose of this validation is 
+to detect problems with the BIOS-implemented predefined ACPI objects before 
+the results are returned to the ACPI-related drivers. Future enhancements may 
+include actual repair of incorrect return objects where possible. Two new 
+files are nspredef.c and acpredef.h.
+
+Fixed a fault in the AML parser if a memory allocation fails during the Op 
+completion routine AcpiPsCompleteThisOp. Lin Ming. ACPICA BZ 492.
+
+Fixed an issue with implicit return compatibility. This change improves the 
+implicit return mechanism to be more compatible with the MS interpreter. Lin 
+Ming, ACPICA BZ 349.
+
+Implemented support for zero-length buffer-to-string conversions. Allow zero 
+length strings during interpreter buffer-to-string conversions. For example, 
+during the ToDecimalString and ToHexString operators, as well as implicit 
+conversions. Fiodor Suietov, ACPICA BZ 585.
+
+Fixed two possible memory leaks in the error exit paths of 
+AcpiUtUpdateObjectReference and AcpiUtWalkPackageTree. These functions are 
+similar in that they use a stack of state objects in order to eliminate 
+recursion. The stack must be fully unwound and deallocated if an error 
+occurs. Lin Ming. ACPICA BZ 383.
+
+Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the global 
+ACPI register table. This bit does not exist and is unused. Lin Ming, Bob 
+Moore ACPICA BZ 442.
+
+Removed the obsolete version number in module headers. Removed the 
+"$Revision" number that appeared in each module header. This version number 
+was useful under SourceSafe and CVS, but has no meaning under git. It is not 
+only incorrect, it could also be misleading.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  79.7K Code, 16.4K Data,  96.1K Total
+    Debug Version:     153.7K Code, 48.2K Data, 201.9K Total
+  Current Release:
+    Non-Debug Version:  81.2K Code, 17.0K Data,  98.2K Total
+    Debug Version:     155.8K Code, 49.1K Data, 204.9K Total
+
+----------------------------------------
 29 August 2008. Summary of changes for version 20080829:
 
 1) ACPI CA Core Subsystem:
@@ -168,28 +721,22 @@
 0) Git source tree / acpica.org
 
 Fixed a problem where a git-clone from http would not transfer the entire 
-source 
-tree.
+source tree.
 
 1) ACPI CA Core Subsystem:
 
 Implemented a "careful" GPE disable in AcpiEvDisableGpe, only modify one 
-enable 
-bit. Now performs a read-change-write of the enable register instead of 
-simply 
-writing out the cached enable mask. This will prevent inadvertent enabling of 
-GPEs if a rogue GPE is received during initialization (before GPE handlers 
-are 
-installed.)
+enable bit. Now performs a read-change-write of the enable register instead 
+of simply writing out the cached enable mask. This will prevent inadvertent 
+enabling of GPEs if a rogue GPE is received during initialization (before GPE 
+handlers are installed.)
 
 Implemented a copy for dynamically loaded tables. Previously, dynamically 
-loaded 
-tables were simply mapped - but on some machines this memory is corrupted 
-after 
-suspend. Now copy the table to a local buffer. For the OpRegion case, added 
-checksum verify. Use the table length from the table header, not the region 
-length. For the Buffer case, use the table length also. Dennis Noordsij, Bob 
-Moore. BZ 10734
+loaded tables were simply mapped - but on some machines this memory is 
+corrupted after suspend. Now copy the table to a local buffer. For the 
+OpRegion case, added checksum verify. Use the table length from the table 
+header, not the region length. For the Buffer case, use the table length 
+also. Dennis Noordsij, Bob Moore. BZ 10734
 
 Fixed a problem where the same ACPI table could not be dynamically loaded and 
 unloaded more than once. Without this change, a table cannot be loaded again 
@@ -198,24 +745,18 @@
 this no longer returns an exception. BZ 722
 
 Fixed a problem where the wrong descriptor length was calculated for the 
-EndTag 
-descriptor in 64-bit mode. The "minimal" descriptors such as EndTag are 
-calculated as 12 bytes long, but the actual length in the internal descriptor 
-is 
-16 because of the round-up to 8 on the 64-bit build. Reported by Linn 
-Crosetto. 
-BZ 728
+EndTag descriptor in 64-bit mode. The "minimal" descriptors such as EndTag 
+are calculated as 12 bytes long, but the actual length in the internal 
+descriptor is 16 because of the round-up to 8 on the 64-bit build. Reported 
+by Linn Crosetto. BZ 728
 
 Fixed a possible memory leak in the Unload operator. The DdbHandle returned 
-by 
-Load() did not have its reference count decremented during unload, leading to 
-a 
-memory leak. Lin Ming. BZ 727
+by Load() did not have its reference count decremented during unload, leading 
+to a memory leak. Lin Ming. BZ 727
 
 Fixed a possible memory leak when deleting thermal/processor objects. Any 
 associated notify handlers (and objects) were not being deleted. Fiodor 
-Suietov. 
-BZ 506
+Suietov. BZ 506
 
 Fixed the ordering of the ASCII names in the global mutex table to match the 
 actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug only. 
@@ -223,10 +764,8 @@
 
 Enhanced the AcpiGetObjectInfo interface to return the number of required 
 arguments if the object is a control method. Added this call to the debugger 
-so 
-the proper number of default arguments are passed to a method. This prevents 
-a 
-warning when executing methods from AcpiExec.
+so the proper number of default arguments are passed to a method. This 
+prevents a warning when executing methods from AcpiExec.
 
 Added a check for an invalid handle in AcpiGetObjectInfo. Return 
 AE_BAD_PARAMETER if input handle is invalid. BZ 474
@@ -235,9 +774,8 @@
 
 Example Code and Data Size: These are the sizes for the OS-independent 
 acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
-debug 
-version of the code includes the debug output trace mechanism and has a much 
-larger code and data size.
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
 
   Previous Release:
     Non-Debug Version:  79.3K Code, 16.2K Data,  95.5K Total
@@ -249,12 +787,10 @@
 2) iASL Compiler/Disassembler and Tools:
 
 iASL: Added two missing ACPI reserved names. Added _MTP and _ASZ, both 
-resource 
-descriptor names.
+resource descriptor names.
 
 iASL: Detect invalid ASCII characters in input (windows version). Removed the 
-"-
-CF" flag from the flex compile, enables correct detection of non-ASCII 
+"-CF" flag from the flex compile, enables correct detection of non-ASCII 
 characters in the input. BZ 441
 
 iASL: Eliminate warning when result of LoadTable is not used. Eliminate the 
@@ -263,14 +799,11 @@
 
 AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method to 
 pass address of table to the AML. Added option to disable OpRegion simulation 
-to 
-allow creation of an OpRegion with a real address that was passed to _CFG. 
-All 
-of this allows testing of the Load and Unload operators from AcpiExec.
+to allow creation of an OpRegion with a real address that was passed to _CFG. 
+All of this allows testing of the Load and Unload operators from AcpiExec.
 
 Debugger: update tables command for unloaded tables. Handle unloaded tables 
-and 
-use the standard table header output routine.
+and use the standard table header output routine.
 
 ----------------------------------------
 09 June 2008. Summary of changes for version 20080609:
--- a/usr/src/uts/intel/io/acpica/cmp_ca.sh	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/cmp_ca.sh	Fri Jun 26 17:26:34 2009 -0700
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #
@@ -28,7 +28,7 @@
 #
 # Set this to the fully-qualified path to the ACPI CA GIT directory
 #
-ACDIR=/export/home/myers/acpica/acpica-unix-20080829
+ACDIR=/export/home/myers/acpica/acpica-unix-20090521
 
 ACSRC=$ACDIR
 ACINC=$ACDIR/include
--- a/usr/src/uts/intel/io/acpica/debugger/dbcmds.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbcmds.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbcmds - debug commands and output routines
- *              $Revision: 1.157 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acnamesp.h"
 #include "acevents.h"
@@ -388,6 +388,228 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiDbWalkForPredefinedNames
+ *
+ * PARAMETERS:  Callback from WalkNamespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Detect and display predefined ACPI names (names that start with
+ *              an underscore)
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForPredefinedNames (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue)
+{
+    ACPI_NAMESPACE_NODE         *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+    UINT32                      *Count = (UINT32 *) Context;
+    const ACPI_PREDEFINED_INFO  *Predefined;
+    const ACPI_PREDEFINED_INFO  *Package = NULL;
+    char                        *Pathname;
+
+
+    Predefined = AcpiNsCheckForPredefinedName (Node);
+    if (!Predefined)
+    {
+        return (AE_OK);
+    }
+
+    Pathname = AcpiNsGetExternalPathname (Node);
+    if (!Pathname)
+    {
+        return (AE_OK);
+    }
+
+    /* If method returns a package, the info is in the next table entry */
+
+    if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
+    {
+        Package = Predefined + 1;
+    }
+
+    AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
+        Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
+
+    if (Package)
+    {
+        AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
+            Package->RetInfo.Type, Package->RetInfo.ObjectType1,
+            Package->RetInfo.Count1);
+    }
+
+    AcpiOsPrintf("\n");
+
+    AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
+    ACPI_FREE (Pathname);
+    (*Count)++;
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDbCheckPredefinedNames
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Validate all predefined names in the namespace
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCheckPredefinedNames (
+    void)
+{
+    UINT32                  Count = 0;
+
+
+    /* Search all nodes in namespace */
+
+    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                AcpiDbWalkForPredefinedNames, (void *) &Count, NULL);
+
+    AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDbWalkForExecute
+ *
+ * PARAMETERS:  Callback from WalkNamespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Batch execution module. Currently only executes predefined
+ *              ACPI names.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue)
+{
+    ACPI_NAMESPACE_NODE         *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+    UINT32                      *Count = (UINT32 *) Context;
+    const ACPI_PREDEFINED_INFO  *Predefined;
+    ACPI_BUFFER                 ReturnObj;
+    ACPI_STATUS                 Status;
+    char                        *Pathname;
+    ACPI_BUFFER             Buffer;
+    UINT32                  i;
+    ACPI_DEVICE_INFO        *ObjInfo;
+    ACPI_OBJECT_LIST        ParamObjects;
+    ACPI_OBJECT             Params[ACPI_METHOD_NUM_ARGS];
+
+
+    Predefined = AcpiNsCheckForPredefinedName (Node);
+    if (!Predefined)
+    {
+        return (AE_OK);
+    }
+
+    if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
+    {
+        return (AE_OK);
+    }
+
+    Pathname = AcpiNsGetExternalPathname (Node);
+    if (!Pathname)
+    {
+        return (AE_OK);
+    }
+
+    /* Get the object info for number of method parameters */
+
+    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+    Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    ParamObjects.Pointer = NULL;
+    ParamObjects.Count   = 0;
+
+    ObjInfo = Buffer.Pointer;
+    if (ObjInfo->Type == ACPI_TYPE_METHOD)
+    {
+
+        /* Setup default parameters */
+
+        for (i = 0; i < ObjInfo->ParamCount; i++)
+        {
+            Params[i].Type           = ACPI_TYPE_INTEGER;
+            Params[i].Integer.Value  = 1;
+        }
+
+        ParamObjects.Pointer     = Params;
+        ParamObjects.Count       = ObjInfo->ParamCount;
+    }
+
+    ACPI_FREE (Buffer.Pointer);
+
+    ReturnObj.Pointer = NULL;
+    ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+
+    /* Do the actual method execution */
+
+    AcpiGbl_MethodExecuting = TRUE;
+
+    Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
+
+    AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
+    AcpiGbl_MethodExecuting = FALSE;
+
+    ACPI_FREE (Pathname);
+    (*Count)++;
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDbBatchExecute
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Namespace batch execution.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbBatchExecute (
+    void)
+{
+    UINT32                  Count = 0;
+
+
+    /* Search all nodes in namespace */
+
+    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                AcpiDbWalkForExecute, (void *) &Count, NULL);
+
+    AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiDbDisplayLocks
  *
  * PARAMETERS:  None
@@ -433,6 +655,7 @@
 {
     UINT32                  i;
     ACPI_TABLE_DESC         *TableDesc;
+    ACPI_STATUS             Status;
 
 
     /* Walk the entire root table list */
@@ -444,7 +667,11 @@
 
         /* Make sure that the table is mapped */
 
-        AcpiTbVerifyTable (TableDesc);
+        Status = AcpiTbVerifyTable (TableDesc);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
 
         /* Dump the table header */
 
@@ -1172,6 +1399,9 @@
 AcpiDbFindNameInNamespace (
     char                    *NameArg)
 {
+    char                    AcpiName[5] = "____";
+    char                    *AcpiNamePtr = AcpiName;
+
 
     if (ACPI_STRLEN (NameArg) > 4)
     {
@@ -1179,11 +1409,20 @@
         return (AE_OK);
     }
 
-    /* Walk the namespace from the root */
+    /* Pad out name with underscores as necessary to create a 4-char name */
 
     AcpiUtStrupr (NameArg);
+    while (*NameArg)
+    {
+        *AcpiNamePtr = *NameArg;
+        AcpiNamePtr++;
+        NameArg++;
+    }
+
+    /* Walk the namespace from the root */
+
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                        AcpiDbWalkAndMatchName, NameArg, NULL);
+                        AcpiDbWalkAndMatchName, AcpiName, NULL);
 
     AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
     return (AE_OK);
--- a/usr/src/uts/intel/io/acpica/debugger/dbdisply.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbdisply.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbdisply - debug display commands
- *              $Revision: 1.121 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdispat.h"
 #include "acnamesp.h"
--- a/usr/src/uts/intel/io/acpica/debugger/dbexec.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbexec.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbexec - debugger control method execution
- *              $Revision: 1.83 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 #include "acnamesp.h"
 
@@ -551,25 +551,47 @@
 {
     ACPI_STATUS             Status;
     ACPI_DB_METHOD_INFO     *Info = Context;
+    ACPI_DB_METHOD_INFO     LocalInfo;
     UINT32                  i;
     UINT8                   Allow;
     ACPI_BUFFER             ReturnObj;
 
 
+    /*
+     * AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments.
+     * Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads
+     * concurrently.
+     *
+     * Note: The arguments we are passing are used by the ASL test suite
+     * (aslts). Do not change them without updating the tests.
+     */
+    (void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER);
+
     if (Info->InitArgs)
     {
         AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
-        AcpiDbUInt32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr);
+        AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()),
+            Info->IdOfThreadStr);
     }
 
     if (Info->Threads && (Info->NumCreated < Info->NumThreads))
     {
-        Info->Threads[Info->NumCreated++] = (UINT32) AcpiOsGetThreadId();
+        Info->Threads[Info->NumCreated++] =
+            ACPI_TO_INTEGER (AcpiOsGetThreadId());
     }
 
+    LocalInfo = *Info;
+    LocalInfo.Args = LocalInfo.Arguments;
+    LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr;
+    LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr;
+    LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr;
+    LocalInfo.Arguments[3] = NULL;
+
+    (void) AcpiOsSignalSemaphore (Info->InfoGate, 1);
+
     for (i = 0; i < Info->NumLoops; i++)
     {
-        Status = AcpiDbExecuteMethod (Info, &ReturnObj);
+        Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj);
         if (ACPI_FAILURE (Status))
         {
             AcpiOsPrintf ("%s During execution of %s at iteration %X\n",
@@ -648,6 +670,8 @@
     UINT32                  Size;
     ACPI_MUTEX              MainThreadGate;
     ACPI_MUTEX              ThreadCompleteGate;
+    ACPI_MUTEX              InfoGate;
+
 
     /* Get the arguments */
 
@@ -686,6 +710,16 @@
         return;
     }
 
+    Status = AcpiOsCreateSemaphore (1, 1, &InfoGate);
+    if (ACPI_FAILURE (Status))
+    {
+        AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n",
+            AcpiFormatException (Status));
+        (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+        (void) AcpiOsDeleteSemaphore (MainThreadGate);
+        return;
+    }
+
     ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
 
     /* Array to store IDs of threads */
@@ -698,6 +732,7 @@
         AcpiOsPrintf ("No memory for thread IDs array\n");
         (void) AcpiOsDeleteSemaphore (MainThreadGate);
         (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+        (void) AcpiOsDeleteSemaphore (InfoGate);
         return;
     }
     ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);
@@ -709,6 +744,7 @@
     AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
     AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;
     AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;
+    AcpiGbl_DbMethodInfo.InfoGate = InfoGate;
 
     /* Init arguments to be passed to method */
 
@@ -749,6 +785,7 @@
 
     (void) AcpiOsDeleteSemaphore (MainThreadGate);
     (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+    (void) AcpiOsDeleteSemaphore (InfoGate);
 
     AcpiOsFree (AcpiGbl_DbMethodInfo.Threads);
     AcpiGbl_DbMethodInfo.Threads = NULL;
--- a/usr/src/uts/intel/io/acpica/debugger/dbfileio.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbfileio.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: dbfileio - Debugger file I/O commands. These can't usually
  *              be used when running the debugger in Ring 0 (Kernel mode)
- *              $Revision: 1.96 $
  *
  ******************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 
 #ifdef ACPI_APPLICATION
--- a/usr/src/uts/intel/io/acpica/debugger/dbhistry.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbhistry.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dbhistry - debugger HISTORY command
- *              $Revision: 1.35 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 
 #ifdef ACPI_DEBUGGER
--- a/usr/src/uts/intel/io/acpica/debugger/dbinput.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbinput.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbinput - user front-end to the AML debugger
- *              $Revision: 1.116 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 
 
@@ -160,6 +160,7 @@
     CMD_ALLOCATIONS,
     CMD_ARGS,
     CMD_ARGUMENTS,
+    CMD_BATCH,
     CMD_BREAKPOINT,
     CMD_BUSINFO,
     CMD_CALL,
@@ -194,6 +195,7 @@
     CMD_OBJECT,
     CMD_OPEN,
     CMD_OWNER,
+    CMD_PREDEFINED,
     CMD_PREFIX,
     CMD_QUIT,
     CMD_REFERENCES,
@@ -214,6 +216,9 @@
 
 #define CMD_FIRST_VALID     2
 
+
+/* Second parameter is the required argument count */
+
 static const COMMAND_INFO       AcpiGbl_DbCommands[] =
 {
     {"<NOT FOUND>",  0},
@@ -221,6 +226,7 @@
     {"ALLOCATIONS",  0},
     {"ARGS",         0},
     {"ARGUMENTS",    0},
+    {"BATCH",        0},
     {"BREAKPOINT",   1},
     {"BUSINFO",      0},
     {"CALL",         0},
@@ -255,6 +261,7 @@
     {"OBJECT",       1},
     {"OPEN",         1},
     {"OWNER",        1},
+    {"PREDEFINED",   0},
     {"PREFIX",       0},
     {"QUIT",         0},
     {"REFERENCES",   1},
@@ -360,6 +367,7 @@
         AcpiOsPrintf ("Notify <Object> <Value>             Send a notification on Object\n");
         AcpiOsPrintf ("Objects <ObjectType>                Display all objects of the given type\n");
         AcpiOsPrintf ("Owner <OwnerId> [Depth]             Display loaded namespace by object owner\n");
+        AcpiOsPrintf ("Predefined                          Check all predefined names\n");
         AcpiOsPrintf ("Prefix [<NamePath>]                 Set or Get current execution prefix\n");
         AcpiOsPrintf ("References <Addr>                   Find all references to object at addr\n");
         AcpiOsPrintf ("Resources <Device>                  Get and display Device resources\n");
@@ -635,6 +643,10 @@
         AcpiDbDisplayArguments ();
         break;
 
+    case CMD_BATCH:
+        AcpiDbBatchExecute ();
+        break;
+
     case CMD_BREAKPOINT:
         AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
         break;
@@ -812,6 +824,10 @@
         AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
         break;
 
+    case CMD_PREDEFINED:
+        AcpiDbCheckPredefinedNames ();
+        break;
+
     case CMD_PREFIX:
         AcpiDbSetScope (AcpiGbl_DbArgs[1]);
         break;
--- a/usr/src/uts/intel/io/acpica/debugger/dbstats.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbstats.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbstats - Generation and display of ACPI table statistics
- *              $Revision: 1.90 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 #include "acnamesp.h"
 
@@ -276,18 +276,18 @@
 
     AcpiGbl_NumObjects++;
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX)
+    if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
     {
         AcpiGbl_ObjTypeCountMisc++;
     }
     else
     {
-        AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
+        AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
     }
 
     /* Count the sub-objects */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_PACKAGE:
 
--- a/usr/src/uts/intel/io/acpica/debugger/dbutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbutils - AML debugger utilities
- *              $Revision: 1.87 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acdebug.h"
 #include "acdisasm.h"
--- a/usr/src/uts/intel/io/acpica/debugger/dbxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/debugger/dbxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dbxface - AML Debugger external interfaces
- *              $Revision: 1.79 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdebug.h"
 #include "acdisasm.h"
@@ -563,10 +563,6 @@
     void)
 {
 
-    if (AcpiGbl_DbTablePtr)
-    {
-        AcpiOsFree (AcpiGbl_DbTablePtr);
-    }
     if (AcpiGbl_DbBuffer)
     {
         AcpiOsFree (AcpiGbl_DbBuffer);
--- a/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmbuffer.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmbuffer - AML disassembler, buffer and string support
- *              $Revision: 1.26 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdisasm.h"
 #include "acparser.h"
 #include "amlcode.h"
@@ -132,6 +132,10 @@
 AcpiDmUnicode (
     ACPI_PARSE_OBJECT       *Op);
 
+static void
+AcpiDmIsEisaIdElement (
+    ACPI_PARSE_OBJECT       *Op);
+
 
 /*******************************************************************************
  *
@@ -452,7 +456,7 @@
  *
  ******************************************************************************/
 
-void
+static void
 AcpiDmIsEisaIdElement (
     ACPI_PARSE_OBJECT       *Op)
 {
--- a/usr/src/uts/intel/io/acpica/disassembler/dmnames.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmnames.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmnames - AML disassembler, names, namestrings, pathnames
- *              $Revision: 1.19 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acnamesp.h"
@@ -159,7 +159,7 @@
 
     /* Copy name locally in case the original name is not writeable */
 
-    *(UINT32 *) NewName = Name;
+    *ACPI_CAST_PTR (UINT32, &NewName[0]) = Name;
 
     /* Ensure that the name is printable, even if we have to fix it */
 
--- a/usr/src/uts/intel/io/acpica/disassembler/dmobject.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmobject.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmobject - ACPI object decode and display
- *              $Revision: 1.24 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acdisasm.h"
 
@@ -278,7 +278,7 @@
 
     AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
@@ -416,7 +416,7 @@
 
     case ACPI_DESC_TYPE_OPERAND:
 
-        Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+        Type = ObjDesc->Common.Type;
         if (Type > ACPI_TYPE_LOCAL_MAX)
         {
             AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
@@ -425,7 +425,7 @@
 
         /* Decode the ACPI object type */
 
-        switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+        switch (ObjDesc->Common.Type)
         {
         case ACPI_TYPE_LOCAL_REFERENCE:
 
--- a/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmopcode.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmopcode - AML disassembler, specific AML opcodes
- *              $Revision: 1.106 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,6 +114,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdisasm.h"
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmresrc.c - Resource Descriptor disassembly
- *              $Revision: 1.36 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdisasm.h"
 
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
- *              $Revision: 1.38 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdisasm.h"
 
 
@@ -1026,7 +1026,7 @@
      */
     AcpiDmResourceSource (Resource,
         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
-            (Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
+            ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
         Resource->ExtendedIrq.ResourceLength);
 
     /* Insert a descriptor name */
--- a/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
- *              $Revision: 1.17 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdisasm.h"
 
 
--- a/usr/src/uts/intel/io/acpica/disassembler/dmutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmutils - AML disassembler utilities
- *              $Revision: 1.26 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdisasm.h"
 
--- a/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/disassembler/dmwalk.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dmwalk - AML disassembly tree walk
- *              $Revision: 1.35 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdisasm.h"
@@ -148,6 +148,69 @@
 AcpiDmBlockType (
     ACPI_PARSE_OBJECT       *Op);
 
+static const char *
+AcpiDmGetObjectTypeName (
+    ACPI_OBJECT_TYPE        Type);
+
+/*
+ * This table maps ACPI_OBJECT_TYPEs to the corresponding ASL
+ * ObjectTypeKeyword. Used to generate typed external declarations
+ */
+static const char           *AcpiGbl_DmTypeNames[] =
+{
+    /* 00 */ "",                    /* Type ANY */
+    /* 01 */ ", IntObj",
+    /* 02 */ ", StrObj",
+    /* 03 */ ", BuffObj",
+    /* 04 */ ", PkgObj",
+    /* 05 */ ", FieldUnitObj",
+    /* 06 */ ", DeviceObj",
+    /* 07 */ ", EventObj",
+    /* 08 */ ", MethodObj",
+    /* 09 */ ", MutexObj",
+    /* 10 */ ", OpRegionObj",
+    /* 11 */ ", PowerResObj",
+    /* 12 */ ", ProcessorObj",
+    /* 13 */ ", ThermalZoneObj",
+    /* 14 */ ", BuffFieldObj",
+    /* 15 */ ", DDBHandleObj",
+    /* 16 */ "",                    /* Debug object */
+    /* 17 */ ", FieldUnitObj",
+    /* 18 */ ", FieldUnitObj",
+    /* 19 */ ", FieldUnitObj"
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmGetObjectTypeName
+ *
+ * PARAMETERS:  Type        - An ACPI_OBJECT_TYPE
+ *
+ * RETURN:      Pointer to a string
+ *
+ * DESCRIPTION: Map an object type to the ASL object type string.
+ *
+ ******************************************************************************/
+
+static const char *
+AcpiDmGetObjectTypeName (
+    ACPI_OBJECT_TYPE        Type)
+{
+
+    if (Type == ACPI_TYPE_LOCAL_SCOPE)
+    {
+        Type = ACPI_TYPE_DEVICE;
+    }
+
+    else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
+    {
+        return ("");
+    }
+
+    return (AcpiGbl_DmTypeNames[Type]);
+}
+
 
 /*******************************************************************************
  *
@@ -499,28 +562,9 @@
                  */
                 while (AcpiGbl_ExternalList)
                 {
-                    AcpiOsPrintf ("    External (%s",
-                        AcpiGbl_ExternalList->Path);
-
-                    /* TBD: should be a lookup table */
-
-                    switch (AcpiGbl_ExternalList->Type)
-                    {
-                    case ACPI_TYPE_DEVICE:
-                        AcpiOsPrintf (", DeviceObj");
-                        break;
-
-                    case ACPI_TYPE_METHOD:
-                        AcpiOsPrintf (", MethodObj");
-                        break;
-
-                    case ACPI_TYPE_INTEGER:
-                        AcpiOsPrintf (", IntObj");
-                        break;
-
-                    default:
-                        break;
-                    }
+                    AcpiOsPrintf ("    External (%s%s",
+                        AcpiGbl_ExternalList->Path,
+                        AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
 
                     if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
                     {
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsfield.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dsfield - Dispatcher field routines
- *              $Revision: 1.87 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSFIELD_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdispat.h"
 #include "acinterp.h"
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsinit.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dsinit - Object initialization namespace walk
- *              $Revision: 1.29 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSINIT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acnamesp.h"
 #include "actables.h"
@@ -272,12 +272,23 @@
 
     /* Walk entire namespace from the supplied root */
 
-    Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
-                    AcpiDsInitOneObject, &Info, NULL);
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /*
+     * We don't use AcpiWalkNamespace since we do not want to acquire
+     * the namespace reader lock.
+     */
+    Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
+                ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
     }
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 
     Status = AcpiGetTableByIndex (TableIndex, &Table);
     if (ACPI_FAILURE (Status))
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsmethod.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- *              $Revision: 1.140 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSMETHOD_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdispat.h"
 #include "acinterp.h"
@@ -520,6 +520,10 @@
     if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
     {
         Status = ObjDesc->Method.Implementation (NextWalkState);
+        if (Status == AE_OK)
+        {
+            Status = AE_CTRL_TERMINATE;
+        }
     }
 
     return_ACPI_STATUS (Status);
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsmthdat.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dsmthdat - control method arguments and local variables
- *              $Revision: 1.94 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSMTHDAT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acnamesp.h"
 #include "acinterp.h"
@@ -262,8 +262,6 @@
         }
     }
 
-    AcpiDsClearImplicitReturn (WalkState);
-
     return_VOID;
 }
 
@@ -841,7 +839,7 @@
 
     /* Get the object type */
 
-    return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
+    return_VALUE (Object->Type);
 }
 #endif
 
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsobject.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dsobject - Dispatcher object management routines
- *              $Revision: 1.140 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSOBJECT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -661,7 +661,7 @@
 
     /* Re-type the object according to its argument */
 
-    Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+    Node->Type = ObjDesc->Common.Type;
 
     /* Attach obj to node */
 
@@ -719,7 +719,7 @@
 
     /* Perform per-object initialization */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_BUFFER:
 
@@ -841,7 +841,7 @@
 
             /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
 
-            ObjDesc->Reference.Value = Opcode - AML_LOCAL_OP;
+            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP;
             ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
@@ -857,7 +857,7 @@
 
             /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
 
-            ObjDesc->Reference.Value = Opcode - AML_ARG_OP;
+            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP;
             ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
@@ -900,7 +900,7 @@
     default:
 
         ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
-            ACPI_GET_OBJECT_TYPE (ObjDesc)));
+            ObjDesc->Common.Type));
 
         Status = AE_AML_OPERAND_TYPE;
         break;
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsopcode.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: dsopcode - Dispatcher Op Region support and handling of
  *                         "control" opcodes
- *              $Revision: 1.115 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __DSOPCODE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -507,28 +507,6 @@
 
     Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
                 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    /* Validate the region address/length via the host OS */
-
-    Status = AcpiOsValidateAddress (ObjDesc->Region.SpaceId,
-                ObjDesc->Region.Address, (ACPI_SIZE) ObjDesc->Region.Length);
-    if (ACPI_FAILURE (Status))
-    {
-        /*
-         * Invalid address/length. We will emit an error message and mark
-         * the region as invalid, so that it will cause an additional error if
-         * it is ever used. Then return AE_OK.
-         */
-        ACPI_EXCEPTION ((AE_INFO, Status,
-            "During address validation of OpRegion [%4.4s]", Node->Name.Ascii));
-        ObjDesc->Common.Flags |= AOPOBJ_INVALID;
-        Status = AE_OK;
-    }
-
     return_ACPI_STATUS (Status);
 }
 
@@ -600,7 +578,7 @@
 
     /* Host object must be a Buffer */
 
-    if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
+    if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
     {
         ACPI_ERROR ((AE_INFO,
             "Target of Create Field is not a Buffer object - %s",
@@ -1303,8 +1281,27 @@
 
     switch (Op->Common.AmlOpcode)
     {
+    case AML_WHILE_OP:
+
+        /*
+         * If this is an additional iteration of a while loop, continue.
+         * There is no need to allocate a new control state.
+         */
+        if (WalkState->ControlState)
+        {
+            if (WalkState->ControlState->Control.AmlPredicateStart ==
+                (WalkState->ParserState.Aml - 1))
+            {
+                /* Reset the state to start-of-loop */
+
+                WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
+                break;
+            }
+        }
+
+        /*lint -fallthrough */
+
     case AML_IF_OP:
-    case AML_WHILE_OP:
 
         /*
          * IF/WHILE: Create a new control state to manage these
@@ -1412,21 +1409,41 @@
 
         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
 
-        if (WalkState->ControlState->Common.Value)
+        ControlState = WalkState->ControlState;
+        if (ControlState->Common.Value)
         {
-            /* Predicate was true, go back and evaluate it again! */
+            /* Predicate was true, the body of the loop was just executed */
 
+            /*
+             * This loop counter mechanism allows the interpreter to escape
+             * possibly infinite loops. This can occur in poorly written AML
+             * when the hardware does not respond within a while loop and the
+             * loop does not implement a timeout.
+             */
+            ControlState->Control.LoopCount++;
+            if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
+            {
+                Status = AE_AML_INFINITE_LOOP;
+                break;
+            }
+
+            /*
+             * Go back and evaluate the predicate and maybe execute the loop
+             * another time
+             */
             Status = AE_CTRL_PENDING;
+            WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
+            break;
         }
 
+        /* Predicate was false, terminate this while loop */
+
         ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
             "[WHILE_OP] termination! Op=%p\n",Op));
 
         /* Pop this control state and free it */
 
         ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
-
-        WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
         AcpiUtDeleteGenericState (ControlState);
         break;
 
@@ -1489,7 +1506,7 @@
              * Allow references created by the Index operator to return unchanged.
              */
             if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
-                (ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
+                ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
                 ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
             {
                 Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
@@ -1534,12 +1551,20 @@
 
     case AML_BREAK_POINT_OP:
 
-        /* Call up to the OS service layer to handle this */
+        /*
+         * Set the single-step flag. This will cause the debugger (if present)
+         * to break to the console within the AML debugger at the start of the
+         * next AML instruction.
+         */
+        ACPI_DEBUGGER_EXEC (
+            AcpiGbl_CmSingleStep = TRUE);
+        ACPI_DEBUGGER_EXEC (
+            AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
 
-        Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
+        /* Call to the OSL in case OS wants a piece of the action */
 
-        /* If and when it returns, all done. */
-
+        Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
+                    "Executed AML Breakpoint opcode");
         break;
 
 
--- a/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dsutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: dsutils - Dispatcher utilities
- *              $Revision: 1.127 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSUTILS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -953,7 +953,7 @@
         goto PushResult;
     }
 
-    Type = ACPI_GET_OBJECT_TYPE (*Operand);
+    Type = (*Operand)->Common.Type;
 
     Status = AcpiExResolveToValue (Operand, WalkState);
     if (ACPI_FAILURE (Status))
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswexec.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: dswexec - Dispatcher method execution callbacks;
  *                        dispatch to interpreter.
- *              $Revision: 1.138 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __DSWEXEC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -224,11 +224,11 @@
         goto Cleanup;
     }
 
-    if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
+    if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
     {
         ACPI_ERROR ((AE_INFO,
             "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
-            ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
+            ObjDesc, WalkState, ObjDesc->Common.Type));
 
         Status = AE_AML_OPERAND_TYPE;
         goto Cleanup;
@@ -256,6 +256,10 @@
         Status = AE_CTRL_FALSE;
     }
 
+    /* Predicate can be used for an implicit return value */
+
+    (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
+
 
 Cleanup:
 
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswload.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswload.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dswload - Dispatcher namespace load callbacks
- *              $Revision: 1.120 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSWLOAD_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acdispat.h"
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dswscope - Scope stack manipulation
- *              $Revision: 1.70 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __DSWSCOPE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 
 
--- a/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/dispatcher/dswstate.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: dswstate - Dispatcher parse tree walk management routines
- *              $Revision: 1.105 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __DSWSTATE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "acnamesp.h"
@@ -189,7 +189,7 @@
     /* Return object of the top element and clean that top element result stack */
 
     WalkState->ResultCount--;
-    Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
+    Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
 
     *Object = State->Results.ObjDesc [Index];
     if (!*Object)
@@ -284,7 +284,7 @@
 
     /* Assign the address of object to the top free element of result stack */
 
-    Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
+    Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
     State->Results.ObjDesc [Index] = Object;
     WalkState->ResultCount++;
 
--- a/usr/src/uts/intel/io/acpica/events/evevent.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evevent.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evevent - Fixed Event handling and dispatch
- *              $Revision: 1.127 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,6 +114,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_EVENTS
@@ -155,8 +155,8 @@
 
     /*
      * Initialize the Fixed and General Purpose Events. This is done prior to
-     * enabling SCIs to prevent interrupts from occurring before the handlers are
-     * installed.
+     * enabling SCIs to prevent interrupts from occurring before the handlers
+     * are installed.
      */
     Status = AcpiEvFixedEventInitialize ();
     if (ACPI_FAILURE (Status))
@@ -281,7 +281,7 @@
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Install the fixed event handlers and enable the fixed events.
+ * DESCRIPTION: Install the fixed event handlers and disable all fixed events.
  *
  ******************************************************************************/
 
@@ -294,20 +294,21 @@
 
 
     /*
-     * Initialize the structure that keeps track of fixed event handlers
-     * and enable the fixed events.
+     * Initialize the structure that keeps track of fixed event handlers and
+     * enable the fixed events.
      */
     for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
     {
         AcpiGbl_FixedEventHandlers[i].Handler = NULL;
         AcpiGbl_FixedEventHandlers[i].Context = NULL;
 
-        /* Enable the fixed event */
+        /* Disable the fixed event */
 
         if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
         {
-            Status = AcpiSetRegister (
-                        AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0);
+            Status = AcpiWriteBitRegister (
+                        AcpiGbl_FixedEventInfo[i].EnableRegisterId,
+                        ACPI_DISABLE_EVENT);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -346,7 +347,7 @@
 
     /*
      * Read the fixed feature status and enable registers, as all the cases
-     * depend on their values.  Ignore errors here.
+     * depend on their values. Ignore errors here.
      */
     (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
     (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
@@ -399,15 +400,19 @@
 
     /* Clear the status bit */
 
-    (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
+    (void) AcpiWriteBitRegister (
+            AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+            ACPI_CLEAR_STATUS);
 
     /*
-     * Make sure we've got a handler.  If not, report an error.
-     * The event is disabled to prevent further interrupts.
+     * Make sure we've got a handler. If not, report an error. The event is
+     * disabled to prevent further interrupts.
      */
     if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
     {
-        (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
+        (void) AcpiWriteBitRegister (
+                AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+                ACPI_DISABLE_EVENT);
 
         ACPI_ERROR ((AE_INFO,
             "No installed handler for fixed event [%08X]",
@@ -419,7 +424,7 @@
     /* Invoke the Fixed Event handler */
 
     return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
-                                AcpiGbl_FixedEventHandlers[Event].Context));
+                AcpiGbl_FixedEventHandlers[Event].Context));
 }
 
 
--- a/usr/src/uts/intel/io/acpica/events/evgpe.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evgpe.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evgpe - General Purpose Event handling and dispatch
- *              $Revision: 1.72 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,6 +114,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 
@@ -173,10 +173,10 @@
 
     Status = AcpiEvDisableGpe (GpeEventInfo);
 
-    /* Type was validated above */
+    /* Clear the type bits and insert the new Type */
 
-    GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
-    GpeEventInfo->Flags |= Type;                /* Insert type */
+    GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
+    GpeEventInfo->Flags |= Type;
     return_ACPI_STATUS (Status);
 }
 
@@ -212,10 +212,11 @@
     {
         return_ACPI_STATUS (AE_NOT_EXIST);
     }
+
     RegisterBit = (UINT8)
         (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
 
-    /* 1) Disable case.  Simply clear all enable bits */
+    /* 1) Disable case. Simply clear all enable bits */
 
     if (Type == ACPI_GPE_DISABLE)
     {
@@ -224,7 +225,7 @@
         return_ACPI_STATUS (AE_OK);
     }
 
-    /* 2) Enable case.  Set/Clear the appropriate enable bits */
+    /* 2) Enable case. Set/Clear the appropriate enable bits */
 
     switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
     {
@@ -406,10 +407,10 @@
  *
  * FUNCTION:    AcpiEvGetGpeEventInfo
  *
- * PARAMETERS:  GpeDevice           - Device node.  NULL for GPE0/GPE1
+ * PARAMETERS:  GpeDevice           - Device node. NULL for GPE0/GPE1
  *              GpeNumber           - Raw GPE number
  *
- * RETURN:      A GPE EventInfo struct.  NULL if not a valid GPE
+ * RETURN:      A GPE EventInfo struct. NULL if not a valid GPE
  *
  * DESCRIPTION: Returns the EventInfo struct associated with this GPE.
  *              Validates the GpeBlock and the GpeNumber
@@ -488,7 +489,7 @@
  *
  * RETURN:      INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
  *
- * DESCRIPTION: Detect if any GP events have occurred.  This function is
+ * DESCRIPTION: Detect if any GP events have occurred. This function is
  *              executed at interrupt level.
  *
  ******************************************************************************/
@@ -520,8 +521,8 @@
 
     /*
      * We need to obtain the GPE lock for both the data structs and registers
-     * Note: Not necessary to obtain the hardware lock, since the GPE registers
-     * are owned by the GpeLock.
+     * Note: Not necessary to obtain the hardware lock, since the GPE
+     * registers are owned by the GpeLock.
      */
     Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
 
@@ -531,9 +532,8 @@
     while (GpeBlock)
     {
         /*
-         * Read all of the 8-bit GPE status and enable registers
-         * in this GPE block, saving all of them.
-         * Find all currently active GP events.
+         * Read all of the 8-bit GPE status and enable registers in this GPE
+         * block, saving all of them. Find all currently active GP events.
          */
         for (i = 0; i < GpeBlock->RegisterCount; i++)
         {
@@ -543,8 +543,7 @@
 
             /* Read the Status Register */
 
-            Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &StatusReg,
-                        &GpeRegisterInfo->StatusAddress);
+            Status = AcpiRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
             if (ACPI_FAILURE (Status))
             {
                 goto UnlockAndExit;
@@ -552,8 +551,7 @@
 
             /* Read the Enable Register */
 
-            Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableReg,
-                        &GpeRegisterInfo->EnableAddress);
+            Status = AcpiRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
             if (ACPI_FAILURE (Status))
             {
                 goto UnlockAndExit;
@@ -586,7 +584,8 @@
                      * or method.
                      */
                     IntStatus |= AcpiEvGpeDispatch (
-                        &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j],
+                        &GpeBlock->EventInfo[((ACPI_SIZE) i *
+                            ACPI_GPE_REGISTER_WIDTH) + j],
                         j + GpeRegisterInfo->BaseGpeNumber);
                 }
             }
@@ -660,8 +659,8 @@
     (void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
 
     /*
-     * Take a snapshot of the GPE info for this level - we copy the
-     * info to prevent a race condition with RemoveHandler/RemoveBlock.
+     * Take a snapshot of the GPE info for this level - we copy the info to
+     * prevent a race condition with RemoveHandler/RemoveBlock.
      */
     ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
         sizeof (ACPI_GPE_EVENT_INFO));
@@ -673,8 +672,8 @@
     }
 
     /*
-     * Must check for control method type dispatch one more
-     * time to avoid race with EvGpeInstallHandler
+     * Must check for control method type dispatch one more time to avoid a
+     * race with EvGpeInstallHandler
      */
     if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
             ACPI_GPE_DISPATCH_METHOD)
@@ -744,8 +743,8 @@
             ACPI_GPE_LEVEL_TRIGGERED)
     {
         /*
-         * GPE is level-triggered, we clear the GPE status bit after
-         * handling the event.
+         * GPE is level-triggered, we clear the GPE status bit after handling
+         * the event.
          */
         Status = AcpiHwClearGpe (GpeEventInfo);
         if (ACPI_FAILURE (Status))
@@ -794,7 +793,7 @@
     AcpiGpeCount++;
 
     /*
-     * If edge-triggered, clear the GPE status bit now.  Note that
+     * If edge-triggered, clear the GPE status bit now. Note that
      * level-triggered events are cleared after the GPE is serviced.
      */
     if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
@@ -822,7 +821,8 @@
 
         /*
          * Invoke the installed handler (at interrupt level)
-         * Ignore return status for now.  TBD: leave GPE disabled on error?
+         * Ignore return status for now.
+         * TBD: leave GPE disabled on error?
          */
         (void) GpeEventInfo->Dispatch.Handler->Address (
                         GpeEventInfo->Dispatch.Handler->Context);
@@ -879,7 +879,7 @@
             GpeNumber));
 
         /*
-         * Disable the GPE. The GPE will remain disabled until the ACPI
+         * Disable the GPE. The GPE will remain disabled until the ACPICA
          * Core Subsystem is restarted, or a handler is installed.
          */
         Status = AcpiEvDisableGpe (GpeEventInfo);
--- a/usr/src/uts/intel/io/acpica/events/evgpeblk.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evgpeblk.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evgpeblk - GPE block creation and initialization.
- *              $Revision: 1.62 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,6 +114,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 
@@ -194,7 +194,8 @@
         while (GpeBlock)
         {
             if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
-                (&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
+                (&GpeBlock->EventInfo[((ACPI_SIZE)
+                    GpeBlock->RegisterCount) * 8] > GpeEventInfo))
             {
                 return (TRUE);
             }
@@ -214,6 +215,7 @@
  * FUNCTION:    AcpiEvWalkGpeList
  *
  * PARAMETERS:  GpeWalkCallback     - Routine called for each GPE block
+ *              Context             - Value passed to callback
  *
  * RETURN:      Status
  *
@@ -223,7 +225,8 @@
 
 ACPI_STATUS
 AcpiEvWalkGpeList (
-    ACPI_GPE_CALLBACK       GpeWalkCallback)
+    ACPI_GPE_CALLBACK       GpeWalkCallback,
+    void                    *Context)
 {
     ACPI_GPE_BLOCK_INFO     *GpeBlock;
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
@@ -248,9 +251,13 @@
         {
             /* One callback per GPE block */
 
-            Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
+            Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
             if (ACPI_FAILURE (Status))
             {
+                if (Status == AE_CTRL_END) /* Callback abort */
+                {
+                    Status = AE_OK;
+                }
                 goto UnlockAndExit;
             }
 
@@ -283,7 +290,8 @@
 ACPI_STATUS
 AcpiEvDeleteGpeHandlers (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock)
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
 {
     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
     UINT32                  i;
@@ -301,7 +309,8 @@
 
         for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
         {
-            GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j];
+            GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
+                ACPI_GPE_REGISTER_WIDTH) + j];
 
             if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
                     ACPI_GPE_DISPATCH_HANDLER)
@@ -387,7 +396,8 @@
         /* Unknown method type, just ignore it! */
 
         ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
-            "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
+            "Ignoring unknown GPE method type: %s "
+            "(name not of form _Lxx or _Exx)",
             Name));
         return_ACPI_STATUS (AE_OK);
     }
@@ -400,7 +410,8 @@
         /* Conversion failed; invalid method, just ignore it */
 
         ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
-            "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
+            "Could not extract GPE number from name: %s "
+            "(name is not of form _Lxx or _Exx)",
             Name));
         return_ACPI_STATUS (AE_OK);
     }
@@ -408,20 +419,21 @@
     /* Ensure that we have a valid GPE number for this GPE block */
 
     if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
-        (GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
+        (GpeNumber >= (GpeBlock->BlockBaseNumber +
+            (GpeBlock->RegisterCount * 8))))
     {
         /*
-         * Not valid for this GPE block, just ignore it
-         * However, it may be valid for a different GPE block, since GPE0 and GPE1
-         * methods both appear under \_GPE.
+         * Not valid for this GPE block, just ignore it. However, it may be
+         * valid for a different GPE block, since GPE0 and GPE1 methods both
+         * appear under \_GPE.
          */
         return_ACPI_STATUS (AE_OK);
     }
 
     /*
-     * Now we can add this information to the GpeEventInfo block
-     * for use during dispatch of this GPE. Default type is RUNTIME, although
-     * this may change when the _PRW methods are executed later.
+     * Now we can add this information to the GpeEventInfo block for use
+     * during dispatch of this GPE. Default type is RUNTIME, although this may
+     * change when the _PRW methods are executed later.
      */
     GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
 
@@ -501,12 +513,12 @@
     GpeBlock = GpeInfo->GpeBlock;
 
     /*
-     * The _PRW object must return a package, we are only interested
-     * in the first element
+     * The _PRW object must return a package, we are only interested in the
+     * first element
      */
     ObjDesc = PkgDesc->Package.Elements[0];
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+    if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
     {
         /* Use FADT-defined GPE device (from definition of _PRW) */
 
@@ -516,13 +528,15 @@
 
         GpeNumber = (UINT32) ObjDesc->Integer.Value;
     }
-    else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+    else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
     {
         /* Package contains a GPE reference and GPE number within a GPE block */
 
         if ((ObjDesc->Package.Count < 2) ||
-            (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
-            (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER))
+            ((ObjDesc->Package.Elements[0])->Common.Type !=
+                ACPI_TYPE_LOCAL_REFERENCE) ||
+            ((ObjDesc->Package.Elements[1])->Common.Type !=
+                ACPI_TYPE_INTEGER))
         {
             goto Cleanup;
         }
@@ -542,16 +556,18 @@
     /*
      * Is this GPE within this block?
      *
-     * TRUE iff these conditions are true:
+     * TRUE if and only if these conditions are true:
      *     1) The GPE devices match.
      *     2) The GPE index(number) is within the range of the Gpe Block
      *          associated with the GPE device.
      */
     if ((GpeDevice == TargetGpeDevice) &&
         (GpeNumber >= GpeBlock->BlockBaseNumber) &&
-        (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+        (GpeNumber < GpeBlock->BlockBaseNumber +
+            (GpeBlock->RegisterCount * 8)))
     {
-        GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
+        GpeEventInfo = &GpeBlock->EventInfo[GpeNumber -
+            GpeBlock->BlockBaseNumber];
 
         /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
 
@@ -562,6 +578,7 @@
         {
             goto Cleanup;
         }
+
         Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
     }
 
@@ -580,9 +597,9 @@
  * RETURN:      A GPE interrupt block
  *
  * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
- *              block per unique interrupt level used for GPEs.
- *              Should be called only when the GPE lists are semaphore locked
- *              and not subject to change.
+ *              block per unique interrupt level used for GPEs. Should be
+ *              called only when the GPE lists are semaphore locked and not
+ *              subject to change.
  *
  ******************************************************************************/
 
@@ -733,8 +750,9 @@
  *
  * FUNCTION:    AcpiEvInstallGpeBlock
  *
- * PARAMETERS:  GpeBlock        - New GPE block
- *              InterruptNumber - Xrupt to be associated with this GPE block
+ * PARAMETERS:  GpeBlock                - New GPE block
+ *              InterruptNumber         - Xrupt to be associated with this
+ *                                        GPE block
  *
  * RETURN:      Status
  *
@@ -802,7 +820,7 @@
  *
  * FUNCTION:    AcpiEvDeleteGpeBlock
  *
- * PARAMETERS:  GpeBlock        - Existing GPE block
+ * PARAMETERS:  GpeBlock            - Existing GPE block
  *
  * RETURN:      Status
  *
@@ -829,7 +847,7 @@
 
     /* Disable all GPEs in this block */
 
-    Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
+    Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
 
     if (!GpeBlock->Previous && !GpeBlock->Next)
     {
@@ -862,6 +880,8 @@
         AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
     }
 
+    AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH;
+
     /* Free the GpeBlock */
 
     ACPI_FREE (GpeBlock->RegisterInfo);
@@ -937,9 +957,9 @@
 
     /*
      * Initialize the GPE Register and Event structures. A goal of these
-     * tables is to hide the fact that there are two separate GPE register sets
-     * in a given GPE hardware block, the status registers occupy the first half,
-     * and the enable registers occupy the second half.
+     * tables is to hide the fact that there are two separate GPE register
+     * sets in a given GPE hardware block, the status registers occupy the
+     * first half, and the enable registers occupy the second half.
      */
     ThisRegister = GpeRegisterInfo;
     ThisEvent    = GpeEventInfo;
@@ -961,8 +981,8 @@
         ThisRegister->EnableAddress.SpaceId   = GpeBlock->BlockAddress.SpaceId;
         ThisRegister->StatusAddress.BitWidth  = ACPI_GPE_REGISTER_WIDTH;
         ThisRegister->EnableAddress.BitWidth  = ACPI_GPE_REGISTER_WIDTH;
-        ThisRegister->StatusAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
-        ThisRegister->EnableAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
+        ThisRegister->StatusAddress.BitOffset = 0;
+        ThisRegister->EnableAddress.BitOffset = 0;
 
         /* Init the EventInfo for each GPE within this register */
 
@@ -975,8 +995,7 @@
 
         /* Disable all GPEs within this register */
 
-        Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
-                    &ThisRegister->EnableAddress);
+        Status = AcpiWrite (0x00, &ThisRegister->EnableAddress);
         if (ACPI_FAILURE (Status))
         {
             goto ErrorExit;
@@ -984,8 +1003,7 @@
 
         /* Clear any pending GPE events within this register */
 
-        Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
-                    &ThisRegister->StatusAddress);
+        Status = AcpiWrite (0xFF, &ThisRegister->StatusAddress);
         if (ACPI_FAILURE (Status))
         {
             goto ErrorExit;
@@ -1110,6 +1128,9 @@
         GpeBlock->RegisterCount,
         InterruptNumber));
 
+    /* Update global count of currently available GPEs */
+
+    AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH;
     return_ACPI_STATUS (AE_OK);
 }
 
@@ -1179,8 +1200,8 @@
      * 1) are "runtime" or "run/wake" GPEs, and
      * 2) have a corresponding _Lxx or _Exx method
      *
-     * Any other GPEs within this block must be enabled via the AcpiEnableGpe()
-     * external interface.
+     * Any other GPEs within this block must be enabled via the
+     * AcpiEnableGpe() external interface.
      */
     WakeGpeCount = 0;
     GpeEnabledCount = 0;
@@ -1191,9 +1212,11 @@
         {
             /* Get the info block for this particular GPE */
 
-            GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j];
+            GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
+                ACPI_GPE_REGISTER_WIDTH) + j];
 
-            if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
+            if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+                    ACPI_GPE_DISPATCH_METHOD) &&
                  (GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
             {
                 GpeEnabledCount++;
@@ -1212,7 +1235,7 @@
 
     /* Enable all valid runtime GPEs found above */
 
-    Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
+    Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
@@ -1257,8 +1280,8 @@
     /*
      * Initialize the GPE Block(s) defined in the FADT
      *
-     * Why the GPE register block lengths are divided by 2:  From the ACPI Spec,
-     * section "General-Purpose Event Registers", we have:
+     * Why the GPE register block lengths are divided by 2:  From the ACPI
+     * Spec, section "General-Purpose Event Registers", we have:
      *
      * "Each register block contains two registers of equal length
      *  GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
@@ -1314,7 +1337,8 @@
             (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
         {
             ACPI_ERROR ((AE_INFO,
-                "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
+                "GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
+                "(GPE %d to %d) - Ignoring GPE1",
                 GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
                 AcpiGbl_FADT.Gpe1Base +
                 ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
--- a/usr/src/uts/intel/io/acpica/events/evmisc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evmisc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evmisc - Miscellaneous event manager support functions
- *              $Revision: 1.109 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,6 +114,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acinterp.h"
@@ -123,10 +123,6 @@
         ACPI_MODULE_NAME    ("evmisc")
 
 
-/* Pointer to FACS needed for the Global Lock */
-
-static ACPI_TABLE_FACS      *Facs = NULL;
-
 /* Local prototypes */
 
 static void ACPI_SYSTEM_XFACE
@@ -242,7 +238,9 @@
             break;
 
         default:
+
             /* All other types are not supported */
+
             return (AE_TYPE);
         }
     }
@@ -254,8 +252,10 @@
      * 2) Global device notify handler
      * 3) Per-device notify handler
      */
-    if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
-        (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY))  ||
+    if ((AcpiGbl_SystemNotify.Handler &&
+            (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
+        (AcpiGbl_DeviceNotify.Handler &&
+            (NotifyValue > ACPI_MAX_SYS_NOTIFY))  ||
         HandlerObj)
     {
         NotifyInfo = AcpiUtCreateGenericState ();
@@ -267,7 +267,8 @@
         if (!HandlerObj)
         {
             ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                "Executing system notify handler for Notify (%4.4s, %X) node %p\n",
+                "Executing system notify handler for Notify (%4.4s, %X) "
+                "node %p\n",
                 AcpiUtGetNodeName (Node), NotifyValue, Node));
         }
 
@@ -285,9 +286,8 @@
     }
     else
     {
-        /*
-         * There is no notify handler (per-device or system) for this device.
-         */
+        /* There is no notify handler (per-device or system) for this device */
+
         ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
             "No notify handler for Notify (%4.4s, %X) node %p\n",
             AcpiUtGetNodeName (Node), NotifyValue, Node));
@@ -324,9 +324,8 @@
 
 
     /*
-     * We will invoke a global notify handler if installed.
-     * This is done _before_ we invoke the per-device handler attached
-     * to the device.
+     * We will invoke a global notify handler if installed. This is done
+     * _before_ we invoke the per-device handler attached to the device.
      */
     if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
     {
@@ -405,7 +404,7 @@
      * If we don't get it now, it will be marked pending and we will
      * take another interrupt when it becomes free.
      */
-    ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
+    ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
     if (Acquired)
     {
         /* Got the lock, now wake the thread waiting for it */
@@ -447,23 +446,16 @@
     ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
 
 
-    Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
-                ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
+    /* Attempt installation of the global lock handler */
 
-    AcpiGbl_GlobalLockPresent = TRUE;
     Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
                 AcpiEvGlobalLockHandler, NULL);
 
     /*
-     * If the global lock does not exist on this platform, the attempt
-     * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
-     * Map to AE_OK, but mark global lock as not present.
-     * Any attempt to actually use the global lock will be flagged
-     * with an error.
+     * If the global lock does not exist on this platform, the attempt to
+     * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
+     * Map to AE_OK, but mark global lock as not present. Any attempt to
+     * actually use the global lock will be flagged with an error.
      */
     if (Status == AE_NO_HARDWARE_RESPONSE)
     {
@@ -471,9 +463,10 @@
             "No response from Global Lock hardware, disabling lock"));
 
         AcpiGbl_GlobalLockPresent = FALSE;
-        Status = AE_OK;
+        return_ACPI_STATUS (AE_OK);
     }
 
+    AcpiGbl_GlobalLockPresent = TRUE;
     return_ACPI_STATUS (Status);
 }
 
@@ -566,8 +559,8 @@
     }
 
     /*
-     * Make sure that a global lock actually exists. If not, just treat
-     * the lock as a standard mutex.
+     * Make sure that a global lock actually exists. If not, just treat the
+     * lock as a standard mutex.
      */
     if (!AcpiGbl_GlobalLockPresent)
     {
@@ -577,7 +570,7 @@
 
     /* Attempt to acquire the actual hardware lock */
 
-    ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
+    ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
     if (Acquired)
     {
        /* We got the lock */
@@ -641,7 +634,7 @@
     {
         /* Allow any thread to release the lock */
 
-        ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending);
+        ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending);
 
         /*
          * If the pending bit was set, we must write GBL_RLS to the control
@@ -649,8 +642,8 @@
          */
         if (Pending)
         {
-            Status = AcpiSetRegister (
-                        ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1);
+            Status = AcpiWriteBitRegister (
+                        ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
         }
 
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
@@ -691,8 +684,8 @@
     if (AcpiGbl_EventsInitialized)
     {
         /*
-         * Disable all event-related functionality.
-         * In all cases, on error, print a message but obviously we don't abort.
+         * Disable all event-related functionality. In all cases, on error,
+         * print a message but obviously we don't abort.
          */
 
         /* Disable all fixed events */
@@ -709,7 +702,7 @@
 
         /* Disable all GPEs in all GPE blocks */
 
-        Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
+        Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
 
         /* Remove SCI handler */
 
@@ -730,7 +723,7 @@
 
     /* Deallocate all handler objects installed within GPE info structs */
 
-    Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
+    Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);
 
     /* Return to original mode if necessary */
 
--- a/usr/src/uts/intel/io/acpica/events/evregion.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evregion.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
- *              $Revision: 1.171 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EVREGION_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acinterp.h"
@@ -125,15 +125,6 @@
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evregion")
 
-#define ACPI_NUM_DEFAULT_SPACES     4
-
-static UINT8        AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
-{
-    ACPI_ADR_SPACE_SYSTEM_MEMORY,
-    ACPI_ADR_SPACE_SYSTEM_IO,
-    ACPI_ADR_SPACE_PCI_CONFIG,
-    ACPI_ADR_SPACE_DATA_TABLE
-};
 
 /* Local prototypes */
 
@@ -151,6 +142,18 @@
     void                    *Context,
     void                    **ReturnValue);
 
+/* These are the address spaces that will get default handlers */
+
+#define ACPI_NUM_DEFAULT_SPACES     4
+
+static UINT8        AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
+{
+    ACPI_ADR_SPACE_SYSTEM_MEMORY,
+    ACPI_ADR_SPACE_SYSTEM_IO,
+    ACPI_ADR_SPACE_PCI_CONFIG,
+    ACPI_ADR_SPACE_DATA_TABLE
+};
+
 
 /*******************************************************************************
  *
@@ -182,18 +185,19 @@
     }
 
     /*
-     * All address spaces (PCI Config, EC, SMBus) are scope dependent
-     * and registration must occur for a specific device.
+     * All address spaces (PCI Config, EC, SMBus) are scope dependent and
+     * registration must occur for a specific device.
      *
-     * In the case of the system memory and IO address spaces there is currently
-     * no device associated with the address space.  For these we use the root.
+     * In the case of the system memory and IO address spaces there is
+     * currently no device associated with the address space. For these we
+     * use the root.
      *
-     * We install the default PCI config space handler at the root so
-     * that this space is immediately available even though the we have
-     * not enumerated all the PCI Root Buses yet.  This is to conform
-     * to the ACPI specification which states that the PCI config
-     * space must be always available -- even though we are nowhere
-     * near ready to find the PCI root buses at this point.
+     * We install the default PCI config space handler at the root so that
+     * this space is immediately available even though the we have not
+     * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
+     * specification which states that the PCI config space must be always
+     * available -- even though we are nowhere near ready to find the PCI root
+     * buses at this point.
      *
      * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
      * has already been installed (via AcpiInstallAddressSpaceHandler).
@@ -257,12 +261,12 @@
         return_ACPI_STATUS (Status);
     }
 
-    /*
-     * Run the _REG methods for OpRegions in each default address space
-     */
+    /* Run the _REG methods for OpRegions in each default address space */
+
     for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
     {
-        /* TBD: Make sure handler is the DEFAULT handler, otherwise
+        /*
+         * TBD: Make sure handler is the DEFAULT handler, otherwise
          * _REG will have already been run.
          */
         Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
@@ -378,7 +382,7 @@
  *
  * PARAMETERS:  RegionObj           - Internal region object
  *              Function            - Read or Write operation
- *              Address             - Where in the space to read or write
+ *              RegionOffset        - Where in the region to read or write
  *              BitWidth            - Field width in bits (8, 16, 32, or 64)
  *              Value               - Pointer to in or out value, must be
  *                                    full 64-bit ACPI_INTEGER
@@ -394,7 +398,7 @@
 AcpiEvAddressSpaceDispatch (
     ACPI_OPERAND_OBJECT     *RegionObj,
     UINT32                  Function,
-    ACPI_PHYSICAL_ADDRESS   Address,
+    UINT32                  RegionOffset,
     UINT32                  BitWidth,
     ACPI_INTEGER            *Value)
 {
@@ -429,14 +433,13 @@
     }
 
     /*
-     * It may be the case that the region has never been initialized
+     * It may be the case that the region has never been initialized.
      * Some types of regions require special init code
      */
     if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
     {
-        /*
-         * This region has not been initialized yet, do it
-         */
+        /* This region has not been initialized yet, do it */
+
         RegionSetup = HandlerDesc->AddressSpace.Setup;
         if (!RegionSetup)
         {
@@ -449,9 +452,9 @@
         }
 
         /*
-         * We must exit the interpreter because the region
-         * setup will potentially execute control methods
-         * (e.g., _REG method for this region)
+         * We must exit the interpreter because the region setup will
+         * potentially execute control methods (for example, the _REG method
+         * for this region)
          */
         AcpiExExitInterpreter ();
 
@@ -472,9 +475,8 @@
             return_ACPI_STATUS (Status);
         }
 
-        /*
-         * Region initialization may have been completed by RegionSetup
-         */
+        /* Region initialization may have been completed by RegionSetup */
+
         if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
         {
             RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
@@ -503,7 +505,7 @@
     ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
         "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
         &RegionObj->Region.Handler->AddressSpace, Handler,
-        ACPI_FORMAT_NATIVE_UINT (Address),
+        ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
         AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
 
     if (!(HandlerDesc->AddressSpace.HandlerFlags &
@@ -519,7 +521,8 @@
 
     /* Call the handler */
 
-    Status = Handler (Function, Address, BitWidth, Value,
+    Status = Handler (Function,
+        (RegionObj->Region.Address + RegionOffset), BitWidth, Value,
         HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
 
     if (ACPI_FAILURE (Status))
@@ -608,7 +611,7 @@
             /* This is it, remove it from the handler's list */
 
             *LastObjPtr = ObjDesc->Region.Next;
-            ObjDesc->Region.Next = NULL;            /* Must clear field */
+            ObjDesc->Region.Next = NULL;        /* Must clear field */
 
             if (AcpiNsIsLocked)
             {
@@ -638,8 +641,8 @@
             }
 
             /*
-             * If the region has been activated, call the setup handler
-             * with the deactivate notification
+             * If the region has been activated, call the setup handler with
+             * the deactivate notification
              */
             if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
             {
@@ -792,8 +795,8 @@
     }
 
     /*
-     * We only care about regions.and objects
-     * that are allowed to have address space handlers
+     * We only care about regions and objects that are allowed to have
+     * address space handlers
      */
     if ((Node->Type != ACPI_TYPE_DEVICE) &&
         (Node->Type != ACPI_TYPE_REGION) &&
@@ -814,7 +817,7 @@
 
     /* Devices are handled different than regions */
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE)
+    if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
     {
         /* Check if this Device already has a handler for this address space */
 
@@ -823,19 +826,21 @@
         {
             /* Found a handler, is it for the same address space? */
 
-            if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId)
+            if (NextHandlerObj->AddressSpace.SpaceId ==
+                    HandlerObj->AddressSpace.SpaceId)
             {
                 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                    "Found handler for region [%s] in device %p(%p) handler %p\n",
+                    "Found handler for region [%s] in device %p(%p) "
+                    "handler %p\n",
                     AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId),
                     ObjDesc, NextHandlerObj, HandlerObj));
 
                 /*
                  * Since the object we found it on was a device, then it
                  * means that someone has already installed a handler for
-                 * the branch of the namespace from this device on.  Just
+                 * the branch of the namespace from this device on. Just
                  * bail out telling the walk routine to not traverse this
-                 * branch.  This preserves the scoping rule for handlers.
+                 * branch. This preserves the scoping rule for handlers.
                  */
                 return (AE_CTRL_DEPTH);
             }
@@ -846,9 +851,8 @@
         }
 
         /*
-         * As long as the device didn't have a handler for this
-         * space we don't care about it.  We just ignore it and
-         * proceed.
+         * As long as the device didn't have a handler for this space we
+         * don't care about it. We just ignore it and proceed.
          */
         return (AE_OK);
     }
@@ -857,16 +861,13 @@
 
     if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
     {
-        /*
-         * This region is for a different address space
-         * -- just ignore it
-         */
+        /* This region is for a different address space, just ignore it */
+
         return (AE_OK);
     }
 
     /*
-     * Now we have a region and it is for the handler's address
-     * space type.
+     * Now we have a region and it is for the handler's address space type.
      *
      * First disconnect region for any previous handler (if any)
      */
@@ -915,9 +916,8 @@
 
 
     /*
-     * This registration is valid for only the types below
-     * and the root.  This is where the default handlers
-     * get placed.
+     * This registration is valid for only the types below and the root. This
+     * is where the default handlers get placed.
      */
     if ((Node->Type != ACPI_TYPE_DEVICE)     &&
         (Node->Type != ACPI_TYPE_PROCESSOR)  &&
@@ -983,8 +983,8 @@
     if (ObjDesc)
     {
         /*
-         * The attached device object already exists.
-         * Make sure the handler is not already installed.
+         * The attached device object already exists. Make sure the handler
+         * is not already installed.
          */
         HandlerObj = ObjDesc->Device.Handler;
 
@@ -1000,8 +1000,8 @@
                 {
                     /*
                      * It is (relatively) OK to attempt to install the SAME
-                     * handler twice. This can easily happen
-                     * with PCI_Config space.
+                     * handler twice. This can easily happen with the
+                     * PCI_Config space.
                      */
                     Status = AE_SAME_HANDLER;
                     goto UnlockAndExit;
@@ -1069,9 +1069,8 @@
     /*
      * Install the handler
      *
-     * At this point there is no existing handler.
-     * Just allocate the object for the handler and link it
-     * into the list.
+     * At this point there is no existing handler. Just allocate the object
+     * for the handler and link it into the list.
      */
     HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
     if (!HandlerObj)
@@ -1147,11 +1146,10 @@
 
 
     /*
-     * Run all _REG methods for all Operation Regions for this
-     * space ID.  This is a separate walk in order to handle any
-     * interdependencies between regions and _REG methods.  (i.e. handlers
-     * must be installed for all regions of this Space ID before we
-     * can run any _REG methods)
+     * Run all _REG methods for all Operation Regions for this space ID. This
+     * is a separate walk in order to handle any interdependencies between
+     * regions and _REG methods. (i.e. handlers must be installed for all
+     * regions of this Space ID before we can run any _REG methods)
      */
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
                 ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
@@ -1195,8 +1193,8 @@
     }
 
     /*
-     * We only care about regions.and objects
-     * that are allowed to have address space handlers
+     * We only care about regions.and objects that are allowed to have address
+     * space handlers
      */
     if ((Node->Type != ACPI_TYPE_REGION) &&
         (Node != AcpiGbl_RootNode))
@@ -1218,10 +1216,8 @@
 
     if (ObjDesc->Region.SpaceId != SpaceId)
     {
-        /*
-         * This region is for a different address space
-         * -- just ignore it
-         */
+        /* This region is for a different address space, just ignore it */
+
         return (AE_OK);
     }
 
--- a/usr/src/uts/intel/io/acpica/events/evrgnini.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evrgnini.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- *              $Revision: 1.89 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EVRGNINI_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 
@@ -335,16 +335,17 @@
                     if (Status == AE_SAME_HANDLER)
                     {
                         /*
-                         * It is OK if the handler is already installed on the root
-                         * bridge.  Still need to return a context object for the
-                         * new PCI_Config operation region, however.
+                         * It is OK if the handler is already installed on the
+                         * root bridge. Still need to return a context object
+                         * for the new PCI_Config operation region, however.
                          */
                         Status = AE_OK;
                     }
                     else
                     {
                         ACPI_EXCEPTION ((AE_INFO, Status,
-                            "Could not install PciConfig handler for Root Bridge %4.4s",
+                            "Could not install PciConfig handler "
+                            "for Root Bridge %4.4s",
                             AcpiUtGetNodeName (PciRootNode)));
                     }
                 }
@@ -379,8 +380,8 @@
     }
 
     /*
-     * For PCI_Config space access, we need the segment, bus,
-     * device and function numbers.  Acquire them here.
+     * For PCI_Config space access, we need the segment, bus, device and
+     * function numbers. Acquire them here.
      *
      * Find the parent device object. (This allows the operation region to be
      * within a subscope under the device, such as a control method.)
@@ -398,14 +399,15 @@
     }
 
     /*
-     * Get the PCI device and function numbers from the _ADR object
-     * contained in the parent's scope.
+     * Get the PCI device and function numbers from the _ADR object contained
+     * in the parent's scope.
      */
-    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue);
+    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
+                PciDeviceNode, &PciValue);
 
     /*
-     * The default is zero, and since the allocation above zeroed
-     * the data, just do nothing on failure.
+     * The default is zero, and since the allocation above zeroed the data,
+     * just do nothing on failure.
      */
     if (ACPI_SUCCESS (Status))
     {
@@ -415,7 +417,8 @@
 
     /* The PCI segment number comes from the _SEG method */
 
-    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue);
+    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG,
+                PciRootNode, &PciValue);
     if (ACPI_SUCCESS (Status))
     {
         PciId->Segment = ACPI_LOWORD (PciValue);
@@ -423,7 +426,8 @@
 
     /* The PCI bus number comes from the _BBN method */
 
-    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue);
+    Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN,
+                PciRootNode, &PciValue);
     if (ACPI_SUCCESS (Status))
     {
         PciId->Bus = ACPI_LOWORD (PciValue);
@@ -497,9 +501,8 @@
     UINT32                  i;
 
 
-    /*
-     * Get the _HID and check for a PCI Root Bridge
-     */
+    /* Get the _HID and check for a PCI Root Bridge */
+
     Status = AcpiUtExecute_HID (Node, &Hid);
     if (ACPI_FAILURE (Status))
     {
@@ -511,10 +514,8 @@
         return (TRUE);
     }
 
-    /*
-     * The _HID did not match.
-     * Get the _CID and check for a PCI Root Bridge
-     */
+    /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
+
     Status = AcpiUtExecute_CID (Node, &Cid);
     if (ACPI_FAILURE (Status))
     {
@@ -652,9 +653,9 @@
  *              Get the appropriate address space handler for a newly
  *              created region.
  *
- *              This also performs address space specific initialization.  For
+ *              This also performs address space specific initialization. For
  *              example, PCI regions must have an _ADR object that contains
- *              a PCI address in the scope of the definition.  This address is
+ *              a PCI address in the scope of the definition. This address is
  *              required to perform an access to PCI config space.
  *
  * MUTEX:       Interpreter should be unlocked, because we may run the _REG
@@ -714,7 +715,7 @@
     {
         /*
          * The _REG method is optional and there can be only one per region
-         * definition.  This will be executed when the handler is attached
+         * definition. This will be executed when the handler is attached
          * or removed
          */
         RegionObj2->Extra.Method_REG = MethodNode;
@@ -772,8 +773,8 @@
                                 AcpiNsLocked);
 
                     /*
-                     * Tell all users that this region is usable by running the _REG
-                     * method
+                     * Tell all users that this region is usable by
+                     * running the _REG method
                      */
                     if (AcpiNsLocked)
                     {
@@ -804,10 +805,8 @@
             }
         }
 
-        /*
-         * This node does not have the handler we need;
-         * Pop up one level
-         */
+        /* This node does not have the handler we need; Pop up one level */
+
         Node = AcpiNsGetParentNode (Node);
     }
 
--- a/usr/src/uts/intel/io/acpica/events/evsci.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evsci.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: evsci - System Control Interrupt configuration and
  *                      legacy to ACPI mode state transition functions
- *              $Revision: 1.104 $
  *
  ******************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 
 
@@ -204,10 +204,8 @@
      * if this interrupt handler is installed, ACPI is enabled.
      */
 
-    /*
-     * GPEs:
-     * Check for and dispatch any GPEs that have occurred
-     */
+    /* GPEs: Check for and dispatch any GPEs that have occurred */
+
     InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
 
     return_UINT32 (InterruptHandled);
@@ -251,11 +249,11 @@
  * RETURN:      E_OK if handler uninstalled OK, E_ERROR if handler was not
  *              installed to begin with
  *
- * DESCRIPTION: Remove the SCI interrupt handler.  No further SCIs will be
+ * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
  *              taken.
  *
  * Note:  It doesn't seem important to disable all events or set the event
- *        enable registers to their original values.  The OS should disable
+ *        enable registers to their original values. The OS should disable
  *        the SCI interrupt level when the handler is removed, so no more
  *        events will come in.
  *
--- a/usr/src/uts/intel/io/acpica/events/evxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evxface - External interfaces for ACPI events
- *              $Revision: 1.167 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EVXFACE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acevents.h"
 #include "acinterp.h"
@@ -378,7 +378,7 @@
     /*
      * Root Object:
      * Registering a notify handler on the root object indicates that the
-     * caller wishes to receive notifications for all objects.  Note that
+     * caller wishes to receive notifications for all objects. Note that
      * only one <external> global handler can be regsitered (per notify type).
      */
     if (Device == ACPI_ROOT_OBJECT)
@@ -727,7 +727,8 @@
 
     /* Make sure that there isn't a handler there already */
 
-    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
+    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+            ACPI_GPE_DISPATCH_HANDLER)
     {
         Status = AE_ALREADY_EXISTS;
         goto UnlockAndExit;
@@ -761,7 +762,7 @@
 
     /* Setup up dispatch flags to indicate handler (vs. method) */
 
-    GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);  /* Clear bits */
+    GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
     GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
 
     AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
@@ -829,7 +830,8 @@
 
     /* Make sure that a handler is indeed installed */
 
-    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER)
+    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) !=
+            ACPI_GPE_DISPATCH_HANDLER)
     {
         Status = AE_NOT_EXIST;
         goto UnlockAndExit;
--- a/usr/src/uts/intel/io/acpica/events/evxfevnt.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evxfevnt.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- *              $Revision: 1.94 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EVXFEVNT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 #include "actables.h"
@@ -125,6 +125,14 @@
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evxfevnt")
 
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiEvGetGpeDevice (
+    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
+
 
 /*******************************************************************************
  *
@@ -264,10 +272,12 @@
     }
 
     /*
-     * Enable the requested fixed event (by writing a one to the
-     * enable register bit)
+     * Enable the requested fixed event (by writing a one to the enable
+     * register bit)
      */
-    Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1);
+    Status = AcpiWriteBitRegister (
+                AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+                ACPI_ENABLE_EVENT);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -275,8 +285,8 @@
 
     /* Make sure that the hardware responded */
 
-    Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
-                    &Value);
+    Status = AcpiReadBitRegister (
+                AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -504,17 +514,19 @@
     }
 
     /*
-     * Disable the requested fixed event (by writing a zero to the
-     * enable register bit)
+     * Disable the requested fixed event (by writing a zero to the enable
+     * register bit)
      */
-    Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
+    Status = AcpiWriteBitRegister (
+                AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
+                ACPI_DISABLE_EVENT);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
 
-    Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
-                &Value);
+    Status = AcpiReadBitRegister (
+                AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -563,10 +575,12 @@
     }
 
     /*
-     * Clear the requested fixed event (By writing a one to the
-     * status register bit)
+     * Clear the requested fixed event (By writing a one to the status
+     * register bit)
      */
-    Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
+    Status = AcpiWriteBitRegister (
+                AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
+                ACPI_CLEAR_STATUS);
 
     return_ACPI_STATUS (Status);
 }
@@ -673,8 +687,8 @@
 
     /* Get the status of the requested fixed event */
 
-    Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
-                    EventStatus);
+    Status = AcpiReadBitRegister (
+                AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
 
     return_ACPI_STATUS (Status);
 }
@@ -803,7 +817,7 @@
      * is always zero
      */
     Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
-                    0, InterruptNumber, &GpeBlock);
+                0, InterruptNumber, &GpeBlock);
     if (ACPI_FAILURE (Status))
     {
         goto UnlockAndExit;
@@ -922,3 +936,177 @@
 
 ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiGetGpeDevice
+ *
+ * PARAMETERS:  Index               - System GPE index (0-CurrentGpeCount)
+ *              GpeDevice           - Where the parent GPE Device is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
+ *              gpe device indicates that the gpe number is contained in one of
+ *              the FADT-defined gpe blocks. Otherwise, the GPE block device.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetGpeDevice (
+    UINT32                  Index,
+    ACPI_HANDLE             *GpeDevice)
+{
+    ACPI_GPE_DEVICE_INFO    Info;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
+
+
+    if (!GpeDevice)
+    {
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    if (Index >= AcpiCurrentGpeCount)
+    {
+        return_ACPI_STATUS (AE_NOT_EXIST);
+    }
+
+    /* Setup and walk the GPE list */
+
+    Info.Index = Index;
+    Info.Status = AE_NOT_EXIST;
+    Info.GpeDevice = NULL;
+    Info.NextBlockBaseIndex = 0;
+
+    Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
+    return_ACPI_STATUS (Info.Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiEvGetGpeDevice
+ *
+ * PARAMETERS:  GPE_WALK_CALLBACK
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE
+ *              block device. NULL if the GPE is one of the FADT-defined GPEs.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvGetGpeDevice (
+    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
+{
+    ACPI_GPE_DEVICE_INFO    *Info = Context;
+
+
+    /* Increment Index by the number of GPEs in this block */
+
+    Info->NextBlockBaseIndex +=
+        (GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH);
+
+    if (Info->Index < Info->NextBlockBaseIndex)
+    {
+        /*
+         * The GPE index is within this block, get the node. Leave the node
+         * NULL for the FADT-defined GPEs
+         */
+        if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE)
+        {
+            Info->GpeDevice = GpeBlock->Node;
+        }
+
+        Info->Status = AE_OK;
+        return (AE_CTRL_END);
+    }
+
+    return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiDisableAllGpes
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDisableAllGpes (
+    void)
+{
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
+
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiHwDisableAllGpes ();
+    (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiEnableAllRuntimeGpes
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEnableAllRuntimeGpes (
+    void)
+{
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
+
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiHwEnableAllRuntimeGpes ();
+    (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+    return_ACPI_STATUS (Status);
+}
+
+
--- a/usr/src/uts/intel/io/acpica/events/evxfregn.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/events/evxfregn.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
  *                         Address Spaces.
- *              $Revision: 1.71 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EVXFREGN_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acevents.h"
 
@@ -285,7 +285,8 @@
             /* Matched SpaceId, first dereference this in the Regions */
 
             ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
+                "Removing address handler %p(%p) for region %s "
+                "on Device %p(%p)\n",
                 HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
                 Node, ObjDesc));
 
--- a/usr/src/uts/intel/io/acpica/executer/exconfig.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exconfig.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- *              $Revision: 1.113 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,10 +117,12 @@
 #define __EXCONFIG_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "acnamesp.h"
 #include "actables.h"
 #include "acdispat.h"
+#include "acevents.h"
 
 
 #define _COMPONENT          ACPI_EXECUTER
@@ -135,6 +136,12 @@
     ACPI_NAMESPACE_NODE     *ParentNode,
     ACPI_OPERAND_OBJECT     **DdbHandle);
 
+static ACPI_STATUS
+AcpiExRegionRead (
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    UINT32                  Length,
+    UINT8                   *Buffer);
+
 
 /*******************************************************************************
  *
@@ -174,6 +181,7 @@
 
     /* Init the table handle */
 
+    ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
     ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
     *DdbHandle = ObjDesc;
 
@@ -325,6 +333,8 @@
         if (ACPI_FAILURE (Status))
         {
             (void) AcpiExUnloadTable (DdbHandle);
+
+            AcpiUtRemoveReference (DdbHandle);
             return_ACPI_STATUS (Status);
         }
     }
@@ -352,6 +362,53 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiExRegionRead
+ *
+ * PARAMETERS:  ObjDesc         - Region descriptor
+ *              Length          - Number of bytes to read
+ *              Buffer          - Pointer to where to put the data
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read data from an operation region. The read starts from the
+ *              beginning of the region.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiExRegionRead (
+    ACPI_OPERAND_OBJECT     *ObjDesc,
+    UINT32                  Length,
+    UINT8                   *Buffer)
+{
+    ACPI_STATUS             Status;
+    ACPI_INTEGER            Value;
+    UINT32                  RegionOffset = 0;
+    UINT32                  i;
+
+
+    /* Bytewise reads */
+
+    for (i = 0; i < Length; i++)
+    {
+        Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
+                    RegionOffset, 8, &Value);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+
+        *Buffer = (UINT8) Value;
+        Buffer++;
+        RegionOffset++;
+    }
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiExLoadOp
  *
  * PARAMETERS:  ObjDesc         - Region or Buffer/Field where the table will be
@@ -392,7 +449,7 @@
 
     /* Source Object can be either an OpRegion or a Buffer/Field */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_REGION:
 
@@ -419,19 +476,23 @@
             }
         }
 
-        /*
-         * Map the table header and get the actual table length. The region
-         * length is not guaranteed to be the same as the table length.
-         */
-        Table = AcpiOsMapMemory (ObjDesc->Region.Address,
-                    sizeof (ACPI_TABLE_HEADER));
+        /* Get the table header first so we can get the table length */
+
+        Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
         if (!Table)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
 
+        Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
+                    ACPI_CAST_PTR (UINT8, Table));
         Length = Table->Length;
-        AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
+        ACPI_FREE (Table);
+
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
 
         /* Must have at least an ACPI table header */
 
@@ -441,10 +502,19 @@
         }
 
         /*
-         * The memory region is not guaranteed to remain stable and we must
-         * copy the table to a local buffer. For example, the memory region
-         * is corrupted after suspend on some machines. Dynamically loaded
-         * tables are usually small, so this overhead is minimal.
+         * The original implementation simply mapped the table, with no copy.
+         * However, the memory region is not guaranteed to remain stable and
+         * we must copy the table to a local buffer. For example, the memory
+         * region is corrupted after suspend on some machines. Dynamically
+         * loaded tables are usually small, so this overhead is minimal.
+         *
+         * The latest implementation (5/2009) does not use a mapping at all.
+         * We use the low-level operation region interface to read the table
+         * instead of the obvious optimization of using a direct mapping.
+         * This maintains a consistent use of operation regions across the
+         * entire subsystem. This is important if additional processing must
+         * be performed in the (possibly user-installed) operation region
+         * handler. For example, AcpiExec and ASLTS depend on this.
          */
 
         /* Allocate a buffer for the table */
@@ -455,18 +525,16 @@
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
 
-        /* Map the entire table and copy it */
+        /* Read the entire table */
 
-        Table = AcpiOsMapMemory (ObjDesc->Region.Address, Length);
-        if (!Table)
+        Status = AcpiExRegionRead (ObjDesc, Length,
+                    ACPI_CAST_PTR (UINT8, TableDesc.Pointer));
+        if (ACPI_FAILURE (Status))
         {
             ACPI_FREE (TableDesc.Pointer);
-            return_ACPI_STATUS (AE_NO_MEMORY);
+            return_ACPI_STATUS (Status);
         }
 
-        ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
-        AcpiOsUnmapMemory (Table, Length);
-
         TableDesc.Address = ObjDesc->Region.Address;
         break;
 
@@ -568,6 +636,10 @@
         return_ACPI_STATUS (Status);
     }
 
+    /* Remove the reference by added by AcpiExStore above */
+
+    AcpiUtRemoveReference (DdbHandle);
+
     /* Invoke table handler if present */
 
     if (AcpiGbl_TableHandler)
@@ -614,13 +686,18 @@
 
     /*
      * Validate the handle
-     * Although the handle is partially validated in AcpiExReconfiguration(),
+     * Although the handle is partially validated in AcpiExReconfiguration()
      * when it calls AcpiExResolveOperands(), the handle is more completely
      * validated here.
+     *
+     * Handle must be a valid operand object of type reference. Also, the
+     * DdbHandle must still be marked valid (table has not been previously
+     * unloaded)
      */
     if ((!DdbHandle) ||
         (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
-        (ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE))
+        (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
+        (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
     {
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
@@ -629,6 +706,13 @@
 
     TableIndex = TableDesc->Reference.Value;
 
+    /* Ensure the table is still loaded */
+
+    if (!AcpiTbIsTableLoaded (TableIndex))
+    {
+        return_ACPI_STATUS (AE_NOT_EXIST);
+    }
+
     /* Invoke table handler if present */
 
     if (AcpiGbl_TableHandler)
@@ -641,18 +725,22 @@
         }
     }
 
-    /*
-     * Delete the entire namespace under this table Node
-     * (Offset contains the TableId)
-     */
-    AcpiTbDeleteNamespaceByOwner (TableIndex);
+    /* Delete the portion of the namespace owned by this table */
+
+    Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
     (void) AcpiTbReleaseOwnerId (TableIndex);
-
     AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
 
-    /* Table unloaded, remove a reference to the DdbHandle object */
-
-    AcpiUtRemoveReference (DdbHandle);
+    /*
+     * Invalidate the handle. We do this because the handle may be stored
+     * in a named object and may not be actually deleted until much later.
+     */
+    DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
     return_ACPI_STATUS (AE_OK);
 }
 
--- a/usr/src/uts/intel/io/acpica/executer/exconvrt.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exconvrt.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exconvrt - Object conversion routines
- *              $Revision: 1.75 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXCONVRT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 
@@ -167,7 +167,7 @@
     ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
 
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
@@ -202,7 +202,7 @@
 
     /* String conversion is different than Buffer conversion */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_STRING:
 
@@ -304,7 +304,7 @@
     ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
 
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_BUFFER:
 
@@ -525,7 +525,7 @@
     ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
 
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_STRING:
 
@@ -638,8 +638,14 @@
         /*
          * Create a new string object and string buffer
          * (-1 because of extra separator included in StringLength from above)
+         * Allow creation of zero-length strings from zero-length buffers.
          */
-        ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
+        if (StringLength)
+        {
+            StringLength--;
+        }
+
+        ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
         if (!ReturnDesc)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
@@ -663,7 +669,10 @@
          * Null terminate the string
          * (overwrites final comma/space from above)
          */
-        NewBuf--;
+        if (ObjDesc->Buffer.Length)
+        {
+            NewBuf--;
+        }
         *NewBuf = 0;
         break;
 
@@ -729,7 +738,7 @@
         default:
             /* No conversion allowed for these types */
 
-            if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
+            if (DestinationType != SourceDesc->Common.Type)
             {
                 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
                     "Explicit operator, will store (%s) over existing type (%s)\n",
--- a/usr/src/uts/intel/io/acpica/executer/excreate.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/excreate.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: excreate - Named object creation
- *              $Revision: 1.117 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXCREATE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acnamesp.h"
@@ -614,7 +614,7 @@
          * ACPI 2.0: SyncLevel = SyncLevel in method declaration
          */
         ObjDesc->Method.SyncLevel = (UINT8)
-            ((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4);
+            ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
     }
 
     /* Attach the new object to the method Node */
--- a/usr/src/uts/intel/io/acpica/executer/exdump.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exdump.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exdump - Interpreter debug output routines
- *              $Revision: 1.206 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __EXDUMP_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acnamesp.h"
@@ -213,10 +213,11 @@
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Event.OsSemaphore),            "OsSemaphore"}
 };
 
-static ACPI_EXDUMP_INFO     AcpiExDumpMethod[8] =
+static ACPI_EXDUMP_INFO     AcpiExDumpMethod[9] =
 {
     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod),         NULL},
-    {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "ParamCount"},
+    {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.MethodFlags),           "Method Flags"},
+    {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
@@ -305,7 +306,6 @@
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
 };
 
-
 static ACPI_EXDUMP_INFO     AcpiExDumpReference[8] =
 {
     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
@@ -346,7 +346,6 @@
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Common.Flags),                 "Flags"}
 };
 
-
 static ACPI_EXDUMP_INFO     AcpiExDumpFieldCommon[7] =
 {
     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon),    NULL},
@@ -450,6 +449,7 @@
             break;
 
         case ACPI_EXD_TYPE:
+
             AcpiExOutString  ("Type", AcpiUtGetObjectTypeName (ObjDesc));
             break;
 
@@ -471,7 +471,7 @@
         case ACPI_EXD_UINT64:
 
             AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
-                    ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+                ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
             break;
 
         case ACPI_EXD_POINTER:
@@ -506,12 +506,15 @@
 
         case ACPI_EXD_REFERENCE:
 
-            AcpiExOutString ("Class Name", (char *) AcpiUtGetReferenceName (ObjDesc));
+            AcpiExOutString ("Class Name",
+                (char *) AcpiUtGetReferenceName (ObjDesc));
             AcpiExDumpReferenceObj (ObjDesc);
             break;
 
         default:
-            AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
+
+            AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
+                Info->Opcode);
             return;
         }
 
@@ -589,7 +592,7 @@
 
     /* Decode object type */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_LOCAL_REFERENCE:
 
@@ -623,41 +626,16 @@
             break;
 
 
-        case ACPI_REFCLASS_ARG:
-
-            AcpiOsPrintf ("%X", ObjDesc->Reference.Value);
+        case ACPI_REFCLASS_NAME:
 
-            if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
-            {
-                /* Value is an Integer */
-
-                AcpiOsPrintf (" value is [%8.8X%8.8x]",
-                    ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
-            }
-
-            AcpiOsPrintf ("\n");
+            AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
             break;
 
 
+        case ACPI_REFCLASS_ARG:
         case ACPI_REFCLASS_LOCAL:
 
-            AcpiOsPrintf ("%X", ObjDesc->Reference.Value);
-
-            if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
-            {
-                /* Value is an Integer */
-
-                AcpiOsPrintf (" value is [%8.8X%8.8x]",
-                    ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
-            }
-
-            AcpiOsPrintf ("\n");
-            break;
-
-
-        case ACPI_REFCLASS_NAME:
-
-            AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
+            AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
             break;
 
 
@@ -674,7 +652,6 @@
         AcpiOsPrintf ("Buffer length %.2X @ %p\n",
             ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
 
-
         /* Debug only -- dump the buffer contents */
 
         if (ObjDesc->Buffer.Pointer)
@@ -685,7 +662,8 @@
                 Length = 128;
             }
 
-            AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n", Length);
+            AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
+                Length);
             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
         }
         break;
@@ -761,8 +739,8 @@
 
     case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-        AcpiOsPrintf (
-            "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+        AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
+            "byte=%X bit=%X of below:\n",
             ObjDesc->Field.BitLength,
             ObjDesc->Field.AccessByteWidth,
             ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
@@ -782,8 +760,7 @@
 
     case ACPI_TYPE_BUFFER_FIELD:
 
-        AcpiOsPrintf (
-            "BufferField: %X bits at byte %X bit %X of\n",
+        AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
             ObjDesc->BufferField.BitLength,
             ObjDesc->BufferField.BaseByteOffset,
             ObjDesc->BufferField.StartFieldBitOffset);
@@ -792,7 +769,7 @@
         {
             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
         }
-        else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) !=
+        else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
                     ACPI_TYPE_BUFFER)
         {
             AcpiOsPrintf ("*not a Buffer*\n");
@@ -852,7 +829,7 @@
     default:
         /* Unknown Type */
 
-        AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
+        AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
         break;
     }
 
@@ -968,10 +945,10 @@
         }
     }
 
-    AcpiOsPrintf ("%20s : %4.4s\n",       "Name", AcpiUtGetNodeName (Node));
-    AcpiExOutString  ("Type",             AcpiUtGetTypeName (Node->Type));
-    AcpiExOutPointer ("Attached Object",  AcpiNsGetAttachedObject (Node));
-    AcpiExOutPointer ("Parent",           AcpiNsGetParentNode (Node));
+    AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
+    AcpiExOutString  ("Type", AcpiUtGetTypeName (Node->Type));
+    AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
+    AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
 
     AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
         AcpiExDumpNode);
@@ -1020,21 +997,18 @@
             AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
             if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
             {
-                AcpiOsPrintf (" Table Index: %X\n",
-                    ObjDesc->Reference.Value);
+                AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
             }
             else
             {
-                AcpiOsPrintf (" Target: %p [%s]\n",
-                    ObjDesc->Reference.Object,
+                AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
                     AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
                         ObjDesc->Reference.Object)->Common.Type));
             }
         }
         else
         {
-            AcpiOsPrintf (" Target: %p\n",
-                ObjDesc->Reference.Object);
+            AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
         }
     }
 }
@@ -1085,12 +1059,12 @@
 
     /* Packages may only contain a few object types */
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
         AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
-                    ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+            ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
         break;
 
 
@@ -1111,7 +1085,7 @@
         if (ObjDesc->Buffer.Length)
         {
             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
-                    ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+                ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
         }
         else
         {
@@ -1123,7 +1097,7 @@
     case ACPI_TYPE_PACKAGE:
 
         AcpiOsPrintf ("[Package] Contains %d Elements:\n",
-                ObjDesc->Package.Count);
+            ObjDesc->Package.Count);
 
         for (i = 0; i < ObjDesc->Package.Count; i++)
         {
@@ -1143,7 +1117,7 @@
 
     default:
 
-        AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
+        AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
         break;
     }
 }
--- a/usr/src/uts/intel/io/acpica/executer/exfield.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exfield.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- *              $Revision: 1.133 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXFIELD_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acinterp.h"
 
@@ -167,7 +167,7 @@
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+    if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
     {
         /*
          * If the BufferField arguments have not been previously evaluated,
@@ -182,7 +182,7 @@
             }
         }
     }
-    else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
+    else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
              (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
     {
         /*
@@ -249,7 +249,7 @@
 
     ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
         "FieldRead [TO]:   Obj %p, Type %X, Buf %p, ByteLen %X\n",
-        ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length));
+        ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length));
     ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
         "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
         ObjDesc->CommonField.BitLength,
@@ -316,7 +316,7 @@
         return_ACPI_STATUS (AE_AML_NO_OPERAND);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+    if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
     {
         /*
          * If the BufferField arguments have not been previously evaluated,
@@ -331,7 +331,7 @@
             }
         }
     }
-    else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
+    else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
              (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
     {
         /*
@@ -340,7 +340,7 @@
          *
          * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
          */
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
+        if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
         {
             ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s",
                 AcpiUtGetObjectTypeName (SourceDesc)));
@@ -387,7 +387,7 @@
 
     /* Get a pointer to the data to be written */
 
-    switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+    switch (SourceDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
         Buffer = &SourceDesc->Integer.Value;
@@ -410,13 +410,13 @@
 
     ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
         "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
-        SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)),
-        ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length));
+        SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
+        SourceDesc->Common.Type, Buffer, Length));
 
     ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
         "FieldWrite [TO]:   Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
-        ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)),
-        ACPI_GET_OBJECT_TYPE (ObjDesc),
+        ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type),
+        ObjDesc->Common.Type,
         ObjDesc->CommonField.BitLength,
         ObjDesc->CommonField.StartFieldBitOffset,
         ObjDesc->CommonField.BaseByteOffset));
--- a/usr/src/uts/intel/io/acpica/executer/exfldio.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exfldio.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exfldio - Aml Field I/O
- *              $Revision: 1.131 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXFLDIO_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acevents.h"
@@ -179,10 +179,10 @@
 
     /* We must have a valid region */
 
-    if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
+    if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
     {
         ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
-            ACPI_GET_OBJECT_TYPE (RgnDesc),
+            RgnDesc->Common.Type,
             AcpiUtGetObjectTypeName (RgnDesc)));
 
         return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -201,13 +201,6 @@
         }
     }
 
-    /* Exit if Address/Length have been disallowed by the host OS */
-
-    if (RgnDesc->Common.Flags & AOPOBJ_INVALID)
-    {
-        return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
-    }
-
     /*
      * Exit now for SMBus address space, it has a non-linear address space
      * and the request cannot be directly validated
@@ -321,7 +314,7 @@
 {
     ACPI_STATUS             Status;
     ACPI_OPERAND_OBJECT     *RgnDesc;
-    ACPI_PHYSICAL_ADDRESS   Address;
+    UINT32                  RegionOffset;
 
 
     ACPI_FUNCTION_TRACE (ExAccessRegion);
@@ -345,9 +338,9 @@
      * 3) The current offset into the field
      */
     RgnDesc = ObjDesc->CommonField.RegionObj;
-    Address = RgnDesc->Region.Address +
-                ObjDesc->CommonField.BaseByteOffset +
-                FieldDatumByteOffset;
+    RegionOffset =
+        ObjDesc->CommonField.BaseByteOffset +
+        FieldDatumByteOffset;
 
     if ((Function & ACPI_IO_MASK) == ACPI_READ)
     {
@@ -365,12 +358,11 @@
         ObjDesc->CommonField.AccessByteWidth,
         ObjDesc->CommonField.BaseByteOffset,
         FieldDatumByteOffset,
-        ACPI_CAST_PTR (void, Address)));
+        ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset))));
 
     /* Invoke the appropriate AddressSpace/OpRegion handler */
 
-    Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function,
-                Address,
+    Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset,
                 ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
 
     if (ACPI_FAILURE (Status))
@@ -499,7 +491,7 @@
      * IndexField  - Write to an Index Register, then read/write from/to a
      *               Data Register
      */
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_BUFFER_FIELD:
         /*
@@ -614,13 +606,13 @@
             return_ACPI_STATUS (Status);
         }
 
-        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-            "I/O to Data Register: ValuePtr %p\n", Value));
-
         if (ReadWrite == ACPI_READ)
         {
             /* Read the datum from the DataRegister */
 
+            ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                "Read from Data Register\n"));
+
             Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
                         Value, sizeof (ACPI_INTEGER));
         }
@@ -628,6 +620,10 @@
         {
             /* Write the datum to the DataRegister */
 
+            ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+                "Write to Data Register: Value %8.8X%8.8X\n",
+                ACPI_FORMAT_UINT64 (*Value)));
+
             Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
                         Value, sizeof (ACPI_INTEGER));
         }
@@ -637,7 +633,7 @@
     default:
 
         ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
-            ACPI_GET_OBJECT_TYPE (ObjDesc)));
+            ObjDesc->Common.Type));
         Status = AE_AML_INTERNAL;
         break;
     }
--- a/usr/src/uts/intel/io/acpica/executer/exmisc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exmisc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- *              $Revision: 1.145 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __EXMISC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "amlresrc.h"
@@ -162,7 +162,7 @@
     {
     case ACPI_DESC_TYPE_OPERAND:
 
-        if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE)
+        if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
         {
             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
         }
@@ -357,7 +357,7 @@
      * guaranteed to be either Integer/String/Buffer by the operand
      * resolution mechanism.
      */
-    switch (ACPI_GET_OBJECT_TYPE (Operand0))
+    switch (Operand0->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
         Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@@ -374,7 +374,7 @@
 
     default:
         ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
-            ACPI_GET_OBJECT_TYPE (Operand0)));
+            Operand0->Common.Type));
         Status = AE_AML_INTERNAL;
     }
 
@@ -396,7 +396,7 @@
      * 2) Two Strings concatenated to produce a new String
      * 3) Two Buffers concatenated to produce a new Buffer
      */
-    switch (ACPI_GET_OBJECT_TYPE (Operand0))
+    switch (Operand0->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
@@ -476,7 +476,7 @@
         /* Invalid object type, should not happen here */
 
         ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
-            ACPI_GET_OBJECT_TYPE (Operand0)));
+            Operand0->Common.Type));
         Status =AE_AML_INTERNAL;
         goto Cleanup;
     }
@@ -709,7 +709,7 @@
      * guaranteed to be either Integer/String/Buffer by the operand
      * resolution mechanism.
      */
-    switch (ACPI_GET_OBJECT_TYPE (Operand0))
+    switch (Operand0->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
         Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@@ -737,7 +737,7 @@
     /*
      * Two cases: 1) Both Integers, 2) Both Strings or Buffers
      */
-    if (ACPI_GET_OBJECT_TYPE (Operand0) == ACPI_TYPE_INTEGER)
+    if (Operand0->Common.Type == ACPI_TYPE_INTEGER)
     {
         /*
          * 1) Both operands are of type integer
--- a/usr/src/uts/intel/io/acpica/executer/exmutex.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exmutex.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exmutex - ASL Mutex Acquire/Release functions
- *              $Revision: 1.43 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXMUTEX_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "acevents.h"
 
@@ -166,6 +166,15 @@
     if (ObjDesc->Mutex.Prev)
     {
         (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
+
+        /*
+         * Migrate the previous sync level associated with this mutex to the
+         * previous mutex on the list so that it may be preserved. This handles
+         * the case where several mutexes have been acquired at the same level,
+         * but are not released in opposite order.
+         */
+        (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel =
+            ObjDesc->Mutex.OriginalSyncLevel;
     }
     else
     {
@@ -461,6 +470,7 @@
     ACPI_WALK_STATE         *WalkState)
 {
     ACPI_STATUS             Status = AE_OK;
+    UINT8                   PreviousSyncLevel;
 
 
     ACPI_FUNCTION_TRACE (ExReleaseMutex);
@@ -488,10 +498,10 @@
         (ObjDesc != AcpiGbl_GlobalLockMutex))
     {
         ACPI_ERROR ((AE_INFO,
-            "Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
-            WalkState->Thread->ThreadId,
+            "Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
+            ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
             AcpiUtGetNodeName (ObjDesc->Mutex.Node),
-            ObjDesc->Mutex.OwnerThread->ThreadId));
+            ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId)));
         return_ACPI_STATUS (AE_AML_NOT_OWNER);
     }
 
@@ -505,10 +515,13 @@
     }
 
     /*
-     * The sync level of the mutex must be less than or equal to the current
-     * sync level
+     * The sync level of the mutex must be equal to the current sync level. In
+     * other words, the current level means that at least one mutex at that
+     * level is currently being held. Attempting to release a mutex of a
+     * different level can only mean that the mutex ordering rule is being
+     * violated. This behavior is clarified in ACPI 4.0 specification.
      */
-    if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
+    if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
     {
         ACPI_ERROR ((AE_INFO,
             "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
@@ -517,13 +530,25 @@
         return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
     }
 
+    /*
+     * Get the previous SyncLevel from the head of the acquired mutex list.
+     * This handles the case where several mutexes at the same level have been
+     * acquired, but are not released in reverse order.
+     */
+    PreviousSyncLevel =
+        WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
+
     Status = AcpiExReleaseMutexObject (ObjDesc);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
 
     if (ObjDesc->Mutex.AcquisitionDepth == 0)
     {
-        /* Restore the original SyncLevel */
+        /* Restore the previous SyncLevel */
 
-        WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
+        WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
     }
     return_ACPI_STATUS (Status);
 }
--- a/usr/src/uts/intel/io/acpica/executer/exnames.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exnames.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exnames - interpreter/scanner name load/execute
- *              $Revision: 1.112 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXNAMES_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 
--- a/usr/src/uts/intel/io/acpica/executer/exoparg1.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg1.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exoparg1 - AML execution - opcodes with 1 argument
- *              $Revision: 1.186 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXOPARG1_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "acinterp.h"
@@ -947,8 +947,8 @@
             TempDesc = AcpiNsGetAttachedObject (
                            (ACPI_NAMESPACE_NODE *) Operand[0]);
             if (TempDesc &&
-                 ((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) ||
-                  (ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE)))
+                 ((TempDesc->Common.Type == ACPI_TYPE_STRING) ||
+                  (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)))
             {
                 Operand[0] = TempDesc;
                 AcpiUtAddReference (TempDesc);
@@ -961,7 +961,7 @@
         }
         else
         {
-            switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+            switch ((Operand[0])->Common.Type)
             {
             case ACPI_TYPE_LOCAL_REFERENCE:
                 /*
@@ -1020,7 +1020,7 @@
 
         if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
         {
-            if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING)
+            if ((Operand[0])->Common.Type == ACPI_TYPE_STRING)
             {
                 /*
                  * This is a DerefOf (String). The string is a reference
--- a/usr/src/uts/intel/io/acpica/executer/exoparg2.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg2.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- *              $Revision: 1.146 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXOPARG2_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acinterp.h"
 #include "acevents.h"
@@ -511,7 +511,7 @@
          * At this point, the Source operand is a String, Buffer, or Package.
          * Verify that the index is within range.
          */
-        switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+        switch ((Operand[0])->Common.Type)
         {
         case ACPI_TYPE_STRING:
 
--- a/usr/src/uts/intel/io/acpica/executer/exoparg3.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg3.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- *              $Revision: 1.36 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __EXOPARG3_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "acparser.h"
 #include "amlcode.h"
@@ -256,7 +256,7 @@
          * either a String or a Buffer, so just use its type.
          */
         ReturnDesc = AcpiUtCreateInternalObject (
-                        ACPI_GET_OBJECT_TYPE (Operand[0]));
+                        (Operand[0])->Common.Type);
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
@@ -287,7 +287,7 @@
 
         /* Strings always have a sub-pointer, not so for buffers */
 
-        switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+        switch ((Operand[0])->Common.Type)
         {
         case ACPI_TYPE_STRING:
 
--- a/usr/src/uts/intel/io/acpica/executer/exoparg6.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exoparg6.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exoparg6 - AML execution - opcodes with 6 arguments
- *              $Revision: 1.30 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __EXOPARG6_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "acparser.h"
 #include "amlcode.h"
--- a/usr/src/uts/intel/io/acpica/executer/exprep.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exprep.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- *              $Revision: 1.144 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXPREP_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 #include "acnamesp.h"
@@ -367,7 +367,7 @@
         return_UINT32 (0);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
+    if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
     {
         /*
          * BufferField access can be on any byte boundary, so the
--- a/usr/src/uts/intel/io/acpica/executer/exregion.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exregion.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exregion - ACPI default OpRegion (address space) handlers
- *              $Revision: 1.103 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __EXREGION_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 
 
@@ -384,14 +384,14 @@
     {
     case ACPI_READ:
 
-        Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address,
+        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address,
                     &Value32, BitWidth);
         *Value = Value32;
         break;
 
     case ACPI_WRITE:
 
-        Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address,
+        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address,
                     (UINT32) *Value, BitWidth);
         break;
 
--- a/usr/src/uts/intel/io/acpica/executer/exresnte.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exresnte.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exresnte - AML Interpreter object resolution
- *              $Revision: 1.78 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXRESNTE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acinterp.h"
 #include "acnamesp.h"
@@ -220,7 +220,7 @@
     {
     case ACPI_TYPE_PACKAGE:
 
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
+        if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
         {
             ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
                 AcpiUtGetObjectTypeName (SourceDesc)));
@@ -240,7 +240,7 @@
 
     case ACPI_TYPE_BUFFER:
 
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
+        if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
         {
             ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
                 AcpiUtGetObjectTypeName (SourceDesc)));
@@ -260,7 +260,7 @@
 
     case ACPI_TYPE_STRING:
 
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
+        if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
         {
             ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
                 AcpiUtGetObjectTypeName (SourceDesc)));
@@ -276,7 +276,7 @@
 
     case ACPI_TYPE_INTEGER:
 
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
+        if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
         {
             ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
                 AcpiUtGetObjectTypeName (SourceDesc)));
--- a/usr/src/uts/intel/io/acpica/executer/exresolv.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exresolv.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exresolv - AML Interpreter object resolution
- *              $Revision: 1.146 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXRESOLV_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acdispat.h"
 #include "acinterp.h"
@@ -239,7 +239,7 @@
 
     /* This is an ACPI_OPERAND_OBJECT  */
 
-    switch (ACPI_GET_OBJECT_TYPE (StackDesc))
+    switch (StackDesc->Common.Type)
     {
     case ACPI_TYPE_LOCAL_REFERENCE:
 
@@ -392,7 +392,7 @@
     case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
-            StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
+            StackDesc, StackDesc->Common.Type));
 
         Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
 
@@ -480,7 +480,7 @@
      * specification of the ObjectType and SizeOf operators). This means
      * traversing the list of possibly many nested references.
      */
-    while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE)
+    while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
     {
         switch (ObjDesc->Reference.Class)
         {
@@ -614,7 +614,7 @@
      * Now we are guaranteed to have an object that has not been created
      * via the RefOf or Index operators.
      */
-    Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
+    Type = ObjDesc->Common.Type;
 
 
 Exit:
--- a/usr/src/uts/intel/io/acpica/executer/exresop.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exresop.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exresop - AML Interpreter operand/object resolution
- *              $Revision: 1.96 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXRESOP_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acparser.h"
 #include "acinterp.h"
@@ -302,7 +302,7 @@
 
             /* ACPI internal object */
 
-            ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
+            ObjectType = ObjDesc->Common.Type;
 
             /* Check for bad ACPI_OBJECT_TYPE */
 
@@ -375,7 +375,7 @@
         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
 
             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
-                (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
+                (ObjDesc->Common.Type == ACPI_TYPE_STRING))
             {
                 /*
                  * String found - the string references a named object and
@@ -425,7 +425,7 @@
              * -- All others must be resolved below.
              */
             if ((Opcode == AML_STORE_OP) &&
-                (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
+                ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
             {
                 goto NextOperand;
@@ -590,7 +590,7 @@
 
             /* Need an operand of type INTEGER, STRING or BUFFER */
 
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_INTEGER:
             case ACPI_TYPE_STRING:
@@ -613,7 +613,7 @@
 
             /* Need an operand of type STRING or BUFFER */
 
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_STRING:
             case ACPI_TYPE_BUFFER:
@@ -655,7 +655,7 @@
              * The only reference allowed here is a direct reference to
              * a namespace node.
              */
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_PACKAGE:
             case ACPI_TYPE_STRING:
@@ -679,7 +679,7 @@
 
             /* Need a buffer or package or (ACPI 2.0) String */
 
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_PACKAGE:
             case ACPI_TYPE_STRING:
@@ -702,7 +702,7 @@
 
             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
 
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_BUFFER:
             case ACPI_TYPE_REGION:
@@ -724,7 +724,7 @@
 
             /* Used by the Store() operator only */
 
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_INTEGER:
             case ACPI_TYPE_PACKAGE:
@@ -784,7 +784,7 @@
          * required object type (Simple cases only).
          */
         Status = AcpiExCheckObjectType (TypeNeeded,
-                        ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
+                        (*StackPtr)->Common.Type, *StackPtr);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
--- a/usr/src/uts/intel/io/acpica/executer/exstore.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exstore.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exstore - AML Interpreter object store support
- *              $Revision: 1.210 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXSTORE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdispat.h"
 #include "acinterp.h"
 #include "amlcode.h"
@@ -216,7 +216,7 @@
 
     /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
 
-    switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+    switch (SourceDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
@@ -279,9 +279,11 @@
 
         case ACPI_REFCLASS_TABLE:
 
+            /* Case for DdbHandle */
+
             ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n",
                 SourceDesc->Reference.Value));
-            break;
+            return;
 
         default:
             break;
@@ -410,7 +412,7 @@
 
     /* Destination object must be a Reference or a Constant object */
 
-    switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+    switch (DestDesc->Common.Type)
     {
     case ACPI_TYPE_LOCAL_REFERENCE:
         break;
@@ -551,7 +553,7 @@
          */
         ObjDesc = *(IndexDesc->Reference.Where);
 
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE &&
+        if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE &&
             SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)
         {
             /* This is a DDBHandle, just add a reference to it */
@@ -615,8 +617,8 @@
          * by the INDEX_OP code.
          */
         ObjDesc = IndexDesc->Reference.Object;
-        if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) &&
-            (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING))
+        if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&
+            (ObjDesc->Common.Type != ACPI_TYPE_STRING))
         {
             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
         }
@@ -625,7 +627,7 @@
          * The assignment of the individual elements will be slightly
          * different for each source type.
          */
-        switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+        switch (SourceDesc->Common.Type)
         {
         case ACPI_TYPE_INTEGER:
 
@@ -810,7 +812,7 @@
         /* No conversions for all other types.  Just attach the source object */
 
         Status = AcpiNsAttachObject (Node, SourceDesc,
-                    ACPI_GET_OBJECT_TYPE (SourceDesc));
+                    SourceDesc->Common.Type);
         break;
     }
 
--- a/usr/src/uts/intel/io/acpica/executer/exstoren.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exstoren.c	Fri Jun 26 17:26:34 2009 -0700
@@ -3,7 +3,6 @@
  *
  * Module Name: exstoren - AML Interpreter object store support,
  *                        Store to Node (namespace object)
- *              $Revision: 1.72 $
  *
  *****************************************************************************/
 
@@ -11,7 +10,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __EXSTOREN_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 
@@ -177,7 +177,7 @@
          * are all essentially the same.  This case handles the
          * "interchangeable" types Integer, String, and Buffer.
          */
-        if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE)
+        if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
         {
             /* Resolve a reference object first */
 
@@ -197,10 +197,10 @@
 
         /* Must have a Integer, Buffer, or String */
 
-        if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)    &&
-            (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)     &&
-            (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)     &&
-            !((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) &&
+        if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER)    &&
+            (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)     &&
+            (SourceDesc->Common.Type != ACPI_TYPE_STRING)     &&
+            !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
                     (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE)))
         {
             /* Conversion successful but still not a valid type */
@@ -301,7 +301,7 @@
         return_ACPI_STATUS (Status);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc))
+    if (SourceDesc->Common.Type != DestDesc->Common.Type)
     {
         /*
          * The source type does not match the type of the destination.
@@ -312,7 +312,7 @@
          * Otherwise, ActualSrcDesc is a temporary object to hold the
          * converted object.
          */
-        Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc),
+        Status = AcpiExConvertToTargetType (DestDesc->Common.Type,
                         SourceDesc, &ActualSrcDesc, WalkState);
         if (ACPI_FAILURE (Status))
         {
@@ -334,7 +334,7 @@
      * We now have two objects of identical types, and we can perform a
      * copy of the *value* of the source object.
      */
-    switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+    switch (DestDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
--- a/usr/src/uts/intel/io/acpica/executer/exstorob.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exstorob.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exstorob - AML Interpreter object store support, store to object
- *              $Revision: 1.63 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXSTOROB_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 
 
--- a/usr/src/uts/intel/io/acpica/executer/exsystem.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exsystem.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exsystem - Interface to OS services
- *              $Revision: 1.95 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __EXSYSTEM_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 
 #define _COMPONENT          ACPI_EXECUTER
--- a/usr/src/uts/intel/io/acpica/executer/exutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/executer/exutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: exutils - interpreter/scanner utilities
- *              $Revision: 1.131 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -134,6 +133,7 @@
 #define DEFINE_AML_GLOBALS
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
 
@@ -323,7 +323,7 @@
      */
     if ((!ObjDesc) ||
         (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) ||
-        (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
+        (ObjDesc->Common.Type != ACPI_TYPE_INTEGER))
     {
         return;
     }
--- a/usr/src/uts/intel/io/acpica/hardware/hwacpi.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/hardware/hwacpi.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- *              $Revision: 1.79 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __HWACPI_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -167,7 +167,8 @@
     if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable)
     {
         ACPI_ERROR ((AE_INFO,
-            "No ACPI mode transition supported in this system (enable/disable both zero)"));
+            "No ACPI mode transition supported in this system "
+            "(enable/disable both zero)"));
         return_ACPI_STATUS (AE_OK);
     }
 
@@ -177,7 +178,7 @@
 
         /* BIOS should have disabled ALL fixed and GP events */
 
-        Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+        Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
                         (UINT32) AcpiGbl_FADT.AcpiEnable, 8);
         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
         break;
@@ -188,7 +189,7 @@
          * BIOS should clear all fixed status bits and restore fixed event
          * enable bits to default
          */
-        Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+        Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
                     (UINT32) AcpiGbl_FADT.AcpiDisable, 8);
         ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
                     "Attempting to enable Legacy (non-ACPI) mode\n"));
@@ -260,7 +261,7 @@
         return_UINT32 (ACPI_SYS_MODE_ACPI);
     }
 
-    Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value);
+    Status = AcpiReadBitRegister (ACPI_BITREG_SCI_ENABLE, &Value);
     if (ACPI_FAILURE (Status))
     {
         return_UINT32 (ACPI_SYS_MODE_LEGACY);
--- a/usr/src/uts/intel/io/acpica/hardware/hwgpe.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/hardware/hwgpe.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
- *              $Revision: 1.76 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -126,8 +126,8 @@
 static ACPI_STATUS
 AcpiHwEnableWakeupGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock);
-
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
 
 
 /******************************************************************************
@@ -161,8 +161,7 @@
 
     /* Get current value of the enable register that contains this GPE */
 
-    Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableMask,
-                &GpeRegisterInfo->EnableAddress);
+    Status = AcpiRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
     if (ACPI_FAILURE (Status))
     {
         return (Status);
@@ -170,15 +169,13 @@
 
     /* Clear just the bit that corresponds to this GPE */
 
-    ACPI_CLEAR_BIT (EnableMask,
-        ((UINT32) 1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
+    ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 <<
+        (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
 
 
     /* Write the updated enable mask */
 
-    Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, EnableMask,
-                &GpeRegisterInfo->EnableAddress);
-
+    Status = AcpiWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
     return (Status);
 }
 
@@ -218,7 +215,7 @@
 
     /* Write the entire GPE (runtime) enable register */
 
-    Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->EnableForRun,
+    Status = AcpiWrite (GpeRegisterInfo->EnableForRun,
                     &GpeRegisterInfo->EnableAddress);
 
     return (Status);
@@ -248,14 +245,14 @@
     ACPI_FUNCTION_ENTRY ();
 
 
-    RegisterBit = (UINT8)
-        (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
+    RegisterBit = (UINT8) (1 <<
+        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
 
     /*
      * Write a one to the appropriate bit in the status register to
      * clear this GPE.
      */
-    Status = AcpiHwLowLevelWrite (8, RegisterBit,
+    Status = AcpiWrite (RegisterBit,
                     &GpeEventInfo->RegisterInfo->StatusAddress);
 
     return (Status);
@@ -301,8 +298,8 @@
 
     /* Get the register bitmask for this GPE */
 
-    RegisterBit = (UINT8)
-        (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
+    RegisterBit = (UINT8) (1 <<
+        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
 
     /* GPE currently enabled? (enabled for runtime?) */
 
@@ -320,7 +317,7 @@
 
     /* GPE currently active (status bit == 1)? */
 
-    Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress);
+    Status = AcpiRead (&InByte, &GpeRegisterInfo->StatusAddress);
     if (ACPI_FAILURE (Status))
     {
         goto UnlockAndExit;
@@ -357,7 +354,8 @@
 ACPI_STATUS
 AcpiHwDisableGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock)
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
 {
     UINT32                  i;
     ACPI_STATUS             Status;
@@ -369,8 +367,7 @@
     {
         /* Disable all GPEs in this register */
 
-        Status = AcpiHwLowLevelWrite (8, 0x00,
-                    &GpeBlock->RegisterInfo[i].EnableAddress);
+        Status = AcpiWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
@@ -397,7 +394,8 @@
 ACPI_STATUS
 AcpiHwClearGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock)
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
 {
     UINT32                  i;
     ACPI_STATUS             Status;
@@ -409,8 +407,7 @@
     {
         /* Clear status on all GPEs in this register */
 
-        Status = AcpiHwLowLevelWrite (8, 0xFF,
-                    &GpeBlock->RegisterInfo[i].StatusAddress);
+        Status = AcpiWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
@@ -438,7 +435,8 @@
 ACPI_STATUS
 AcpiHwEnableRuntimeGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock)
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
 {
     UINT32                  i;
     ACPI_STATUS             Status;
@@ -457,7 +455,7 @@
 
         /* Enable all "runtime" GPEs in this register */
 
-        Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForRun,
+        Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForRun,
                     &GpeBlock->RegisterInfo[i].EnableAddress);
         if (ACPI_FAILURE (Status))
         {
@@ -486,7 +484,8 @@
 static ACPI_STATUS
 AcpiHwEnableWakeupGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock)
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context)
 {
     UINT32                  i;
     ACPI_STATUS             Status;
@@ -503,8 +502,7 @@
 
         /* Enable all "wake" GPEs in this register */
 
-        Status = AcpiHwLowLevelWrite (8,
-                    GpeBlock->RegisterInfo[i].EnableForWake,
+        Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForWake,
                     &GpeBlock->RegisterInfo[i].EnableAddress);
         if (ACPI_FAILURE (Status))
         {
@@ -538,8 +536,8 @@
     ACPI_FUNCTION_TRACE (HwDisableAllGpes);
 
 
-    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
-    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
+    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
+    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
     return_ACPI_STATUS (Status);
 }
 
@@ -566,7 +564,7 @@
     ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
 
 
-    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
+    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
     return_ACPI_STATUS (Status);
 }
 
@@ -593,7 +591,7 @@
     ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
 
 
-    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
+    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
     return_ACPI_STATUS (Status);
 }
 
--- a/usr/src/uts/intel/io/acpica/hardware/hwregs.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/hardware/hwregs.c	Fri Jun 26 17:26:34 2009 -0700
@@ -3,7 +3,6 @@
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
- *              $Revision: 1.188 $
  *
  ******************************************************************************/
 
@@ -11,7 +10,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,23 +118,37 @@
 #define __HWREGS_C__
 
 #include "acpi.h"
-#include "acnamesp.h"
+#include "accommon.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwregs")
 
 
+/* Local Prototypes */
+
+static ACPI_STATUS
+AcpiHwReadMultiple (
+    UINT32                  *Value,
+    ACPI_GENERIC_ADDRESS    *RegisterA,
+    ACPI_GENERIC_ADDRESS    *RegisterB);
+
+static ACPI_STATUS
+AcpiHwWriteMultiple (
+    UINT32                  Value,
+    ACPI_GENERIC_ADDRESS    *RegisterA,
+    ACPI_GENERIC_ADDRESS    *RegisterB);
+
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiHwClearAcpiStatus
  *
  * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
  * DESCRIPTION: Clears all fixed and general purpose status bits
- *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
 
@@ -150,12 +163,14 @@
     ACPI_FUNCTION_TRACE (HwClearAcpiStatus);
 
 
-    ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
         ACPI_BITMASK_ALL_FIXED_STATUS,
-        (UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address));
+        ACPI_FORMAT_UINT64 (AcpiGbl_XPm1aStatus.Address)));
 
     LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
 
+    /* Clear the fixed events in PM1 A/B */
+
     Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS,
                 ACPI_BITMASK_ALL_FIXED_STATUS);
     if (ACPI_FAILURE (Status))
@@ -163,21 +178,9 @@
         goto UnlockAndExit;
     }
 
-    /* Clear the fixed events */
-
-    if (AcpiGbl_FADT.XPm1bEventBlock.Address)
-    {
-        Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
-                    &AcpiGbl_FADT.XPm1bEventBlock);
-        if (ACPI_FAILURE (Status))
-        {
-            goto UnlockAndExit;
-        }
-    }
-
     /* Clear the GPE Bits in all GPE registers in all GPE blocks */
 
-    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
+    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
 
 UnlockAndExit:
     AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
@@ -187,136 +190,6 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiGetSleepTypeData
- *
- * PARAMETERS:  SleepState          - Numeric sleep state
- *              *SleepTypeA         - Where SLP_TYPa is returned
- *              *SleepTypeB         - Where SLP_TYPb is returned
- *
- * RETURN:      Status - ACPI status
- *
- * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
- *              state.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetSleepTypeData (
-    UINT8                   SleepState,
-    UINT8                   *SleepTypeA,
-    UINT8                   *SleepTypeB)
-{
-    ACPI_STATUS             Status = AE_OK;
-    ACPI_EVALUATE_INFO      *Info;
-
-
-    ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
-
-
-    /* Validate parameters */
-
-    if ((SleepState > ACPI_S_STATES_MAX) ||
-        !SleepTypeA || !SleepTypeB)
-    {
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    /* Allocate the evaluation information block */
-
-    Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
-    if (!Info)
-    {
-        return_ACPI_STATUS (AE_NO_MEMORY);
-    }
-
-    Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
-
-    /* Evaluate the namespace object containing the values for this state */
-
-    Status = AcpiNsEvaluate (Info);
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-            "%s while evaluating SleepState [%s]\n",
-            AcpiFormatException (Status), Info->Pathname));
-
-        goto Cleanup;
-    }
-
-    /* Must have a return object */
-
-    if (!Info->ReturnObject)
-    {
-        ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]",
-            Info->Pathname));
-        Status = AE_NOT_EXIST;
-    }
-
-    /* It must be of type Package */
-
-    else if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_PACKAGE)
-    {
-        ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package"));
-        Status = AE_AML_OPERAND_TYPE;
-    }
-
-    /*
-     * The package must have at least two elements. NOTE (March 2005): This
-     * goes against the current ACPI spec which defines this object as a
-     * package with one encoded DWORD element. However, existing practice
-     * by BIOS vendors seems to be to have 2 or more elements, at least
-     * one per sleep type (A/B).
-     */
-    else if (Info->ReturnObject->Package.Count < 2)
-    {
-        ACPI_ERROR ((AE_INFO,
-            "Sleep State return package does not have at least two elements"));
-        Status = AE_AML_NO_OPERAND;
-    }
-
-    /* The first two elements must both be of type Integer */
-
-    else if ((ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[0])
-                != ACPI_TYPE_INTEGER) ||
-             (ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[1])
-                != ACPI_TYPE_INTEGER))
-    {
-        ACPI_ERROR ((AE_INFO,
-            "Sleep State return package elements are not both Integers (%s, %s)",
-            AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]),
-            AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1])));
-        Status = AE_AML_OPERAND_TYPE;
-    }
-    else
-    {
-        /* Valid _Sx_ package size, type, and value */
-
-        *SleepTypeA = (UINT8)
-            (Info->ReturnObject->Package.Elements[0])->Integer.Value;
-        *SleepTypeB = (UINT8)
-            (Info->ReturnObject->Package.Elements[1])->Integer.Value;
-    }
-
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_EXCEPTION ((AE_INFO, Status,
-            "While evaluating SleepState [%s], bad Sleep object %p type %s",
-            Info->Pathname, Info->ReturnObject,
-            AcpiUtGetObjectTypeName (Info->ReturnObject)));
-    }
-
-    AcpiUtRemoveReference (Info->ReturnObject);
-
-Cleanup:
-    ACPI_FREE (Info);
-    return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData)
-
-
-/*******************************************************************************
- *
  * FUNCTION:    AcpiHwGetRegisterBitMask
  *
  * PARAMETERS:  RegisterId          - Index of ACPI Register to access
@@ -344,247 +217,47 @@
 }
 
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiGetRegisterUnlocked
- *
- * PARAMETERS:  RegisterId      - ID of ACPI BitRegister to access
- *              ReturnValue     - Value that was read from the register
- *
- * RETURN:      Status and the value read from specified Register. Value
- *              returned is normalized to bit0 (is shifted all the way right)
- *
- * DESCRIPTION: ACPI BitRegister read function. Does not acquire the HW lock.
+/******************************************************************************
  *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetRegisterUnlocked (
-    UINT32                  RegisterId,
-    UINT32                  *ReturnValue)
-{
-    UINT32                  RegisterValue = 0;
-    ACPI_BIT_REGISTER_INFO  *BitRegInfo;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (AcpiGetRegisterUnlocked);
-
-
-    /* Get the info structure corresponding to the requested ACPI Register */
-
-    BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
-    if (!BitRegInfo)
-    {
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    /* Read from the register */
-
-    Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, 
-                &RegisterValue);
-
-    if (ACPI_SUCCESS (Status))
-    {
-        /* Normalize the value that was read */
-
-        RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask)
-                            >> BitRegInfo->BitPosition);
-
-        *ReturnValue = RegisterValue;
-
-        ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
-            RegisterValue, BitRegInfo->ParentRegister));
-    }
-
-    return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
+ * FUNCTION:    AcpiHwWritePm1Control
  *
- * FUNCTION:    AcpiGetRegister
- *
- * PARAMETERS:  RegisterId      - ID of ACPI BitRegister to access
- *              ReturnValue     - Value that was read from the register
- *
- * RETURN:      Status and the value read from specified Register. Value
- *              returned is normalized to bit0 (is shifted all the way right)
- *
- * DESCRIPTION: ACPI BitRegister read function.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetRegister (
-    UINT32                  RegisterId,
-    UINT32                  *ReturnValue)
-{
-    ACPI_STATUS             Status;
-    ACPI_CPU_FLAGS          Flags;
-
-
-    Flags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
-    Status = AcpiGetRegisterUnlocked (RegisterId, ReturnValue);
-    AcpiOsReleaseLock (AcpiGbl_HardwareLock, Flags);
-
-    return (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiGetRegister)
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiSetRegister
- *
- * PARAMETERS:  RegisterId      - ID of ACPI BitRegister to access
- *              Value           - (only used on write) value to write to the
- *                                Register, NOT pre-normalized to the bit pos
+ * PARAMETERS:  Pm1aControl         - Value to be written to PM1A control
+ *              Pm1bControl         - Value to be written to PM1B control
  *
  * RETURN:      Status
  *
- * DESCRIPTION: ACPI Bit Register write function.
+ * DESCRIPTION: Write the PM1 A/B control registers. These registers are
+ *              different than than the PM1 A/B status and enable registers
+ *              in that different values can be written to the A/B registers.
+ *              Most notably, the SLP_TYP bits can be different, as per the
+ *              values returned from the _Sx predefined methods.
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiSetRegister (
-    UINT32                  RegisterId,
-    UINT32                  Value)
+AcpiHwWritePm1Control (
+    UINT32                  Pm1aControl,
+    UINT32                  Pm1bControl)
 {
-    UINT32                  RegisterValue = 0;
-    ACPI_BIT_REGISTER_INFO  *BitRegInfo;
     ACPI_STATUS             Status;
-    ACPI_CPU_FLAGS          LockFlags;
-
-
-    ACPI_FUNCTION_TRACE_U32 (AcpiSetRegister, RegisterId);
 
 
-    /* Get the info structure corresponding to the requested ACPI Register */
-
-    BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
-    if (!BitRegInfo)
-    {
-        ACPI_ERROR ((AE_INFO, "Bad ACPI HW RegisterId: %X", RegisterId));
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
-
-    /* Always do a register read first so we can insert the new bits  */
-
-    Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, 
-                &RegisterValue);
-    if (ACPI_FAILURE (Status))
-    {
-        goto UnlockAndExit;
-    }
-
-    /*
-     * Decode the Register ID
-     * Register ID = [Register block ID] | [bit ID]
-     *
-     * Check bit ID to fine locate Register offset.
-     * Check Mask to determine Register offset, and then read-write.
-     */
-    switch (BitRegInfo->ParentRegister)
-    {
-    case ACPI_REGISTER_PM1_STATUS:
-
-        /*
-         * Status Registers are different from the rest. Clear by
-         * writing 1, and writing 0 has no effect. So, the only relevant
-         * information is the single bit we're interested in, all others should
-         * be written as 0 so they will be left unchanged.
-         */
-        Value = ACPI_REGISTER_PREPARE_BITS (Value,
-                    BitRegInfo->BitPosition, BitRegInfo->AccessBitMask);
-        if (Value)
-        {
-            Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, 
-                        (UINT16) Value);
-            RegisterValue = 0;
-        }
-        break;
+    ACPI_FUNCTION_TRACE (HwWritePm1Control);
 
 
-    case ACPI_REGISTER_PM1_ENABLE:
-
-        ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
-            BitRegInfo->AccessBitMask, Value);
-
-        Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_ENABLE, 
-                    (UINT16) RegisterValue);
-        break;
-
-
-    case ACPI_REGISTER_PM1_CONTROL:
-
-        /*
-         * Write the PM1 Control register.
-         * Note that at this level, the fact that there are actually TWO
-         * registers (A and B - and B may not exist) is abstracted.
-         */
-        ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n",
-            RegisterValue));
-
-        ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
-            BitRegInfo->AccessBitMask, Value);
-
-        Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_CONTROL, 
-                    (UINT16) RegisterValue);
-        break;
-
-
-    case ACPI_REGISTER_PM2_CONTROL:
-
-        Status = AcpiHwRegisterRead (ACPI_REGISTER_PM2_CONTROL, 
-                    &RegisterValue);
-        if (ACPI_FAILURE (Status))
-        {
-            goto UnlockAndExit;
-        }
-
-        ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
-            RegisterValue,
-            ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
-
-        ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
-                BitRegInfo->AccessBitMask, Value);
-
-        ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
-            RegisterValue,
-            ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
-
-        Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM2_CONTROL, 
-                    (UINT8) (RegisterValue));
-        break;
-
-
-    default:
-        break;
+    Status = AcpiWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
     }
 
-
-UnlockAndExit:
-
-    AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
-
-    /* Normalize the value that was read */
-
-    ACPI_DEBUG_EXEC (RegisterValue =
-        ((RegisterValue & BitRegInfo->AccessBitMask) >>
-            BitRegInfo->BitPosition));
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
-        Value, RegisterValue, BitRegInfo->ParentRegister));
+    if (AcpiGbl_FADT.XPm1bControlBlock.Address)
+    {
+        Status = AcpiWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock);
+    }
     return_ACPI_STATUS (Status);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiSetRegister)
-
 
 /******************************************************************************
  *
@@ -604,8 +277,7 @@
     UINT32                  RegisterId,
     UINT32                  *ReturnValue)
 {
-    UINT32                  Value1 = 0;
-    UINT32                  Value2 = 0;
+    UINT32                  Value = 0;
     ACPI_STATUS             Status;
 
 
@@ -614,65 +286,55 @@
 
     switch (RegisterId)
     {
-    case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
+    case ACPI_REGISTER_PM1_STATUS:           /* PM1 A/B: 16-bit access each */
 
-        Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aEventBlock);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        /* PM1B is optional */
-
-        Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bEventBlock);
-        Value1 |= Value2;
+        Status = AcpiHwReadMultiple (&Value,
+                    &AcpiGbl_XPm1aStatus,
+                    &AcpiGbl_XPm1bStatus);
         break;
 
 
-    case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access */
+    case ACPI_REGISTER_PM1_ENABLE:           /* PM1 A/B: 16-bit access each */
 
-        Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_XPm1aEnable);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        /* PM1B is optional */
-
-        Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_XPm1bEnable);
-        Value1 |= Value2;
+        Status = AcpiHwReadMultiple (&Value,
+                    &AcpiGbl_XPm1aEnable,
+                    &AcpiGbl_XPm1bEnable);
         break;
 
 
-    case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
+    case ACPI_REGISTER_PM1_CONTROL:          /* PM1 A/B: 16-bit access each */
+
+        Status = AcpiHwReadMultiple (&Value,
+                    &AcpiGbl_FADT.XPm1aControlBlock,
+                    &AcpiGbl_FADT.XPm1bControlBlock);
 
-        Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aControlBlock);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bControlBlock);
-        Value1 |= Value2;
+        /*
+         * Zero the write-only bits. From the ACPI specification, "Hardware
+         * Write-Only Bits": "Upon reads to registers with write-only bits,
+         * software masks out all write-only bits."
+         */
+        Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
         break;
 
 
     case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
 
-        Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT.XPm2ControlBlock);
+        Status = AcpiRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock);
         break;
 
 
     case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
 
-        Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT.XPmTimerBlock);
+        Status = AcpiRead (&Value, &AcpiGbl_FADT.XPmTimerBlock);
         break;
 
+
     case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
 
-        Status = AcpiOsReadPort (AcpiGbl_FADT.SmiCommand, &Value1, 8);
+        Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8);
         break;
 
+
     default:
         ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
             RegisterId));
@@ -680,10 +342,9 @@
         break;
     }
 
-Exit:
     if (ACPI_SUCCESS (Status))
     {
-        *ReturnValue = Value1;
+        *ReturnValue = Value;
     }
 
     return_ACPI_STATUS (Status);
@@ -730,58 +391,42 @@
 
     switch (RegisterId)
     {
-    case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
-
-        /* Perform a read first to preserve certain bits (per ACPI spec) */
-
-        Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, 
-                    &ReadValue);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        /* Insert the bits to be preserved */
+    case ACPI_REGISTER_PM1_STATUS:           /* PM1 A/B: 16-bit access each */
+        /*
+         * Handle the "ignored" bit in PM1 Status. According to the ACPI
+         * specification, ignored bits are to be preserved when writing.
+         * Normally, this would mean a read/modify/write sequence. However,
+         * preserving a bit in the status register is different. Writing a
+         * one clears the status, and writing a zero preserves the status.
+         * Therefore, we must always write zero to the ignored bit.
+         *
+         * This behavior is clarified in the ACPI 4.0 specification.
+         */
+        Value &= ~ACPI_PM1_STATUS_PRESERVED_BITS;
 
-        ACPI_INSERT_BITS (Value, ACPI_PM1_STATUS_PRESERVED_BITS, ReadValue);
-
-        /* Now we can write the data */
-
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aEventBlock);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        /* PM1B is optional */
-
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bEventBlock);
+        Status = AcpiHwWriteMultiple (Value,
+                    &AcpiGbl_XPm1aStatus,
+                    &AcpiGbl_XPm1bStatus);
         break;
 
 
-    case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access */
+    case ACPI_REGISTER_PM1_ENABLE:           /* PM1 A/B: 16-bit access each */
 
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
-        if (ACPI_FAILURE (Status))
-        {
-            goto Exit;
-        }
-
-        /* PM1B is optional */
-
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1bEnable);
+        Status = AcpiHwWriteMultiple (Value,
+                    &AcpiGbl_XPm1aEnable,
+                    &AcpiGbl_XPm1bEnable);
         break;
 
 
-    case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
+    case ACPI_REGISTER_PM1_CONTROL:          /* PM1 A/B: 16-bit access each */
 
         /*
          * Perform a read first to preserve certain bits (per ACPI spec)
-         *
          * Note: This includes SCI_EN, we never want to change this bit
          */
-        Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, 
-                    &ReadValue);
+        Status = AcpiHwReadMultiple (&ReadValue,
+                    &AcpiGbl_FADT.XPm1aControlBlock,
+                    &AcpiGbl_FADT.XPm1bControlBlock);
         if (ACPI_FAILURE (Status))
         {
             goto Exit;
@@ -793,37 +438,35 @@
 
         /* Now we can write the data */
 
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
+        Status = AcpiHwWriteMultiple (Value,
+                    &AcpiGbl_FADT.XPm1aControlBlock,
+                    &AcpiGbl_FADT.XPm1bControlBlock);
+        break;
+
+
+    case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
+
+        /*
+         * For control registers, all reserved bits must be preserved,
+         * as per the ACPI spec.
+         */
+        Status = AcpiRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock);
         if (ACPI_FAILURE (Status))
         {
             goto Exit;
         }
 
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
-        break;
-
-
-    case ACPI_REGISTER_PM1A_CONTROL:         /* 16-bit access */
-
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
-        break;
-
+        /* Insert the bits to be preserved */
 
-    case ACPI_REGISTER_PM1B_CONTROL:         /* 16-bit access */
-
-        Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
-        break;
+        ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue);
 
-
-    case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
-        Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT.XPm2ControlBlock);
+        Status = AcpiWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock);
         break;
 
 
     case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
 
-        Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT.XPmTimerBlock);
+        Status = AcpiWrite (Value, &AcpiGbl_FADT.XPmTimerBlock);
         break;
 
 
@@ -831,11 +474,13 @@
 
         /* SMI_CMD is currently always in IO space */
 
-        Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
+        Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
         break;
 
 
     default:
+        ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
+            RegisterId));
         Status = AE_BAD_PARAMETER;
         break;
     }
@@ -847,159 +492,111 @@
 
 /******************************************************************************
  *
- * FUNCTION:    AcpiHwLowLevelRead
+ * FUNCTION:    AcpiHwReadMultiple
  *
- * PARAMETERS:  Width               - 8, 16, or 32
- *              Value               - Where the value is returned
- *              Reg                 - GAS register structure
+ * PARAMETERS:  Value               - Where the register value is returned
+ *              RegisterA           - First ACPI register (required)
+ *              RegisterB           - Second ACPI register (optional)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Read from either memory or IO space.
+ * DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B)
  *
  ******************************************************************************/
 
-ACPI_STATUS
-AcpiHwLowLevelRead (
-    UINT32                  Width,
+static ACPI_STATUS
+AcpiHwReadMultiple (
     UINT32                  *Value,
-    ACPI_GENERIC_ADDRESS    *Reg)
+    ACPI_GENERIC_ADDRESS    *RegisterA,
+    ACPI_GENERIC_ADDRESS    *RegisterB)
 {
-    UINT64                  Address;
+    UINT32                  ValueA = 0;
+    UINT32                  ValueB = 0;
     ACPI_STATUS             Status;
 
 
-    ACPI_FUNCTION_NAME (HwLowLevelRead);
-
+    /* The first register is always required */
 
-    /*
-     * Must have a valid pointer to a GAS structure, and
-     * a non-zero address within. However, don't return an error
-     * because the PM1A/B code must not fail if B isn't present.
-     */
-    if (!Reg)
+    Status = AcpiRead (&ValueA, RegisterA);
+    if (ACPI_FAILURE (Status))
     {
-        return (AE_OK);
+        return (Status);
     }
 
-    /* Get a local copy of the address. Handles possible alignment issues */
+    /* Second register is optional */
 
-    ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
-    if (!Address)
+    if (RegisterB->Address)
     {
-        return (AE_OK);
+        Status = AcpiRead (&ValueB, RegisterB);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
     }
-    *Value = 0;
 
     /*
-     * Two address spaces supported: Memory or IO.
-     * PCI_Config is not supported here because the GAS struct is insufficient
+     * OR the two return values together. No shifting or masking is necessary,
+     * because of how the PM1 registers are defined in the ACPI specification:
+     *
+     * "Although the bits can be split between the two register blocks (each
+     * register block has a unique pointer within the FADT), the bit positions
+     * are maintained. The register block with unimplemented bits (that is,
+     * those implemented in the other register block) always returns zeros,
+     * and writes have no side effects"
      */
-    switch (Reg->SpaceId)
-    {
-    case ACPI_ADR_SPACE_SYSTEM_MEMORY:
-
-        Status = AcpiOsReadMemory (
-                    (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
-        break;
-
-
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-
-        Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width);
-        break;
-
-
-    default:
-        ACPI_ERROR ((AE_INFO,
-            "Unsupported address space: %X", Reg->SpaceId));
-        return (AE_BAD_PARAMETER);
-    }
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-        "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-        *Value, Width, ACPI_FORMAT_UINT64 (Address),
-        AcpiUtGetRegionName (Reg->SpaceId)));
-
-    return (Status);
+    *Value = (ValueA | ValueB);
+    return (AE_OK);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AcpiHwLowLevelWrite
+ * FUNCTION:    AcpiHwWriteMultiple
  *
- * PARAMETERS:  Width               - 8, 16, or 32
- *              Value               - To be written
- *              Reg                 - GAS register structure
+ * PARAMETERS:  Value               - The value to write
+ *              RegisterA           - First ACPI register (required)
+ *              RegisterB           - Second ACPI register (optional)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Write to either memory or IO space.
+ * DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B)
  *
  ******************************************************************************/
 
-ACPI_STATUS
-AcpiHwLowLevelWrite (
-    UINT32                  Width,
+static ACPI_STATUS
+AcpiHwWriteMultiple (
     UINT32                  Value,
-    ACPI_GENERIC_ADDRESS    *Reg)
+    ACPI_GENERIC_ADDRESS    *RegisterA,
+    ACPI_GENERIC_ADDRESS    *RegisterB)
 {
-    UINT64                  Address;
     ACPI_STATUS             Status;
 
 
-    ACPI_FUNCTION_NAME (HwLowLevelWrite);
-
+    /* The first register is always required */
 
-    /*
-     * Must have a valid pointer to a GAS structure, and
-     * a non-zero address within. However, don't return an error
-     * because the PM1A/B code must not fail if B isn't present.
-     */
-    if (!Reg)
+    Status = AcpiWrite (Value, RegisterA);
+    if (ACPI_FAILURE (Status))
     {
-        return (AE_OK);
-    }
-
-    /* Get a local copy of the address. Handles possible alignment issues */
-
-    ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
-    if (!Address)
-    {
-        return (AE_OK);
+        return (Status);
     }
 
     /*
-     * Two address spaces supported: Memory or IO.
-     * PCI_Config is not supported here because the GAS struct is insufficient
+     * Second register is optional
+     *
+     * No bit shifting or clearing is necessary, because of how the PM1
+     * registers are defined in the ACPI specification:
+     *
+     * "Although the bits can be split between the two register blocks (each
+     * register block has a unique pointer within the FADT), the bit positions
+     * are maintained. The register block with unimplemented bits (that is,
+     * those implemented in the other register block) always returns zeros,
+     * and writes have no side effects"
      */
-    switch (Reg->SpaceId)
+    if (RegisterB->Address)
     {
-    case ACPI_ADR_SPACE_SYSTEM_MEMORY:
-
-        Status = AcpiOsWriteMemory (
-                    (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
-        break;
-
-
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-
-        Status = AcpiOsWritePort (
-                    (ACPI_IO_ADDRESS) Address, Value, Width);
-        break;
-
-
-    default:
-        ACPI_ERROR ((AE_INFO,
-            "Unsupported address space: %X", Reg->SpaceId));
-        return (AE_BAD_PARAMETER);
+        Status = AcpiWrite (Value, RegisterB);
     }
 
-    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-        "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-        Value, Width, ACPI_FORMAT_UINT64 (Address),
-        AcpiUtGetRegionName (Reg->SpaceId)));
-
     return (Status);
 }
+
--- a/usr/src/uts/intel/io/acpica/hardware/hwsleep.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/hardware/hwsleep.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- *              $Revision: 1.89 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwsleep")
@@ -125,50 +125,31 @@
  *
  * FUNCTION:    AcpiSetFirmwareWakingVector
  *
- * PARAMETERS:  PhysicalAddress     - Physical address of ACPI real mode
+ * PARAMETERS:  PhysicalAddress     - 32-bit physical address of ACPI real mode
  *                                    entry point.
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
+ * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS
  *
  ******************************************************************************/
 
 ACPI_STATUS
 AcpiSetFirmwareWakingVector (
-    ACPI_PHYSICAL_ADDRESS   PhysicalAddress)
+    UINT32                  PhysicalAddress)
 {
-    ACPI_TABLE_FACS         *Facs;
-    ACPI_STATUS             Status;
-
-
     ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
 
-    /* Get the FACS */
 
-    Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
-                ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
+    /* Set the 32-bit vector */
 
-    /* Set the vector */
+    AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;
 
-    if ((Facs->Length < 32) ||
-        (!(Facs->XFirmwareWakingVector)))
+    /* Clear the 64-bit vector if it exists */
+
+    if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1))
     {
-        /*
-         * ACPI 1.0 FACS or short table or optional X_ field is zero
-         */
-        Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
-    }
-    else
-    {
-        /*
-         * ACPI 2.0 FACS with valid X_ field
-         */
-        Facs->XFirmwareWakingVector = PhysicalAddress;
+        AcpiGbl_FACS->XFirmwareWakingVector = 0;
     }
 
     return_ACPI_STATUS (AE_OK);
@@ -177,69 +158,45 @@
 ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
 
 
+#if ACPI_MACHINE_WIDTH == 64
 /*******************************************************************************
  *
- * FUNCTION:    AcpiGetFirmwareWakingVector
+ * FUNCTION:    AcpiSetFirmwareWakingVector64
+ *
+ * PARAMETERS:  PhysicalAddress     - 64-bit physical address of ACPI protected
+ *                                    mode entry point.
  *
- * PARAMETERS:  *PhysicalAddress    - Where the contents of
- *                                    the FirmwareWakingVector field of
- *                                    the FACS will be returned.
+ * RETURN:      Status
  *
- * RETURN:      Status, vector
- *
- * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
+ * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if
+ *              it exists in the table. This function is intended for use with
+ *              64-bit host operating systems.
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiGetFirmwareWakingVector (
-    ACPI_PHYSICAL_ADDRESS   *PhysicalAddress)
+AcpiSetFirmwareWakingVector64 (
+    UINT64                  PhysicalAddress)
 {
-    ACPI_TABLE_FACS         *Facs;
-    ACPI_STATUS             Status;
+    ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64);
 
 
-    ACPI_FUNCTION_TRACE (AcpiGetFirmwareWakingVector);
-
+    /* Determine if the 64-bit vector actually exists */
 
-    if (!PhysicalAddress)
+    if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1))
     {
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
+        return_ACPI_STATUS (AE_NOT_EXIST);
     }
 
-    /* Get the FACS */
-
-    Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
-                ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    /* Get the vector */
+    /* Clear 32-bit vector, set the 64-bit X_ vector */
 
-    if ((Facs->Length < 32) ||
-        (!(Facs->XFirmwareWakingVector)))
-    {
-        /*
-         * ACPI 1.0 FACS or short table or optional X_ field is zero
-         */
-        *PhysicalAddress =
-            (ACPI_PHYSICAL_ADDRESS) Facs->FirmwareWakingVector;
-    }
-    else
-    {
-        /*
-         * ACPI 2.0 FACS with valid X_ field
-         */
-        *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) Facs->XFirmwareWakingVector;
-    }
-
+    AcpiGbl_FACS->FirmwareWakingVector = 0;
+    AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress;
     return_ACPI_STATUS (AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiGetFirmwareWakingVector)
-
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64)
+#endif
 
 /*******************************************************************************
  *
@@ -268,9 +225,8 @@
     ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
 
 
-    /*
-     * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
-     */
+    /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */
+
     Status = AcpiGetSleepTypeData (SleepState,
                     &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
     if (ACPI_FAILURE (Status))
@@ -347,8 +303,8 @@
 AcpiEnterSleepState (
     UINT8                   SleepState)
 {
-    UINT32                  PM1AControl;
-    UINT32                  PM1BControl;
+    UINT32                  Pm1aControl;
+    UINT32                  Pm1bControl;
     ACPI_BIT_REGISTER_INFO  *SleepTypeRegInfo;
     ACPI_BIT_REGISTER_INFO  *SleepEnableRegInfo;
     UINT32                  InValue;
@@ -368,12 +324,12 @@
         return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
     }
 
-    SleepTypeRegInfo   = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A);
+    SleepTypeRegInfo   = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE);
     SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
 
     /* Clear wake status */
 
-    Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
+    Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -391,7 +347,7 @@
     {
         /* Disable BM arbitration */
 
-        Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1);
+        Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -430,8 +386,8 @@
 
     /* Get current value of PM1A control */
 
-    Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, 
-                &PM1AControl);
+    Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL,
+                &Pm1aControl);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -439,56 +395,42 @@
     ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
         "Entering sleep state [S%d]\n", SleepState));
 
-    /* Clear SLP_EN and SLP_TYP fields */
+    /* Clear the SLP_EN and SLP_TYP fields */
 
-    PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask |
+    Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask |
                      SleepEnableRegInfo->AccessBitMask);
-    PM1BControl = PM1AControl;
+    Pm1bControl = Pm1aControl;
 
-    /* Insert SLP_TYP bits */
+    /* Insert the SLP_TYP bits */
 
-    PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition);
-    PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition);
+    Pm1aControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition);
+    Pm1bControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition);
 
     /*
      * We split the writes of SLP_TYP and SLP_EN to workaround
      * poorly implemented hardware.
      */
 
-    /* Write #1: fill in SLP_TYP data */
+    /* Write #1: write the SLP_TYP data to the PM1 Control registers */
 
-    Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1A_CONTROL, 
-                PM1AControl);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1B_CONTROL, 
-                PM1BControl);
+    Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
 
-    /* Insert SLP_ENABLE bit */
+    /* Insert the sleep enable (SLP_EN) bit */
 
-    PM1AControl |= SleepEnableRegInfo->AccessBitMask;
-    PM1BControl |= SleepEnableRegInfo->AccessBitMask;
+    Pm1aControl |= SleepEnableRegInfo->AccessBitMask;
+    Pm1bControl |= SleepEnableRegInfo->AccessBitMask;
 
-    /* Write #2: SLP_TYP + SLP_EN */
+    /* Flush caches, as per ACPI specification */
 
     ACPI_FLUSH_CPU_CACHE ();
 
-    Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1A_CONTROL, 
-                PM1AControl);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
+    /* Write #2: Write both SLP_TYP + SLP_EN */
 
-    Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1B_CONTROL, 
-                PM1BControl);
+    Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -503,8 +445,8 @@
          * Wait ten seconds, then try again. This is to get S4/S5 to work on
          * all machines.
          *
-         * We wait so long to allow chipsets that poll this reg very slowly to
-         * still read the right value. Ideally, this block would go
+         * We wait so long to allow chipsets that poll this reg very slowly
+         * to still read the right value. Ideally, this block would go
          * away entirely.
          */
         AcpiOsStall (10000000);
@@ -521,7 +463,7 @@
 
     do
     {
-        Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
+        Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -561,7 +503,9 @@
     ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
 
 
-    Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
+    /* Clear the wake status bit (PM1) */
+
+    Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -592,12 +536,12 @@
 
     ACPI_FLUSH_CPU_CACHE ();
 
-    Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+    Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand,
                 (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
 
     do {
         AcpiOsStall(1000);
-        Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
+        Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -632,8 +576,8 @@
     ACPI_STATUS             Status;
     ACPI_BIT_REGISTER_INFO  *SleepTypeRegInfo;
     ACPI_BIT_REGISTER_INFO  *SleepEnableRegInfo;
-    UINT32                  PM1AControl;
-    UINT32                  PM1BControl;
+    UINT32                  Pm1aControl;
+    UINT32                  Pm1bControl;
 
 
     ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
@@ -648,32 +592,33 @@
                     &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB);
     if (ACPI_SUCCESS (Status))
     {
-        SleepTypeRegInfo   = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A);
-        SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
+        SleepTypeRegInfo =
+            AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE);
+        SleepEnableRegInfo =
+            AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE);
 
         /* Get current value of PM1A control */
 
-        Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, 
-                    &PM1AControl);
+        Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL,
+                    &Pm1aControl);
         if (ACPI_SUCCESS (Status))
         {
-            /* Clear SLP_EN and SLP_TYP fields */
+            /* Clear the SLP_EN and SLP_TYP fields */
 
-            PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask |
-                             SleepEnableRegInfo->AccessBitMask);
-            PM1BControl = PM1AControl;
+            Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask |
+                SleepEnableRegInfo->AccessBitMask);
+            Pm1bControl = Pm1aControl;
 
-            /* Insert SLP_TYP bits */
+            /* Insert the SLP_TYP bits */
 
-            PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition);
-            PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition);
-
-            /* Just ignore any errors */
+            Pm1aControl |= (AcpiGbl_SleepTypeA <<
+                SleepTypeRegInfo->BitPosition);
+            Pm1bControl |= (AcpiGbl_SleepTypeB <<
+                SleepTypeRegInfo->BitPosition);
 
-            (void) AcpiHwRegisterWrite (ACPI_REGISTER_PM1A_CONTROL, 
-                            PM1AControl);
-            (void) AcpiHwRegisterWrite (ACPI_REGISTER_PM1B_CONTROL, 
-                            PM1BControl);
+            /* Write the control registers and ignore any errors */
+
+            (void) AcpiHwWritePm1Control (Pm1aControl, Pm1bControl);
         }
     }
 
@@ -730,15 +675,17 @@
 
     /* Enable power button */
 
-    (void) AcpiSetRegister(
-            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, 1);
+    (void) AcpiWriteBitRegister(
+            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
+            ACPI_ENABLE_EVENT);
 
-    (void) AcpiSetRegister(
-            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, 1);
+    (void) AcpiWriteBitRegister(
+            AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
+            ACPI_CLEAR_STATUS);
 
     /* Enable BM arbitration */
 
-    Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0);
+    Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 0);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
--- a/usr/src/uts/intel/io/acpica/hardware/hwtimer.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/hardware/hwtimer.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Name: hwtimer.c - ACPI Power Management Timer Interface
- *              $Revision: 1.38 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
  *****************************************************************************/
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwtimer")
@@ -187,7 +187,7 @@
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
 
-    Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT.XPmTimerBlock);
+    Status = AcpiRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock);
 
     return_ACPI_STATUS (Status);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/io/acpica/hardware/hwvalid.c	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,424 @@
+
+/******************************************************************************
+ *
+ * Module Name: hwvalid - I/O request validation
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __HWVALID_C__
+
+#include "acpi.h"
+#include "accommon.h"
+
+#define _COMPONENT          ACPI_HARDWARE
+        ACPI_MODULE_NAME    ("hwvalid")
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiHwValidateIoRequest (
+    ACPI_IO_ADDRESS         Address,
+    UINT32                  BitWidth);
+
+
+/*
+ * Protected I/O ports. Some ports are always illegal, and some are
+ * conditionally illegal. This table must remain ordered by port address.
+ *
+ * The table is used to implement the Microsoft port access rules that
+ * first appeared in Windows XP. Some ports are always illegal, and some
+ * ports are only illegal if the BIOS calls _OSI with a WinXP string or
+ * later (meaning that the BIOS itelf is post-XP.)
+ *
+ * This provides ACPICA with the desired port protections and
+ * Microsoft compatibility.
+ *
+ * Description of port entries:
+ *  DMA:   DMA controller
+ *  PIC0:  Programmable Interrupt Controller (8259A)
+ *  PIT1:  System Timer 1
+ *  PIT2:  System Timer 2 failsafe
+ *  RTC:   Real-time clock
+ *  CMOS:  Extended CMOS
+ *  DMA1:  DMA 1 page registers
+ *  DMA1L: DMA 1 Ch 0 low page
+ *  DMA2:  DMA 2 page registers
+ *  DMA2L: DMA 2 low page refresh
+ *  ARBC:  Arbitration control
+ *  SETUP: Reserved system board setup
+ *  POS:   POS channel select
+ *  PIC1:  Cascaded PIC
+ *  IDMA:  ISA DMA
+ *  ELCR:  PIC edge/level registers
+ *  PCI:   PCI configuration space
+ */
+static const ACPI_PORT_INFO     AcpiProtectedPorts[] =
+{
+    {"DMA",     0x0000, 0x000F, ACPI_OSI_WIN_XP},
+    {"PIC0",    0x0020, 0x0021, ACPI_ALWAYS_ILLEGAL},
+    {"PIT1",    0x0040, 0x0043, ACPI_OSI_WIN_XP},
+    {"PIT2",    0x0048, 0x004B, ACPI_OSI_WIN_XP},
+    {"RTC",     0x0070, 0x0071, ACPI_OSI_WIN_XP},
+    {"CMOS",    0x0074, 0x0076, ACPI_OSI_WIN_XP},
+    {"DMA1",    0x0081, 0x0083, ACPI_OSI_WIN_XP},
+    {"DMA1L",   0x0087, 0x0087, ACPI_OSI_WIN_XP},
+    {"DMA2",    0x0089, 0x008B, ACPI_OSI_WIN_XP},
+    {"DMA2L",   0x008F, 0x008F, ACPI_OSI_WIN_XP},
+    {"ARBC",    0x0090, 0x0091, ACPI_OSI_WIN_XP},
+    {"SETUP",   0x0093, 0x0094, ACPI_OSI_WIN_XP},
+    {"POS",     0x0096, 0x0097, ACPI_OSI_WIN_XP},
+    {"PIC1",    0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL},
+    {"IDMA",    0x00C0, 0x00DF, ACPI_OSI_WIN_XP},
+    {"ELCR",    0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL},
+    {"PCI",     0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP}
+};
+
+#define ACPI_PORT_INFO_ENTRIES  ACPI_ARRAY_LENGTH (AcpiProtectedPorts)
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiHwValidateIoRequest
+ *
+ * PARAMETERS:  Address             Address of I/O port/register
+ *              BitWidth            Number of bits (8,16,32)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validates an I/O request (address/length). Certain ports are
+ *              always illegal and some ports are only illegal depending on
+ *              the requests the BIOS AML code makes to the predefined
+ *              _OSI method.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwValidateIoRequest (
+    ACPI_IO_ADDRESS         Address,
+    UINT32                  BitWidth)
+{
+    UINT32                  i;
+    UINT32                  ByteWidth;
+    ACPI_IO_ADDRESS         LastAddress;
+    const ACPI_PORT_INFO    *PortInfo;
+
+
+    ACPI_FUNCTION_TRACE (HwValidateIoRequest);
+
+
+    /* Supported widths are 8/16/32 */
+
+    if ((BitWidth != 8) &&
+        (BitWidth != 16) &&
+        (BitWidth != 32))
+    {
+        return (AE_BAD_PARAMETER);
+    }
+
+    PortInfo = AcpiProtectedPorts;
+    ByteWidth = ACPI_DIV_8 (BitWidth);
+    LastAddress = Address + ByteWidth - 1;
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %p LastAddress %p Length %X",
+        ACPI_CAST_PTR (void, Address), ACPI_CAST_PTR (void, LastAddress),
+        ByteWidth));
+
+    /* Maximum 16-bit address in I/O space */
+
+    if (LastAddress > ACPI_UINT16_MAX)
+    {
+        ACPI_ERROR ((AE_INFO,
+            "Illegal I/O port address/length above 64K: 0x%p/%X",
+            ACPI_CAST_PTR (void, Address), ByteWidth));
+        return_ACPI_STATUS (AE_LIMIT);
+    }
+
+    /* Exit if requested address is not within the protected port table */
+
+    if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
+
+    /* Check request against the list of protected I/O ports */
+
+    for (i = 0; i < ACPI_PORT_INFO_ENTRIES; i++, PortInfo++)
+    {
+        /*
+         * Check if the requested address range will write to a reserved
+         * port. Four cases to consider:
+         *
+         * 1) Address range is contained completely in the port address range
+         * 2) Address range overlaps port range at the port range start
+         * 3) Address range overlaps port range at the port range end
+         * 4) Address range completely encompasses the port range
+         */
+        if ((Address <= PortInfo->End) && (LastAddress >= PortInfo->Start))
+        {
+            /* Port illegality may depend on the _OSI calls made by the BIOS */
+
+            if (AcpiGbl_OsiData >= PortInfo->OsiDependency)
+            {
+                ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+                    "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
+                    ACPI_CAST_PTR (void, Address), ByteWidth, PortInfo->Name,
+                    PortInfo->Start, PortInfo->End));
+
+                return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
+            }
+        }
+
+        /* Finished if address range ends before the end of this port */
+
+        if (LastAddress <= PortInfo->End)
+        {
+            break;
+        }
+    }
+
+    return_ACPI_STATUS (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiHwReadPort
+ *
+ * PARAMETERS:  Address             Address of I/O port/register to read
+ *              Value               Where value is placed
+ *              Width               Number of bits
+ *
+ * RETURN:      Status and value read from port
+ *
+ * DESCRIPTION: Read data from an I/O port or register. This is a front-end
+ *              to AcpiOsReadPort that performs validation on both the port
+ *              address and the length.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiHwReadPort (
+    ACPI_IO_ADDRESS         Address,
+    UINT32                  *Value,
+    UINT32                  Width)
+{
+    ACPI_STATUS             Status;
+    UINT32                  OneByte;
+    UINT32                  i;
+
+
+    /* Validate the entire request and perform the I/O */
+
+    Status = AcpiHwValidateIoRequest (Address, Width);
+    if (ACPI_SUCCESS (Status))
+    {
+        Status = AcpiOsReadPort (Address, Value, Width);
+        return (Status);
+    }
+
+    if (Status != AE_AML_ILLEGAL_ADDRESS)
+    {
+        return (Status);
+    }
+
+    /*
+     * There has been a protection violation within the request. Fall
+     * back to byte granularity port I/O and ignore the failing bytes.
+     * This provides Windows compatibility.
+     */
+    for (i = 0, *Value = 0; i < Width; i += 8)
+    {
+        /* Validate and read one byte */
+
+        if (AcpiHwValidateIoRequest (Address, 8) == AE_OK)
+        {
+            Status = AcpiOsReadPort (Address, &OneByte, 8);
+            if (ACPI_FAILURE (Status))
+            {
+                return (Status);
+            }
+
+            *Value |= (OneByte << i);
+        }
+
+        Address++;
+    }
+
+    return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiHwWritePort
+ *
+ * PARAMETERS:  Address             Address of I/O port/register to write
+ *              Value               Value to write
+ *              Width               Number of bits
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Write data to an I/O port or register. This is a front-end
+ *              to AcpiOsWritePort that performs validation on both the port
+ *              address and the length.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiHwWritePort (
+    ACPI_IO_ADDRESS         Address,
+    UINT32                  Value,
+    UINT32                  Width)
+{
+    ACPI_STATUS             Status;
+    UINT32                  i;
+
+
+    /* Validate the entire request and perform the I/O */
+
+    Status = AcpiHwValidateIoRequest (Address, Width);
+    if (ACPI_SUCCESS (Status))
+    {
+        Status = AcpiOsWritePort (Address, Value, Width);
+        return (Status);
+    }
+
+    if (Status != AE_AML_ILLEGAL_ADDRESS)
+    {
+        return (Status);
+    }
+
+    /*
+     * There has been a protection violation within the request. Fall
+     * back to byte granularity port I/O and ignore the failing bytes.
+     * This provides Windows compatibility.
+     */
+    for (i = 0; i < Width; i += 8)
+    {
+        /* Validate and write one byte */
+
+        if (AcpiHwValidateIoRequest (Address, 8) == AE_OK)
+        {
+            Status = AcpiOsWritePort (Address, (Value >> i) & 0xFF, 8);
+            if (ACPI_FAILURE (Status))
+            {
+                return (Status);
+            }
+        }
+
+        Address++;
+    }
+
+    return (AE_OK);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/io/acpica/hardware/hwxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,660 @@
+
+/******************************************************************************
+ *
+ * Module Name: hwxface - Public ACPICA hardware interfaces
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+
+#define _COMPONENT          ACPI_HARDWARE
+        ACPI_MODULE_NAME    ("hwxface")
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiReset
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Set reset register in memory or IO space. Note: Does not
+ *              support reset register in PCI config space, this must be
+ *              handled separately.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiReset (
+    void)
+{
+    ACPI_GENERIC_ADDRESS    *ResetReg;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (AcpiReset);
+
+
+    ResetReg = &AcpiGbl_FADT.ResetRegister;
+
+    /* Check if the reset register is supported */
+
+    if (!(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) ||
+        !ResetReg->Address)
+    {
+        return_ACPI_STATUS (AE_NOT_EXIST);
+    }
+
+    /* Write the reset value to the reset register */
+
+    Status = AcpiWrite (AcpiGbl_FADT.ResetValue, ResetReg);
+    return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiReset)
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiRead
+ *
+ * PARAMETERS:  Value               - Where the value is returned
+ *              Reg                 - GAS register structure
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read from either memory or IO space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRead (
+    UINT32                  *Value,
+    ACPI_GENERIC_ADDRESS    *Reg)
+{
+    UINT32                  Width;
+    UINT64                  Address;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_NAME (AcpiRead);
+
+
+    /*
+     * Must have a valid pointer to a GAS structure, and a non-zero address
+     * within.
+     */
+    if (!Reg)
+    {
+        return (AE_BAD_PARAMETER);
+    }
+
+    /* Get a local copy of the address. Handles possible alignment issues */
+
+    ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
+    if (!Address)
+    {
+        return (AE_BAD_ADDRESS);
+    }
+
+    /* Supported widths are 8/16/32 */
+
+    Width = Reg->BitWidth;
+    if ((Width != 8) && (Width != 16) && (Width != 32))
+    {
+        return (AE_SUPPORT);
+    }
+
+    /* Initialize entire 32-bit return value to zero */
+
+    *Value = 0;
+
+    /*
+     * Two address spaces supported: Memory or IO. PCI_Config is
+     * not supported here because the GAS structure is insufficient
+     */
+    switch (Reg->SpaceId)
+    {
+    case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
+        Status = AcpiOsReadMemory (
+                    (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
+        break;
+
+
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+
+        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, Value, Width);
+        break;
+
+
+    default:
+        ACPI_ERROR ((AE_INFO,
+            "Unsupported address space: %X", Reg->SpaceId));
+        return (AE_BAD_PARAMETER);
+    }
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+        "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
+        *Value, Width, ACPI_FORMAT_UINT64 (Address),
+        AcpiUtGetRegionName (Reg->SpaceId)));
+
+    return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiRead)
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiWrite
+ *
+ * PARAMETERS:  Value               - To be written
+ *              Reg                 - GAS register structure
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Write to either memory or IO space.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiWrite (
+    UINT32                  Value,
+    ACPI_GENERIC_ADDRESS    *Reg)
+{
+    UINT32                  Width;
+    UINT64                  Address;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_NAME (AcpiWrite);
+
+
+    /*
+     * Must have a valid pointer to a GAS structure, and a non-zero address
+     * within.
+     */
+    if (!Reg)
+    {
+        return (AE_BAD_PARAMETER);
+    }
+
+    /* Get a local copy of the address. Handles possible alignment issues */
+
+    ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
+    if (!Address)
+    {
+        return (AE_BAD_ADDRESS);
+    }
+
+    /* Supported widths are 8/16/32 */
+
+    Width = Reg->BitWidth;
+    if ((Width != 8) && (Width != 16) && (Width != 32))
+    {
+        return (AE_SUPPORT);
+    }
+
+    /*
+     * Two address spaces supported: Memory or IO.
+     * PCI_Config is not supported here because the GAS struct is insufficient
+     */
+    switch (Reg->SpaceId)
+    {
+    case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
+        Status = AcpiOsWriteMemory (
+                    (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
+        break;
+
+
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+
+        Status = AcpiHwWritePort (
+                    (ACPI_IO_ADDRESS) Address, Value, Width);
+        break;
+
+
+    default:
+        ACPI_ERROR ((AE_INFO,
+            "Unsupported address space: %X", Reg->SpaceId));
+        return (AE_BAD_PARAMETER);
+    }
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+        "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
+        Value, Width, ACPI_FORMAT_UINT64 (Address),
+        AcpiUtGetRegionName (Reg->SpaceId)));
+
+    return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiWrite)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiReadBitRegister
+ *
+ * PARAMETERS:  RegisterId      - ID of ACPI Bit Register to access
+ *              ReturnValue     - Value that was read from the register,
+ *                                normalized to bit position zero.
+ *
+ * RETURN:      Status and the value read from the specified Register. Value
+ *              returned is normalized to bit0 (is shifted all the way right)
+ *
+ * DESCRIPTION: ACPI BitRegister read function. Does not acquire the HW lock.
+ *
+ * SUPPORTS:    Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
+ *              PM2 Control.
+ *
+ * Note: The hardware lock is not required when reading the ACPI bit registers
+ *       since almost all of them are single bit and it does not matter that
+ *       the parent hardware register can be split across two physical
+ *       registers. The only multi-bit field is SLP_TYP in the PM1 control
+ *       register, but this field does not cross an 8-bit boundary (nor does
+ *       it make much sense to actually read this field.)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiReadBitRegister (
+    UINT32                  RegisterId,
+    UINT32                  *ReturnValue)
+{
+    ACPI_BIT_REGISTER_INFO  *BitRegInfo;
+    UINT32                  RegisterValue;
+    UINT32                  Value;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE_U32 (AcpiReadBitRegister, RegisterId);
+
+
+    /* Get the info structure corresponding to the requested ACPI Register */
+
+    BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+    if (!BitRegInfo)
+    {
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    /* Read the entire parent register */
+
+    Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister,
+                &RegisterValue);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Normalize the value that was read, mask off other bits */
+
+    Value = ((RegisterValue & BitRegInfo->AccessBitMask)
+                >> BitRegInfo->BitPosition);
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+        "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n",
+        RegisterId, BitRegInfo->ParentRegister, RegisterValue, Value));
+
+    *ReturnValue = Value;
+    return_ACPI_STATUS (AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiReadBitRegister)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiWriteBitRegister
+ *
+ * PARAMETERS:  RegisterId      - ID of ACPI Bit Register to access
+ *              Value           - Value to write to the register, in bit
+ *                                position zero. The bit is automaticallly
+ *                                shifted to the correct position.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock
+ *              since most operations require a read/modify/write sequence.
+ *
+ * SUPPORTS:    Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
+ *              PM2 Control.
+ *
+ * Note that at this level, the fact that there may be actually two
+ * hardware registers (A and B - and B may not exist) is abstracted.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiWriteBitRegister (
+    UINT32                  RegisterId,
+    UINT32                  Value)
+{
+    ACPI_BIT_REGISTER_INFO  *BitRegInfo;
+    ACPI_CPU_FLAGS          LockFlags;
+    UINT32                  RegisterValue;
+    ACPI_STATUS             Status = AE_OK;
+
+
+    ACPI_FUNCTION_TRACE_U32 (AcpiWriteBitRegister, RegisterId);
+
+
+    /* Get the info structure corresponding to the requested ACPI Register */
+
+    BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
+    if (!BitRegInfo)
+    {
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
+
+    /*
+     * At this point, we know that the parent register is one of the
+     * following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control
+     */
+    if (BitRegInfo->ParentRegister != ACPI_REGISTER_PM1_STATUS)
+    {
+        /*
+         * 1) Case for PM1 Enable, PM1 Control, and PM2 Control
+         *
+         * Perform a register read to preserve the bits that we are not
+         * interested in
+         */
+        Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister,
+                    &RegisterValue);
+        if (ACPI_FAILURE (Status))
+        {
+            goto UnlockAndExit;
+        }
+
+        /*
+         * Insert the input bit into the value that was just read
+         * and write the register
+         */
+        ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
+            BitRegInfo->AccessBitMask, Value);
+
+        Status = AcpiHwRegisterWrite (BitRegInfo->ParentRegister,
+                    RegisterValue);
+    }
+    else
+    {
+        /*
+         * 2) Case for PM1 Status
+         *
+         * The Status register is different from the rest. Clear an event
+         * by writing 1, writing 0 has no effect. So, the only relevant
+         * information is the single bit we're interested in, all others
+         * should be written as 0 so they will be left unchanged.
+         */
+        RegisterValue = ACPI_REGISTER_PREPARE_BITS (Value,
+            BitRegInfo->BitPosition, BitRegInfo->AccessBitMask);
+
+        /* No need to write the register if value is all zeros */
+
+        if (RegisterValue)
+        {
+            Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS,
+                        RegisterValue);
+        }
+    }
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+        "BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n",
+        RegisterId, BitRegInfo->ParentRegister, Value, RegisterValue));
+
+
+UnlockAndExit:
+
+    AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
+    return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister)
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiGetSleepTypeData
+ *
+ * PARAMETERS:  SleepState          - Numeric sleep state
+ *              *SleepTypeA         - Where SLP_TYPa is returned
+ *              *SleepTypeB         - Where SLP_TYPb is returned
+ *
+ * RETURN:      Status - ACPI status
+ *
+ * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
+ *              state.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetSleepTypeData (
+    UINT8                   SleepState,
+    UINT8                   *SleepTypeA,
+    UINT8                   *SleepTypeB)
+{
+    ACPI_STATUS             Status = AE_OK;
+    ACPI_EVALUATE_INFO      *Info;
+
+
+    ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
+
+
+    /* Validate parameters */
+
+    if ((SleepState > ACPI_S_STATES_MAX) ||
+        !SleepTypeA ||
+        !SleepTypeB)
+    {
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    /* Allocate the evaluation information block */
+
+    Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+    if (!Info)
+    {
+        return_ACPI_STATUS (AE_NO_MEMORY);
+    }
+
+    Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
+
+    /* Evaluate the namespace object containing the values for this state */
+
+    Status = AcpiNsEvaluate (Info);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+            "%s while evaluating SleepState [%s]\n",
+            AcpiFormatException (Status), Info->Pathname));
+
+        goto Cleanup;
+    }
+
+    /* Must have a return object */
+
+    if (!Info->ReturnObject)
+    {
+        ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]",
+            Info->Pathname));
+        Status = AE_NOT_EXIST;
+    }
+
+    /* It must be of type Package */
+
+    else if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE)
+    {
+        ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package"));
+        Status = AE_AML_OPERAND_TYPE;
+    }
+
+    /*
+     * The package must have at least two elements. NOTE (March 2005): This
+     * goes against the current ACPI spec which defines this object as a
+     * package with one encoded DWORD element. However, existing practice
+     * by BIOS vendors seems to be to have 2 or more elements, at least
+     * one per sleep type (A/B).
+     */
+    else if (Info->ReturnObject->Package.Count < 2)
+    {
+        ACPI_ERROR ((AE_INFO,
+            "Sleep State return package does not have at least two elements"));
+        Status = AE_AML_NO_OPERAND;
+    }
+
+    /* The first two elements must both be of type Integer */
+
+    else if (((Info->ReturnObject->Package.Elements[0])->Common.Type
+                != ACPI_TYPE_INTEGER) ||
+             ((Info->ReturnObject->Package.Elements[1])->Common.Type
+                != ACPI_TYPE_INTEGER))
+    {
+        ACPI_ERROR ((AE_INFO,
+            "Sleep State return package elements are not both Integers "
+            "(%s, %s)",
+            AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]),
+            AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1])));
+        Status = AE_AML_OPERAND_TYPE;
+    }
+    else
+    {
+        /* Valid _Sx_ package size, type, and value */
+
+        *SleepTypeA = (UINT8)
+            (Info->ReturnObject->Package.Elements[0])->Integer.Value;
+        *SleepTypeB = (UINT8)
+            (Info->ReturnObject->Package.Elements[1])->Integer.Value;
+    }
+
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "While evaluating SleepState [%s], bad Sleep object %p type %s",
+            Info->Pathname, Info->ReturnObject,
+            AcpiUtGetObjectTypeName (Info->ReturnObject)));
+    }
+
+    AcpiUtRemoveReference (Info->ReturnObject);
+
+Cleanup:
+    ACPI_FREE (Info);
+    return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData)
--- a/usr/src/uts/intel/io/acpica/master_ops.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/master_ops.c	Fri Jun 26 17:26:34 2009 -0700
@@ -19,478 +19,416 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/kobj.h>
 #include <sys/kobj_lex.h>
 #include <sys/ddi.h>
 #include <sys/sunddi.h>
 #include <sys/sunndi.h>
+#include <sys/acpi/acpi.h>
+#include <sys/acpica.h>
 
 #define	masterfile "/boot/solaris/devicedb/master"
 
-/* Maximum size of a master line */
-#define	MASTER_LINE_MAX (1024*2)
-static char *one_master_line;
-static int one_master_line_cur_index = 0, one_master_line_max = 0;
-struct master_line {
-	char *column[10];
-	char *text; /* to be kmem alloc'd */
-	int line_size;
-	struct master_line *next, *prev;
-};
-static struct master_line *incore_master_head = NULL,
-	*incore_master_tail = NULL;
-/* same order as columns in /boot/solaris/devicedb/master */
-static int mf_column = 0;
-static int incore_master_table_line_count = 0;
+/*
+ * Internal definitions
+ */
 
-#define	MASTER_OPS_DEBUG_PRINT_INCORE	0x0001
-#define	MASTER_OPS_DEBUG_PROCESS	0x0002
-#define	MASTER_OPS_DEBUG_LOOKUP		0x0004
-#define	MASTER_OPS_DEBUG_CID_FOUND	0x2000
-static long master_ops_debug = 0x0;
-#define	EOL 0xA
-#define	FILE_T struct _buf
+typedef enum {
+	MF_UNEXPECTED = -1,
+	MF_IDENT,
+	MF_STRING,
+	MF_EOF,
+	MF_NEWLINE,
+	MF_EQUALS,
+	MF_BIT_OR
+} mftoken_t;
 
-static void
-print_incore_master_table() {
-	struct master_line *ptr = incore_master_head;
-	int i;
+typedef enum {
+	MF_INIT,
+	MF_DEVID,
+	MF_NAME,
+	MF_DEVTYPE,
+	MF_BUSTYPE,
+	MF_BEFNAME,
+	MF_DESCRIPTION,
+	MF_PROPNAME,
+	MF_PROPASSIGN,
+	MF_PROPVAL,
+	MF_VERSION_DONE,
+	MF_VALID_DONE,
+	MF_ERROR_DONE
+} mfparse_t;
 
-	if (master_ops_debug & MASTER_OPS_DEBUG_PRINT_INCORE) {
-		for (i = 0; i < incore_master_table_line_count; i++) {
-			printf("1)%s, 2)%s, 3)%s, 4)%s, 5)%s, 6)%s, ",
-			    ptr->column[0],
-			    ptr->column[1],
-			    ptr->column[2],
-			    ptr->column[3],
-			    ptr->column[4],
-			    ptr->column[5]);
-			if (ptr->column[6] != NULL) {
-			    printf("7)%s, ", ptr->column[6]);
-			}
-			if (ptr->column[7] != NULL) {
-				printf("8)%s", ptr->column[7]);
-			}
-			printf("\n");
-			ptr = ptr->next;
-			if (ptr == NULL) {
-				i++;
-				break;
-			}
-		}
-		printf("There are %d lines\n", i);
-	}
+
+static master_rec_t *master_list = NULL;
+
+device_id_t *
+mf_alloc_device_id()
+{
+	return ((device_id_t *)kmem_zalloc(sizeof (device_id_t), KM_SLEEP));
 }
 
-/*
- * parses one_master_line[] from index pointed by one_master_line_cur_index
- * returns the following tokens
- * POUND -- if a comment line
- * NEWLINE -- if an empty line
- * NAME -- return a string from one_master_line separated by " or blank
- * EOL -- End of line
- */
-static int
-master_lex(char *val) {
-	char *cp;
-	int	ch;
-	int token;
+void
+mf_free_device_id(device_id_t *d)
+{
+	if (d->id != NULL)
+		strfree(d->id);
 
-	cp = val;
-	/* skip leading blanks */
-	while (((ch = one_master_line[one_master_line_cur_index++]) == ' ' ||
-	    (ch == '\t')) && (one_master_line_cur_index < one_master_line_max))
-		;
-	if ((ch == 0) || (one_master_line_cur_index >= one_master_line_max)) {
-		val = 0;
-		return (EOL);
-	}
-	*cp++ = (char)ch;
-	switch (ch) {
-	case '#':
-		token = POUND;
-		break;
-	case '\n':
-	case '\r':
-		token = NEWLINE;
-		break;
-	case '"':
-		cp--;
-		while (((ch  = one_master_line[one_master_line_cur_index++])
-		    != '"') && (one_master_line_cur_index <=
-		    one_master_line_max)) {
-			*cp++ = (char)ch;
-		}
-		token = NAME;
-		break;
-	default:
-		ch = one_master_line[one_master_line_cur_index++];
-		while ((ch != ' ') && (ch != '\t') && (ch != '\n') &&
-		    (ch != '\r') && (one_master_line_cur_index <=
-		    one_master_line_max)) {
-			*cp++ = (char)ch;
-			ch = one_master_line[one_master_line_cur_index++];
-		}
-		token = NAME;
-		break;
-	}
-	*cp = '\0';
-	return (token);
+	kmem_free(d, sizeof (device_id_t));
+}
+
+static property_t *
+mf_alloc_property()
+{
+	return ((property_t *)kmem_zalloc(sizeof (property_t), KM_SLEEP));
 }
 
-/*
- * read a line from devicedb/master file and put it to one_master_line[] buffer
- * one_master_line_max -- size of data in one_master_line[]
- * one_master_line_cur_index -- reset to zero
- */
-static int
-master_get_a_line(FILE_T *file) {
-	int ch;
-	one_master_line_max = 0;
-	one_master_line_cur_index = 0; /* used by master_lex() */
-	while (((ch = kobj_getc(file)) != '\n') && (ch != '\r')) {
-		if (ch == -1) {
-			if (one_master_line_max == 0) {
-				one_master_line[0] = 0;
-				return (EOF);
-			} else {
-				return (one_master_line_max);
-			}
-		}
-		one_master_line[one_master_line_max++] = ch;
-		if (one_master_line_max >= MASTER_LINE_MAX) {
-			cmn_err(CE_WARN, "!master file line too long:");
-			cmn_err(CE_CONT, "%s", one_master_line);
-		}
-	}
-	one_master_line[one_master_line_max] = 0;
-	return (one_master_line_max);
+static void
+mf_free_property(property_t *p)
+{
+	if (p->name != NULL)
+		strfree(p->name);
+
+	if (p->value != NULL)
+		strfree(p->value);
+
+	kmem_free(p, sizeof (property_t));
 }
 
-/*
- * skip a line
- */
-static void
-master_skip(FILE_T *file) {
-	char ch;
-	while (((ch = kobj_getc(file)) != '\n') && (ch != '\r'))
-		;
+static master_rec_t *
+mf_alloc_master_rec()
+{
+	return ((master_rec_t *)kmem_zalloc(sizeof (master_rec_t), KM_SLEEP));
 }
 
-/*
- * return NULL if no bar found
- * if bar found, return pointer after the bar
- * plus, change character '|' (bar) to null as a delimiter
- */
-static char *
-find_bar(char *target) {
-	if (target == NULL) {
-		return (NULL);
+static void
+mf_free_master_rec(master_rec_t *m)
+{
+	device_id_t *d;
+	property_t *p;
+
+	if (m->name != NULL)
+		strfree(m->name);
+
+	if (m->description != NULL)
+		strfree(m->description);
+
+	d = m->device_ids;
+	while (d != NULL) {
+		device_id_t *next;
+
+		next = d->next;
+		mf_free_device_id(d);
+		d = next;
 	}
-	while ((*target != '|') && (*target != ' ') && (*target != 0)) {
-		target++;
+
+	p = m->properties;
+	while (p != NULL) {
+		property_t *next;
+
+		next = p->next;
+		mf_free_property(p);
+		p = next;
 	}
-	if (*target == '|') {
-		*target = 0;
-		return (++target);
-	}
-	return (NULL);
+
+	kmem_free(m, sizeof (master_rec_t));
 }
 
-/*
- * If column 0 has | (bars) as device separators, we need make (dup)
- * more lines for each device.
- */
-static void
-dup_devices() {
-	struct master_line *last, *ptr = incore_master_tail;
-	char *token;
-	int i;
+void
+free_master_data()
+{
+	master_rec_t *m;
 
-	if (ptr == NULL || ptr->column == NULL || ptr->column[0] == NULL) {
-		return;
+	m = master_list;
+	while (m != NULL) {
+		master_rec_t *next;
+
+		next = m->next;
+		mf_free_master_rec(m);
+		m = next;
 	}
-	token = incore_master_tail->column[0];
-	while ((token = find_bar(token)) != NULL) {
-		last = (struct master_line *)kmem_zalloc(
-		    sizeof (struct master_line), KM_SLEEP);
-		for (i = 0; i < 10; i++) {
-		    last->column[i] = ptr->column[i];
-		}
-		last->text = ptr->text;
-		last->line_size = 0; /* 'cause we re-use the same line */
-		last->column[0] = token;
-		ptr->next = last;
-		last->prev = ptr;
-		last->next = NULL;
-		ptr = incore_master_tail = last;
-		incore_master_table_line_count++;
-	}
-}
-
-/*
- * sets master_ops_debug flag from propertyu passed by the boot
- */
-static void
-set_master_ops_debug_flags()
-{
-	char *prop;
-	long flags;
-
-	if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
-	    DDI_PROP_DONTPASS, "master_ops_debug", &prop) == DDI_PROP_SUCCESS) {
-		long data;
-		if (ddi_strtol(prop, NULL, 0, &data) == 0) {
-			master_ops_debug = (unsigned long)data;
-			e_ddi_prop_remove(DDI_DEV_T_NONE, ddi_root_node(),
-			    "master_ops_debug");
-			e_ddi_prop_update_int(DDI_DEV_T_NONE, ddi_root_node(),
-			    "master_ops_debug", data);
-		}
-		ddi_prop_free(prop);
-	}
+	master_list = NULL;
 }
 
 /*
- * open / read / parse / close devicedb/master file
+ * Unfortunately, kobj_lex() is too sophisticated for our needs
  */
+static mftoken_t
+mf_lex(struct _buf *file, char *val, size_t size)
+{
+	char *cp;
+	int ch, badquote;
+	size_t remain;
+	mftoken_t token = MF_UNEXPECTED;
+
+	if (size < 2)
+		return (token);	/* MF_UNEXPECTED */
+
+	cp = val;
+
+	/* skip leading whitespace */
+	while ((ch = kobj_getc(file)) == ' ' || ch == '\t')
+		;
+
+	/* strip comments */
+	if (ch == '#') {
+		while ((ch = kobj_getc(file)) != '\n' && ch != '\r' &&
+		    ch != -1)
+			;
+	}
+
+	remain = size - 1;
+	*cp++ = (char)ch;
+	switch (ch) {
+	case -1:
+		token = MF_EOF;
+		break;
+	case '\n':
+	case '\r':
+		token = MF_NEWLINE;
+		break;
+	case '=':
+		token = MF_EQUALS;
+		break;
+	case '|':
+		token = MF_BIT_OR;
+		break;
+	case '"':
+		remain++;
+		cp--;
+		badquote = 0;
+		while (!badquote && (ch  = kobj_getc(file)) != '"') {
+			switch (ch) {
+			case '\n':
+			case -1:
+				remain = size - 1;
+				cp = val;
+				*cp++ = '\n';
+				badquote = 1;
+				/* since we consumed the newline/EOF */
+				(void) kobj_ungetc(file);
+				break;
+			default:
+				if (--remain == 0) {
+					token = MF_UNEXPECTED;
+					goto out;
+				}
+				*cp++ = (char)ch;
+				break;
+			}
+		}
+		token = MF_STRING;
+		break;
+	default:
+		do {
+			if (--remain == 0) {
+				token = MF_UNEXPECTED;
+				break;
+			}
+
+			token = MF_IDENT;
+			*cp++ = (char)(ch = kobj_getc(file));
+
+			/* if terminating character, break out */
+			if ((ch == -1) || (ch == ' ') || (ch == '\t') ||
+			    (ch == '\n') || (ch == '\r') || (ch == '=') ||
+			    (ch == '|')) {
+				(void) kobj_ungetc(file);
+				remain++;
+				cp--;
+				break;
+			}
+
+			if ((ch == '#') || (ch == '"'))
+				token = MF_UNEXPECTED;
+		} while (token != MF_UNEXPECTED);
+		break;
+	}
+out:
+	*cp = '\0';
+
+	return (token);
+}
+
+static master_rec_t *
+get_line(struct _buf *file)
+{
+	master_rec_t *m = NULL;
+	device_id_t *d = NULL;
+	property_t *p = NULL;
+	mftoken_t token;
+	char tokval[MAXPATHLEN];
+	mfparse_t parse_state;
+
+	parse_state = MF_INIT;
+	token = mf_lex(file, tokval, sizeof (tokval));
+	while (token != MF_EOF) {
+		switch (parse_state) {
+		case MF_INIT:
+			m = mf_alloc_master_rec();
+			parse_state = MF_DEVID;
+			/*FALLTHROUGH*/
+		case MF_DEVID:
+			if (token == MF_IDENT) {
+				d = mf_alloc_device_id();
+				d->id = strdup(tokval);
+				d->next = m->device_ids;
+				m->device_ids = d;
+				parse_state = MF_NAME;
+			} else if (token != MF_NEWLINE)
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_NAME:
+			if (token == MF_IDENT) {
+				m->name = strdup(tokval);
+				parse_state = MF_DEVTYPE;
+			} else if (token == MF_BIT_OR) {
+				parse_state = MF_DEVID;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_DEVTYPE:
+			if (token == MF_IDENT) {
+				/* device_type not used */
+				parse_state = MF_BUSTYPE;
+			} else if (token == MF_NEWLINE) {
+				/* version line ignored */
+				parse_state = MF_VERSION_DONE;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_BUSTYPE:
+			if (token == MF_IDENT) {
+				/* bus_type ignored */
+				parse_state = MF_BEFNAME;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_BEFNAME:
+			if (token == MF_IDENT) {
+				/* realmode driver name ignored */
+				parse_state = MF_DESCRIPTION;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_DESCRIPTION:
+			if (token == MF_STRING) {
+				m->description = strdup(tokval);
+				parse_state = MF_PROPNAME;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_PROPNAME:
+			if (token == MF_IDENT) {
+				p = mf_alloc_property();
+				p->name = strdup(tokval);
+				parse_state = MF_PROPASSIGN;
+			} else if (token == MF_NEWLINE) {
+				parse_state = MF_VALID_DONE;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_PROPASSIGN:
+			if (token == MF_EQUALS) {
+				parse_state = MF_PROPVAL;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_PROPVAL:
+			if (token == MF_STRING || token == MF_IDENT) {
+				p->value = strdup(tokval);
+				p->next = m->properties;
+				/* delete properties which begin with '$' */
+				if (*p->name == '$') {
+					mf_free_property(p);
+				} else
+					m->properties = p;
+				p = NULL;
+				parse_state = MF_PROPNAME;
+			} else
+				parse_state = MF_ERROR_DONE;
+			break;
+		case MF_VERSION_DONE:
+		case MF_VALID_DONE:
+		case MF_ERROR_DONE:
+			/* terminating states handled outside switch() */
+			break;
+		}
+
+		if (parse_state == MF_VERSION_DONE) {
+			/* ignore version line */
+			mf_free_master_rec(m);
+			parse_state = MF_INIT;
+		} else if (parse_state == MF_VALID_DONE) {
+			/* valid line */
+			break;
+		} else if (parse_state == MF_ERROR_DONE) {
+			mf_free_master_rec(m);
+			if (p != NULL)
+				mf_free_property(p);
+			/*
+			 * Error in master file.  Should never happen
+			 * since master file is not user-edited.  Eat rest
+			 * of line to attempt error recovery
+			 */
+			cmn_err(CE_NOTE, "!error in %s", masterfile);
+			while (token != MF_NEWLINE && token != MF_EOF)
+				token = mf_lex(file, tokval, sizeof (tokval));
+			parse_state = MF_INIT;
+			continue;
+		}
+
+		token = mf_lex(file, tokval, sizeof (tokval));
+	}
+
+	return (m);
+}
+
 void
-process_master_file() {
-	FILE_T *file;
-	char tokbuf[MASTER_LINE_MAX];
-	int token;
-	int done = 0;
-	int line_begin;
-	int x = 0;
-	int total_line_processed = 0;
+process_master_file()
+{
+	struct _buf *file;
+	master_rec_t *m;
 
-	set_master_ops_debug_flags();
-
-	incore_master_head = incore_master_tail = NULL;
-	if ((file = kobj_open_file(masterfile)) == (struct _buf *)-1) {
+	if ((file = kobj_open_file(masterfile)) == NULL) {
 		cmn_err(CE_WARN, "!cannot open master file: %s", masterfile);
 		return;
 	}
-	one_master_line = (char *)kmem_zalloc(MASTER_LINE_MAX, KM_SLEEP);
-	master_skip(file); /* skip the first line which is "version" */
-	mf_column = 0;
-	while (!done) {
-		if (mf_column == 0) {
-			x = master_get_a_line(file);
-			total_line_processed++;
-			if (x == EOF) { /* end of file */
-				done = 1;
-				continue;
-			}
-			if (x == 0) { /* blank line */
-				continue;
-			}
-		}
-		token = master_lex(tokbuf);
-		switch (token) {
-		case POUND: /* ignore comment line */
-			if (master_ops_debug & MASTER_OPS_DEBUG_PROCESS) {
-				printf("master_ops: # found skip this line\n");
-			}
-			mf_column = 0;
-			break;
-		case NAME: /* found actual string, parse and keep it */
-			if (mf_column == 0) {
-				if (incore_master_tail == NULL) {
-					/* very 1st line */
-					incore_master_head =
-					incore_master_tail = (struct
-					    master_line *) kmem_zalloc(
-					    sizeof (struct master_line),
-					    KM_SLEEP);
-					incore_master_head->text = (char *)
-					    kmem_zalloc(one_master_line_max,
-					    KM_SLEEP);
-					incore_master_head->line_size =
-					    one_master_line_max;
-				} else {
-					incore_master_tail->next = (struct
-					    master_line *)kmem_zalloc(
-					    sizeof (struct master_line),
-					    KM_SLEEP);
-					incore_master_tail =
-					    incore_master_tail->next;
-					incore_master_tail->text = (char *)
-					    kmem_zalloc(one_master_line_max,
-					    KM_SLEEP);
-					incore_master_tail->line_size =
-					    one_master_line_max;
-				}
-				line_begin = 0;
-				incore_master_table_line_count++;
-			}
-			if ((line_begin + strlen(tokbuf) + 1) >
-			    MASTER_LINE_MAX) {
-				mf_column = 0;
-				cmn_err(CE_WARN, "!master file line too long");
-				cmn_err(CE_CONT, "line data: \"%s\"",
-				    one_master_line);
-				master_skip(file); /* skip this line */
-				break;
-			}
-			(void) strcpy(incore_master_tail->text + line_begin,
-			    tokbuf);
-			incore_master_tail->column[mf_column] = line_begin +
-			    incore_master_tail->text;
-			if (master_ops_debug & MASTER_OPS_DEBUG_PROCESS) {
-				printf("master_ops: line=%d column[%x] found:"\
-				    " \"%s\"\n",
-				    incore_master_table_line_count, mf_column,
-				    incore_master_tail->column[mf_column]);
-			}
-			line_begin += strlen(tokbuf) + 1;
-			mf_column++;
-			break;
-		case EOF: /* end of file */
-			if (master_ops_debug & MASTER_OPS_DEBUG_PROCESS) {
-				printf("master_ops: EOF found. We're done.\n");
-			}
-			done = 1;
-			break;
-		case EOL: /* end of line */
-			if (master_ops_debug & MASTER_OPS_DEBUG_PROCESS) {
-				printf("master_ops: EOL found.\n");
-			}
-			mf_column = 0;
-			one_master_line_max = 0;
-			dup_devices();
-			break;
-		default: /* something went wrong */
-			cmn_err(CE_WARN, "!master_ops: something went wrong "\
-			    "parsing master file: %s", tokbuf);
-		}
+
+	while ((m = get_line(file)) != NULL) {
+		m->next = master_list;
+		master_list = m;
 	}
+
 	kobj_close_file(file);
-
-	if (master_ops_debug & MASTER_OPS_DEBUG_PROCESS) {
-		printf("master_ops: incore line count: %d\n",
-		    incore_master_table_line_count);
-		printf("master_ops: total line processed: %d\n",
-		    total_line_processed);
-	}
-	print_incore_master_table();
 }
 
 /*
- * Loop and free all per line master data, including line text
+ * Return the first master file record found matching pnpid list
  */
-void
-free_master_data() {
-	int i;
-	struct master_line *next, *cur = incore_master_head;
-	for (i = 0; i < incore_master_table_line_count; i++) {
-		next = cur->next;
-		if ((cur->text != NULL) && (cur->line_size != 0)) {
-			kmem_free(cur->text, cur->line_size);
-		}
-		kmem_free(cur, sizeof (struct master_line));
-		if (next == NULL) {
-			break; /* we're done */
-		}
-			cur = next;
-	}
-	incore_master_head = incore_master_tail = NULL;
-	if (one_master_line) {
-		kmem_free(one_master_line, MASTER_LINE_MAX);
-	}
-}
-
-/*
- *  To match pnpid with master table entries
- *  returns 0 if no matching device found in master file
- *          1 if a matching device is in master file
- *            devname -- device node name
- *            description -- device description string
- *            properties -- device attributes (e.g. compatibility="kb8042")
- *                          (could be NULL)
- */
-int
-master_file_lookup(char *pnpid, char **devname, char **description,
-    char **properties)
+const master_rec_t *
+master_file_lookup(device_id_t *pnpid)
 {
-	struct master_line *cur = incore_master_head;
-
-	ASSERT(pnpid != NULL);
-
-	if (master_ops_debug & MASTER_OPS_DEBUG_LOOKUP)
-		printf("master_ops: Looking for %s: ", pnpid);
-
-	while (cur != NULL) {
-		if (strcmp(pnpid, cur->column[0]) == 0) {
+	master_rec_t *m;
+	device_id_t *d;
 
-			*devname = kmem_zalloc(strlen(cur->column[1]) + 1,
-			    KM_SLEEP);
-			(void) strcpy(*devname, cur->column[1]);
-			*description = kmem_zalloc(strlen(cur->column[5]) + 1,
-			    KM_SLEEP);
-			(void) strcpy(*description, cur->column[5]);
-			if (cur->column[6] != NULL) {
-				*properties = kmem_zalloc(
-				    strlen(cur->column[6]) + 1, KM_SLEEP);
-				(void) strcpy(*properties, cur->column[6]);
-			} else
-				*properties = NULL;
-
-			if (master_ops_debug & MASTER_OPS_DEBUG_LOOKUP) {
-				printf("FOUND. dev node name: \"%s\"\n",
-				    *devname);
-				printf("description: \"%s\"", *description);
-				if (*properties != NULL) {
-					printf(" properties: \"%s\"\n",
-					    *properties);
-				} else {
-					printf("\n");
-				}
+	while (pnpid != NULL) {
+		m = master_list;
+		while (m != NULL) {
+			d = m->device_ids;
+			while (d != NULL) {
+				if (strcmp(pnpid->id, d->id) == 0)
+					return (m);
+				d = d->next;
 			}
-			return (1);
+			m = m->next;
 		}
-		cur = cur->next;
-	}
-	/* XXX: for the devices not found, they should go to used resources?? */
-	if (master_ops_debug & MASTER_OPS_DEBUG_LOOKUP) {
-		printf("NOT FOUND!!!\n");
+		pnpid = pnpid->next;
 	}
-	return (0);
+
+	return (NULL);
 }
-
-/*
- * master_file_lookups() -- processes multiple pnp IDs (CIDs)
- * 	return 1 if a PNP id is matched
- * 	else return 0
- */
-int
-master_file_lookups(char *pnpid, char **devname, char **description,
-    char **properties, int pnpid_size)
-{
-	char *tmp = pnpid;
-
-	/*
-	 * terminate the loop based on pnpid_size.  If pnpid_size
-	 * is 0, the loop terminates without ever calling
-	 * master_file_lookup(); this happens if there's no
-	 * _CID object present
-	 */
-	while (tmp < pnpid + pnpid_size) {
-		int ret = master_file_lookup(tmp, devname, description,
-		    properties);
-		if (ret == 1) {
-			if (master_ops_debug & MASTER_OPS_DEBUG_CID_FOUND) {
-				cmn_err(CE_NOTE, "CID found: %s", tmp);
-			}
-			return (ret); /* a CID is found */
-		}
-		tmp += strlen(tmp) + 1; /* move on to the next one */
-	}
-	return (0);
-}
--- a/usr/src/uts/intel/io/acpica/namespace/nsaccess.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsaccess.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- *              $Revision: 1.209 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __NSACCESS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acnamesp.h"
 #include "acdispat.h"
@@ -202,9 +202,8 @@
         }
 
         /*
-         * Name entered successfully.
-         * If entry in PreDefinedNames[] specifies an
-         * initial value, create the initial value.
+         * Name entered successfully. If entry in PreDefinedNames[] specifies
+         * an initial value, create the initial value.
          */
         if (InitVal->Val)
         {
@@ -252,11 +251,8 @@
                 /* Mark this as a very SPECIAL method */
 
                 ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY;
-
-#ifndef ACPI_DUMP_APP
                 ObjDesc->Method.Implementation = AcpiUtOsiImplementation;
 #endif
-#endif
                 break;
 
             case ACPI_TYPE_INTEGER:
@@ -267,9 +263,8 @@
 
             case ACPI_TYPE_STRING:
 
-                /*
-                 * Build an object around the static string
-                 */
+                /* Build an object around the static string */
+
                 ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val);
                 ObjDesc->String.Pointer = Val;
                 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
@@ -321,7 +316,7 @@
             /* Store pointer to value descriptor in the Node */
 
             Status = AcpiNsAttachObject (NewNode, ObjDesc,
-                        ACPI_GET_OBJECT_TYPE (ObjDesc));
+                        ObjDesc->Common.Type);
 
             /* Remove local reference to the object */
 
@@ -409,10 +404,8 @@
         return_ACPI_STATUS (AE_NO_NAMESPACE);
     }
 
-    /*
-     * Get the prefix scope.
-     * A null scope means use the root scope
-     */
+    /* Get the prefix scope. A null scope means use the root scope */
+
     if ((!ScopeInfo) ||
         (!ScopeInfo->Scope.Node))
     {
@@ -436,8 +429,8 @@
         {
             /*
              * This node might not be a actual "scope" node (such as a
-             * Device/Method, etc.)  It could be a Package or other object node.
-             * Backup up the tree to find the containing scope node.
+             * Device/Method, etc.)  It could be a Package or other object
+             * node. Backup up the tree to find the containing scope node.
              */
             while (!AcpiNsOpensScope (PrefixNode->Type) &&
                     PrefixNode->Type != ACPI_TYPE_ANY)
@@ -447,7 +440,7 @@
         }
     }
 
-    /* Save type   TBD: may be no longer necessary */
+    /* Save type. TBD: may be no longer necessary */
 
     TypeToCheckFor = Type;
 
@@ -513,6 +506,7 @@
                 /* Name is fully qualified, no search rules apply */
 
                 SearchParentFlag = ACPI_NS_NO_UPSEARCH;
+
                 /*
                  * Point past this prefix to the name segment
                  * part or the next Parent Prefix
@@ -528,7 +522,8 @@
                     /* Current scope has no parent scope */
 
                     ACPI_ERROR ((AE_INFO,
-                        "ACPI path has too many parent prefixes (^) - reached beyond root node"));
+                        "ACPI path has too many parent prefixes (^) "
+                        "- reached beyond root node"));
                     return_ACPI_STATUS (AE_NOT_FOUND);
                 }
             }
@@ -618,11 +613,11 @@
 
 
     /*
-     * Search namespace for each segment of the name.  Loop through and
+     * Search namespace for each segment of the name. Loop through and
      * verify (or add to the namespace) each name segment.
      *
      * The object type is significant only at the last name
-     * segment.  (We don't care about the types along the path, only
+     * segment. (We don't care about the types along the path, only
      * the type of the final target object.)
      */
     ThisSearchType = ACPI_TYPE_ANY;
@@ -632,9 +627,8 @@
         NumSegments--;
         if (!NumSegments)
         {
-            /*
-             * This is the last segment, enable typechecking
-             */
+            /* This is the last segment, enable typechecking */
+
             ThisSearchType = Type;
 
             /*
@@ -685,13 +679,19 @@
         {
             /*
              * If we have an alias to an object that opens a scope (such as a
-             * device or processor), we need to dereference the alias here so that
-             * we can access any children of the original node (via the remaining
-             * segments).
+             * device or processor), we need to dereference the alias here so
+             * that we can access any children of the original node (via the
+             * remaining segments).
              */
             if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS)
             {
-                if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) ThisNode->Object)->Type))
+                if (!ThisNode->Object)
+                {
+                    return_ACPI_STATUS (AE_NOT_EXIST);
+                }
+
+                if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *)
+                        ThisNode->Object)->Type))
                 {
                     ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object;
                 }
@@ -733,8 +733,8 @@
 
             /*
              * If this is the last name segment and we are not looking for a
-             * specific type, but the type of found object is known, use that type
-             * to (later) see if it opens a scope.
+             * specific type, but the type of found object is known, use that
+             * type to (later) see if it opens a scope.
              */
             if (Type == ACPI_TYPE_ANY)
             {
@@ -748,9 +748,8 @@
         CurrentNode = ThisNode;
     }
 
-    /*
-     * Always check if we need to open a new scope
-     */
+    /* Always check if we need to open a new scope */
+
     if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState))
     {
         /*
--- a/usr/src/uts/intel/io/acpica/namespace/nsalloc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsalloc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: nsalloc - Namespace allocation and deletion utilities
- *              $Revision: 1.109 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSALLOC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -159,7 +159,8 @@
     ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
-        Temp = AcpiGbl_NsNodeList->TotalAllocated - AcpiGbl_NsNodeList->TotalFreed;
+        Temp = AcpiGbl_NsNodeList->TotalAllocated -
+                AcpiGbl_NsNodeList->TotalFreed;
         if (Temp > AcpiGbl_NsNodeList->MaxOccupied)
         {
             AcpiGbl_NsNodeList->MaxOccupied = Temp;
@@ -238,9 +239,8 @@
 
     ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
 
-    /*
-     * Detach an object if there is one, then delete the node
-     */
+    /* Detach an object if there is one, then delete the node */
+
     AcpiNsDetachObject (Node);
     (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
     return_VOID;
@@ -282,9 +282,8 @@
 
 
     /*
-     * Get the owner ID from the Walk state
-     * The owner ID is used to track table deletion and
-     * deletion of objects created by methods
+     * Get the owner ID from the Walk state. The owner ID is used to track
+     * table deletion and deletion of objects created by methods.
      */
     if (WalkState)
     {
@@ -369,9 +368,8 @@
         return_VOID;
     }
 
-    /*
-     * Deallocate all children at this level
-     */
+    /* Deallocate all children at this level */
+
     do
     {
         /* Get the things we need */
@@ -394,9 +392,8 @@
         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
             ChildNode, AcpiGbl_CurrentNodeCount));
 
-        /*
-         * Detach an object if there is one, then free the child node
-         */
+        /* Detach an object if there is one, then free the child node */
+
         AcpiNsDetachObject (ChildNode);
 
         /* Now we can delete the node */
@@ -409,11 +406,9 @@
 
     } while (!(Flags & ANOBJ_END_OF_PEER_LIST));
 
-
     /* Clear the parent's child pointer */
 
     ParentNode->Child = NULL;
-
     return_VOID;
 }
 
@@ -455,7 +450,7 @@
     {
         /* Get the next node in this scope (NULL if none) */
 
-        ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+        ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
         if (ChildNode)
         {
             /* Found a child node - detach any attached object */
@@ -464,7 +459,7 @@
 
             /* Check if this node has any children */
 
-            if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
+            if (ChildNode->Child)
             {
                 /*
                  * There is at least one child of this node,
@@ -561,7 +556,7 @@
          * Get the next child of this parent node. When ChildNode is NULL,
          * the first child of the parent is returned
          */
-        ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+        ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
 
         if (DeletionNode)
         {
@@ -581,7 +576,7 @@
 
             /* Check if this node has any children */
 
-            if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
+            if (ChildNode->Child)
             {
                 /*
                  * There is at least one child of this node,
--- a/usr/src/uts/intel/io/acpica/namespace/nsdump.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsdump.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nsdump - table dumping routines for debug
- *              $Revision: 1.185 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSDUMP_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -287,6 +287,13 @@
     }
 
     ThisNode = AcpiNsMapHandleToNode (ObjHandle);
+    if (!ThisNode)
+    {
+        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
+            ObjHandle));
+        return (AE_OK);
+    }
+
     Type = ThisNode->Type;
 
     /* Check if the owner matches */
@@ -313,9 +320,8 @@
         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
     }
 
-    /*
-     * Now we can print out the pertinent information
-     */
+    /* Now we can print out the pertinent information */
+
     AcpiOsPrintf (" %-12s %p %2.2X ",
             AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
 
@@ -451,7 +457,8 @@
                 ObjDesc->BufferField.BufferObj->Buffer.Node)
             {
                 AcpiOsPrintf ("Buf [%4.4s]",
-                    AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node));
+                    AcpiUtGetNodeName (
+                        ObjDesc->BufferField.BufferObj->Buffer.Node));
             }
             break;
 
@@ -459,23 +466,28 @@
         case ACPI_TYPE_LOCAL_REGION_FIELD:
 
             AcpiOsPrintf ("Rgn [%4.4s]",
-                AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node));
+                AcpiUtGetNodeName (
+                    ObjDesc->CommonField.RegionObj->Region.Node));
             break;
 
 
         case ACPI_TYPE_LOCAL_BANK_FIELD:
 
             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
-                AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node),
-                AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node));
+                AcpiUtGetNodeName (
+                    ObjDesc->CommonField.RegionObj->Region.Node),
+                AcpiUtGetNodeName (
+                    ObjDesc->BankField.BankObj->CommonField.Node));
             break;
 
 
         case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
-                AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node),
-                AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node));
+                AcpiUtGetNodeName (
+                    ObjDesc->IndexField.IndexObj->CommonField.Node),
+                AcpiUtGetNodeName (
+                    ObjDesc->IndexField.DataObj->CommonField.Node));
             break;
 
 
@@ -534,25 +546,25 @@
             /* Name is a Method and its AML offset/length are set */
 
             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
-                                        ObjDesc->Method.AmlLength);
+                ObjDesc->Method.AmlLength);
             break;
 
         case ACPI_TYPE_INTEGER:
 
             AcpiOsPrintf (" I:%8.8X8.8%X\n",
-                    ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+                ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
             break;
 
         case ACPI_TYPE_STRING:
 
             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
-                                        ObjDesc->String.Length);
+                ObjDesc->String.Length);
             break;
 
         case ACPI_TYPE_BUFFER:
 
             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
-                                        ObjDesc->Buffer.Length);
+                ObjDesc->Buffer.Length);
             break;
 
         default:
@@ -575,7 +587,6 @@
         return (AE_OK);
     }
 
-
     /* If there is an attached object, display it */
 
     DbgLevel     = AcpiDbgLevel;
@@ -603,7 +614,7 @@
 
         case ACPI_DESC_TYPE_OPERAND:
 
-            ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
+            ObjType = ObjDesc->Common.Type;
 
             if (ObjType > ACPI_TYPE_LOCAL_MAX)
             {
@@ -633,9 +644,8 @@
             goto Cleanup;
         }
 
-        /*
-         * Valid object, get the pointer to next level, if any
-         */
+        /* Valid object, get the pointer to next level, if any */
+
         switch (ObjType)
         {
         case ACPI_TYPE_BUFFER:
@@ -695,14 +705,14 @@
  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
  *                                    for an effectively unlimited depth.
- *              OwnerId             - Dump only objects owned by this ID.  Use
+ *              OwnerId             - Dump only objects owned by this ID. Use
  *                                    ACPI_UINT32_MAX to match all owners.
  *              StartHandle         - Where in namespace to start/end search
  *
  * RETURN:      None
  *
- * DESCRIPTION: Dump typed objects within the loaded namespace.
- *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
+ * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
+ *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
  *
  ******************************************************************************/
 
--- a/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsdumpdv.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nsdump - table dumping routines for debug
- *              $Revision: 1.21 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/io/acpica/namespace/nseval.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nseval.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: nseval - Object evaluation, includes control method execution
- *              $Revision: 1.145 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSEVAL_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acinterp.h"
 #include "acnamesp.h"
@@ -159,6 +159,7 @@
     ACPI_EVALUATE_INFO      *Info)
 {
     ACPI_STATUS             Status;
+    ACPI_NAMESPACE_NODE     *Node;
 
 
     ACPI_FUNCTION_TRACE (NsEvaluate);
@@ -172,6 +173,7 @@
     /* Initialize the return value to an invalid object */
 
     Info->ReturnObject = NULL;
+    Info->ParamCount = 0;
 
     /*
      * Get the actual namespace node for the target object. Handles these cases:
@@ -200,6 +202,8 @@
     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname,
         Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode)));
 
+    Node = Info->ResolvedNode;
+
     /*
      * Two major cases here:
      *
@@ -221,40 +225,21 @@
             return_ACPI_STATUS (AE_NULL_OBJECT);
         }
 
-        /* Calculate the number of arguments being passed to the method */
+        /* Count the number of arguments being passed to the method */
 
-        Info->ParamCount = 0;
         if (Info->Parameters)
         {
             while (Info->Parameters[Info->ParamCount])
             {
+                if (Info->ParamCount > ACPI_METHOD_MAX_ARG)
+                {
+                    return_ACPI_STATUS (AE_LIMIT);
+                }
                 Info->ParamCount++;
             }
         }
 
-        /*
-         * Warning if too few or too many arguments have been passed by the
-         * caller. We don't want to abort here with an error because an
-         * incorrect number of arguments may not cause the method to fail.
-         * However, the method will fail if there are too few arguments passed
-         * and the method attempts to use one of the missing ones.
-         */
-        if (Info->ParamCount < Info->ObjDesc->Method.ParamCount)
-        {
-            ACPI_WARNING ((AE_INFO,
-                "Insufficient arguments - method [%4.4s] needs %d, found %d",
-                AcpiUtGetNodeName (Info->ResolvedNode),
-                Info->ObjDesc->Method.ParamCount, Info->ParamCount));
-        }
-        else if (Info->ParamCount > Info->ObjDesc->Method.ParamCount)
-        {
-            ACPI_WARNING ((AE_INFO,
-                "Excess arguments - method [%4.4s] needs %d, found %d",
-                AcpiUtGetNodeName (Info->ResolvedNode),
-                Info->ObjDesc->Method.ParamCount, Info->ParamCount));
-        }
-
-        ACPI_DUMP_PATHNAME (Info->ResolvedNode, "Execute Method:",
+        ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method",
             ACPI_LV_INFO, _COMPONENT);
 
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -341,8 +326,15 @@
     }
 
     /*
-     * Check if there is a return value that must be dealt with
+     * Check input argument count against the ASL-defined count for a method.
+     * Also check predefined names: argument count and return value against
+     * the ACPI specification. Some incorrect return value types are repaired.
      */
+    (void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount,
+                Status, &Info->ReturnObject);
+
+    /* Check if there is a return value that must be dealt with */
+
     if (Status == AE_CTRL_RETURN_VALUE)
     {
         /* If caller does not want the return value, delete it */
--- a/usr/src/uts/intel/io/acpica/namespace/nsinit.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsinit.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nsinit - namespace initialization
- *              $Revision: 1.88 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSXFINIT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acdispat.h"
 #include "acinterp.h"
@@ -193,7 +193,8 @@
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
+        "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd "
+        "Buffers %hd/%hd Packages (%hd nodes)\n",
         Info.OpRegionInit,  Info.OpRegionCount,
         Info.FieldInit,     Info.FieldCount,
         Info.BufferInit,    Info.BufferCount,
@@ -242,7 +243,8 @@
     Info.Num_INI = 0;
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Initializing Device/Processor/Thermal objects by executing _INI methods:"));
+        "Initializing Device/Processor/Thermal objects "
+        "by executing _INI methods:"));
 
     /* Tree analysis: find all subtrees that contain _INI methods */
 
@@ -274,7 +276,8 @@
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n",
+        "\nExecuted %hd _INI methods requiring %hd _STA executions "
+        "(examined %hd objects)\n",
         Info.Num_INI, Info.Num_STA, Info.DeviceCount));
 
     return_ACPI_STATUS (Status);
@@ -364,17 +367,15 @@
         return (AE_OK);
     }
 
-    /*
-     * If the object is already initialized, nothing else to do
-     */
+    /* If the object is already initialized, nothing else to do */
+
     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
     {
         return (AE_OK);
     }
 
-    /*
-     * Must lock the interpreter before executing AML code
-     */
+    /* Must lock the interpreter before executing AML code */
+
     AcpiExEnterInterpreter ();
 
     /*
--- a/usr/src/uts/intel/io/acpica/namespace/nsload.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsload.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nsload - namespace loading/expanding/contracting procedures
- *              $Revision: 1.83 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __NSLOAD_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acdispat.h"
 #include "actables.h"
@@ -220,12 +220,12 @@
      * parse trees.
      */
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-        "**** Begin Table Method Parsing and Object Initialization ****\n"));
+        "**** Begin Table Method Parsing and Object Initialization\n"));
 
     Status = AcpiDsInitializeObjects (TableIndex, Node);
 
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-        "**** Completed Table Method Parsing and Object Initialization ****\n"));
+        "**** Completed Table Method Parsing and Object Initialization\n"));
 
     return_ACPI_STATUS (Status);
 }
--- a/usr/src/uts/intel/io/acpica/namespace/nsnames.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsnames.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: nsnames - Name manipulation and search
- *              $Revision: 1.101 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __NSNAMES_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlcode.h"
 #include "acnamesp.h"
 
@@ -201,7 +201,6 @@
 }
 
 
-#ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
  * FUNCTION:    AcpiNsGetExternalPathname
@@ -212,7 +211,8 @@
  *              the node, In external format (name segments separated by path
  *              separators.)
  *
- * DESCRIPTION: Used for debug printing in AcpiNsSearchTable().
+ * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually
+ *              for error and debug statements.
  *
  ******************************************************************************/
 
@@ -241,7 +241,7 @@
     NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
     if (!NameBuffer)
     {
-        ACPI_ERROR ((AE_INFO, "Allocation failure"));
+        ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size));
         return_PTR (NULL);
     }
 
@@ -256,7 +256,6 @@
 
     return_PTR (NameBuffer);
 }
-#endif
 
 
 /*******************************************************************************
@@ -304,7 +303,7 @@
 
     if (!Size)
     {
-        Size = 1;       /* Root node case */
+        Size = 1; /* Root node case */
     }
 
     return (Size + 1);  /* +1 for null string terminator */
--- a/usr/src/uts/intel/io/acpica/namespace/nsobject.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsobject.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: nsobject - Utilities for objects attached to namespace
  *                         table entries
- *              $Revision: 1.99 $
  *
  ******************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __NSOBJECT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -304,11 +304,21 @@
     ObjDesc = Node->Object;
 
     if (!ObjDesc ||
-        (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA))
+        (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
     {
         return_VOID;
     }
 
+    if (Node->Flags & ANOBJ_ALLOCATED_BUFFER)
+    {
+        /* Free the dynamic aml buffer */
+
+        if (ObjDesc->Common.Type == ACPI_TYPE_METHOD)
+        {
+            ACPI_FREE (ObjDesc->Method.AmlStart);
+        }
+    }
+
     /* Clear the entry in all cases */
 
     Node->Object = NULL;
@@ -316,7 +326,7 @@
     {
         Node->Object = ObjDesc->Common.NextObject;
         if (Node->Object &&
-           (ACPI_GET_OBJECT_TYPE (Node->Object) != ACPI_TYPE_LOCAL_DATA))
+           ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA))
         {
             Node->Object = Node->Object->Common.NextObject;
         }
@@ -365,7 +375,7 @@
     if (!Node->Object ||
             ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) &&
              (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED))  ||
-        (ACPI_GET_OBJECT_TYPE (Node->Object) == ACPI_TYPE_LOCAL_DATA))
+        ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA))
     {
         return_PTR (NULL);
     }
@@ -394,10 +404,10 @@
     ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
 
 
-    if ((!ObjDesc)                                                ||
-        (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA)  ||
-        (!ObjDesc->Common.NextObject)                             ||
-        (ACPI_GET_OBJECT_TYPE (ObjDesc->Common.NextObject) == ACPI_TYPE_LOCAL_DATA))
+    if ((!ObjDesc)                                     ||
+        (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA)  ||
+        (!ObjDesc->Common.NextObject)                  ||
+        ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
     {
         return_PTR (NULL);
     }
@@ -437,7 +447,7 @@
     ObjDesc = Node->Object;
     while (ObjDesc)
     {
-        if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
             (ObjDesc->Data.Handler == Handler))
         {
             return (AE_ALREADY_EXISTS);
@@ -500,7 +510,7 @@
     ObjDesc = Node->Object;
     while (ObjDesc)
     {
-        if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
             (ObjDesc->Data.Handler == Handler))
         {
             if (PrevObjDesc)
@@ -551,7 +561,7 @@
     ObjDesc = Node->Object;
     while (ObjDesc)
     {
-        if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) &&
+        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
             (ObjDesc->Data.Handler == Handler))
         {
             *Data = ObjDesc->Data.Pointer;
--- a/usr/src/uts/intel/io/acpica/namespace/nsparse.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsparse.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nsparse - namespace interface to AML parser
- *              $Revision: 1.19 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __NSPARSE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acparser.h"
 #include "acdispat.h"
@@ -267,7 +267,8 @@
      * performs another complete parse of the AML.
      */
     ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
-    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex, StartNode);
+    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1,
+                TableIndex, StartNode);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -283,7 +284,8 @@
      * parse objects are all cached.
      */
     ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
-    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, StartNode);
+    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2,
+                TableIndex, StartNode);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/io/acpica/namespace/nspredef.c	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,1196 @@
+/******************************************************************************
+ *
+ * Module Name: nspredef - Validation of ACPI predefined methods and objects
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __NSPREDEF_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acpredef.h"
+
+
+#define _COMPONENT          ACPI_NAMESPACE
+        ACPI_MODULE_NAME    ("nspredef")
+
+
+/*******************************************************************************
+ *
+ * This module validates predefined ACPI objects that appear in the namespace,
+ * at the time they are evaluated (via AcpiEvaluateObject). The purpose of this
+ * validation is to detect problems with BIOS-exposed predefined ACPI objects
+ * before the results are returned to the ACPI-related drivers.
+ *
+ * There are several areas that are validated:
+ *
+ *  1) The number of input arguments as defined by the method/object in the
+ *      ASL is validated against the ACPI specification.
+ *  2) The type of the return object (if any) is validated against the ACPI
+ *      specification.
+ *  3) For returned package objects, the count of package elements is
+ *      validated, as well as the type of each package element. Nested
+ *      packages are supported.
+ *
+ * For any problems found, a warning message is issued.
+ *
+ ******************************************************************************/
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiNsCheckPackage (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr,
+    const ACPI_PREDEFINED_INFO  *Predefined);
+
+static ACPI_STATUS
+AcpiNsCheckPackageElements (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **Elements,
+    UINT8                       Type1,
+    UINT32                      Count1,
+    UINT8                       Type2,
+    UINT32                      Count2,
+    UINT32                      StartIndex);
+
+static ACPI_STATUS
+AcpiNsCheckObjectType (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr,
+    UINT32                      ExpectedBtypes,
+    UINT32                      PackageIndex);
+
+static ACPI_STATUS
+AcpiNsCheckReference (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         *ReturnObject);
+
+static ACPI_STATUS
+AcpiNsRepairObject (
+    UINT32                      ExpectedBtypes,
+    UINT32                      PackageIndex,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr);
+
+/*
+ * Names for the types that can be returned by the predefined objects.
+ * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
+ */
+static const char   *AcpiRtypeNames[] =
+{
+    "/Integer",
+    "/String",
+    "/Buffer",
+    "/Package",
+    "/Reference",
+};
+
+#define ACPI_NOT_PACKAGE    ACPI_UINT32_MAX
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckPredefinedNames
+ *
+ * PARAMETERS:  Node            - Namespace node for the method/object
+ *              ReturnObjectPtr - Pointer to the object returned from the
+ *                                evaluation of a method or object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check an ACPI name for a match in the predefined name list.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsCheckPredefinedNames (
+    ACPI_NAMESPACE_NODE         *Node,
+    UINT32                      UserParamCount,
+    ACPI_STATUS                 ReturnStatus,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr)
+{
+    ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;
+    ACPI_STATUS                 Status = AE_OK;
+    const ACPI_PREDEFINED_INFO  *Predefined;
+    char                        *Pathname;
+
+
+    /* Match the name for this method/object against the predefined list */
+
+    Predefined = AcpiNsCheckForPredefinedName (Node);
+
+    /* Get the full pathname to the object, for use in error messages */
+
+    Pathname = AcpiNsGetExternalPathname (Node);
+    if (!Pathname)
+    {
+        return (AE_OK); /* Could not get pathname, ignore */
+    }
+
+    /*
+     * Check that the parameter count for this method matches the ASL
+     * definition. For predefined names, ensure that both the caller and
+     * the method itself are in accordance with the ACPI specification.
+     */
+    AcpiNsCheckParameterCount (Pathname, Node, UserParamCount, Predefined);
+
+    /* If not a predefined name, we cannot validate the return object */
+
+    if (!Predefined)
+    {
+        goto Exit;
+    }
+
+    /* If the method failed, we cannot validate the return object */
+
+    if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE))
+    {
+        goto Exit;
+    }
+
+    /*
+     * Only validate the return value on the first successful evaluation of
+     * the method. This ensures that any warnings will only be emitted during
+     * the very first evaluation of the method/object.
+     */
+    if (Node->Flags & ANOBJ_EVALUATED)
+    {
+        goto Exit;
+    }
+
+    /* Mark the node as having been successfully evaluated */
+
+    Node->Flags |= ANOBJ_EVALUATED;
+
+    /*
+     * If there is no return value, check if we require a return value for
+     * this predefined name. Either one return value is expected, or none,
+     * for both methods and other objects.
+     *
+     * Exit now if there is no return object. Warning if one was expected.
+     */
+    if (!ReturnObject)
+    {
+        if ((Predefined->Info.ExpectedBtypes) &&
+            (!(Predefined->Info.ExpectedBtypes & ACPI_RTYPE_NONE)))
+        {
+            ACPI_ERROR ((AE_INFO,
+                "%s: Missing expected return value", Pathname));
+
+            Status = AE_AML_NO_RETURN_VALUE;
+        }
+        goto Exit;
+    }
+
+    /*
+     * We have a return value, but if one wasn't expected, just exit, this is
+     * not a problem
+     *
+     * For example, if the "Implicit Return" feature is enabled, methods will
+     * always return a value
+     */
+    if (!Predefined->Info.ExpectedBtypes)
+    {
+        goto Exit;
+    }
+
+    /*
+     * Check that the type of the return object is what is expected for
+     * this predefined name
+     */
+    Status = AcpiNsCheckObjectType (Pathname, ReturnObjectPtr,
+                Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE);
+    if (ACPI_FAILURE (Status))
+    {
+        goto Exit;
+    }
+
+    /* For returned Package objects, check the type of all sub-objects */
+
+    if (ReturnObject->Common.Type == ACPI_TYPE_PACKAGE)
+    {
+        Status = AcpiNsCheckPackage (Pathname, ReturnObjectPtr, Predefined);
+    }
+
+Exit:
+    ACPI_FREE (Pathname);
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckParameterCount
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              Node            - Namespace node for the method/object
+ *              UserParamCount  - Number of args passed in by the caller
+ *              Predefined      - Pointer to entry in predefined name table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a
+ *              predefined name is what is expected (i.e., what is defined in
+ *              the ACPI specification for this predefined name.)
+ *
+ ******************************************************************************/
+
+void
+AcpiNsCheckParameterCount (
+    char                        *Pathname,
+    ACPI_NAMESPACE_NODE         *Node,
+    UINT32                      UserParamCount,
+    const ACPI_PREDEFINED_INFO  *Predefined)
+{
+    UINT32                      ParamCount;
+    UINT32                      RequiredParamsCurrent;
+    UINT32                      RequiredParamsOld;
+
+
+    /* Methods have 0-7 parameters. All other types have zero. */
+
+    ParamCount = 0;
+    if (Node->Type == ACPI_TYPE_METHOD)
+    {
+        ParamCount = Node->Object->Method.ParamCount;
+    }
+
+    /* Argument count check for non-predefined methods/objects */
+
+    if (!Predefined)
+    {
+        /*
+         * Warning if too few or too many arguments have been passed by the
+         * caller. An incorrect number of arguments may not cause the method
+         * to fail. However, the method will fail if there are too few
+         * arguments and the method attempts to use one of the missing ones.
+         */
+        if (UserParamCount < ParamCount)
+        {
+            ACPI_WARNING ((AE_INFO,
+                "%s: Insufficient arguments - needs %d, found %d",
+                Pathname, ParamCount, UserParamCount));
+        }
+        else if (UserParamCount > ParamCount)
+        {
+            ACPI_WARNING ((AE_INFO,
+                "%s: Excess arguments - needs %d, found %d",
+                Pathname, ParamCount, UserParamCount));
+        }
+        return;
+    }
+
+    /* Allow two different legal argument counts (_SCP, etc.) */
+
+    RequiredParamsCurrent = Predefined->Info.ParamCount & 0x0F;
+    RequiredParamsOld = Predefined->Info.ParamCount >> 4;
+
+    if (UserParamCount != ACPI_UINT32_MAX)
+    {
+        /* Validate the user-supplied parameter count */
+
+        if ((UserParamCount != RequiredParamsCurrent) &&
+            (UserParamCount != RequiredParamsOld))
+        {
+            ACPI_WARNING ((AE_INFO,
+                "%s: Parameter count mismatch - "
+                "caller passed %d, ACPI requires %d",
+                Pathname, UserParamCount, RequiredParamsCurrent));
+        }
+    }
+
+    /*
+     * Only validate the argument count on the first successful evaluation of
+     * the method. This ensures that any warnings will only be emitted during
+     * the very first evaluation of the method/object.
+     */
+    if (Node->Flags & ANOBJ_EVALUATED)
+    {
+        return;
+    }
+
+    /*
+     * Check that the ASL-defined parameter count is what is expected for
+     * this predefined name.
+     */
+    if ((ParamCount != RequiredParamsCurrent) &&
+        (ParamCount != RequiredParamsOld))
+    {
+        ACPI_WARNING ((AE_INFO,
+            "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d",
+            Pathname, ParamCount, RequiredParamsCurrent));
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckForPredefinedName
+ *
+ * PARAMETERS:  Node            - Namespace node for the method/object
+ *
+ * RETURN:      Pointer to entry in predefined table. NULL indicates not found.
+ *
+ * DESCRIPTION: Check an object name against the predefined object list.
+ *
+ ******************************************************************************/
+
+const ACPI_PREDEFINED_INFO *
+AcpiNsCheckForPredefinedName (
+    ACPI_NAMESPACE_NODE         *Node)
+{
+    const ACPI_PREDEFINED_INFO  *ThisName;
+
+
+    /* Quick check for a predefined name, first character must be underscore */
+
+    if (Node->Name.Ascii[0] != '_')
+    {
+        return (NULL);
+    }
+
+    /* Search info table for a predefined method/object name */
+
+    ThisName = PredefinedNames;
+    while (ThisName->Info.Name[0])
+    {
+        if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Info.Name))
+        {
+            /* Return pointer to this table entry */
+
+            return (ThisName);
+        }
+
+        /*
+         * Skip next entry in the table if this name returns a Package
+         * (next entry contains the package info)
+         */
+        if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
+        {
+            ThisName++;
+        }
+
+        ThisName++;
+    }
+
+    return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckPackage
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              ReturnObjectPtr - Pointer to the object returned from the
+ *                                evaluation of a method or object
+ *              Predefined      - Pointer to entry in predefined name table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check a returned package object for the correct count and
+ *              correct type of all sub-objects.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsCheckPackage (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr,
+    const ACPI_PREDEFINED_INFO  *Predefined)
+{
+    ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;
+    const ACPI_PREDEFINED_INFO  *Package;
+    ACPI_OPERAND_OBJECT         *SubPackage;
+    ACPI_OPERAND_OBJECT         **Elements;
+    ACPI_OPERAND_OBJECT         **SubElements;
+    ACPI_STATUS                 Status;
+    UINT32                      ExpectedCount;
+    UINT32                      Count;
+    UINT32                      i;
+    UINT32                      j;
+
+
+    ACPI_FUNCTION_NAME (NsCheckPackage);
+
+
+    /* The package info for this name is in the next table entry */
+
+    Package = Predefined + 1;
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+        "%s Validating return Package of Type %X, Count %X\n",
+        Pathname, Package->RetInfo.Type, ReturnObject->Package.Count));
+
+    /* Extract package count and elements array */
+
+    Elements = ReturnObject->Package.Elements;
+    Count = ReturnObject->Package.Count;
+
+    /* The package must have at least one element, else invalid */
+
+    if (!Count)
+    {
+        ACPI_WARNING ((AE_INFO,
+            "%s: Return Package has no elements (empty)", Pathname));
+
+        return (AE_AML_OPERAND_VALUE);
+    }
+
+    /*
+     * Decode the type of the expected package contents
+     *
+     * PTYPE1 packages contain no subpackages
+     * PTYPE2 packages contain sub-packages
+     */
+    switch (Package->RetInfo.Type)
+    {
+    case ACPI_PTYPE1_FIXED:
+
+        /*
+         * The package count is fixed and there are no sub-packages
+         *
+         * If package is too small, exit.
+         * If package is larger than expected, issue warning but continue
+         */
+        ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
+        if (Count < ExpectedCount)
+        {
+            goto PackageTooSmall;
+        }
+        else if (Count > ExpectedCount)
+        {
+            ACPI_WARNING ((AE_INFO,
+                "%s: Return Package is larger than needed - "
+                "found %u, expected %u", Pathname, Count, ExpectedCount));
+        }
+
+        /* Validate all elements of the returned package */
+
+        Status = AcpiNsCheckPackageElements (Pathname, Elements,
+                    Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
+                    Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        break;
+
+
+    case ACPI_PTYPE1_VAR:
+
+        /*
+         * The package count is variable, there are no sub-packages, and all
+         * elements must be of the same type
+         */
+        for (i = 0; i < Count; i++)
+        {
+            Status = AcpiNsCheckObjectType (Pathname, Elements,
+                        Package->RetInfo.ObjectType1, i);
+            if (ACPI_FAILURE (Status))
+            {
+                return (Status);
+            }
+            Elements++;
+        }
+        break;
+
+
+    case ACPI_PTYPE1_OPTION:
+
+        /*
+         * The package count is variable, there are no sub-packages. There are
+         * a fixed number of required elements, and a variable number of
+         * optional elements.
+         *
+         * Check if package is at least as large as the minimum required
+         */
+        ExpectedCount = Package->RetInfo3.Count;
+        if (Count < ExpectedCount)
+        {
+            goto PackageTooSmall;
+        }
+
+        /* Variable number of sub-objects */
+
+        for (i = 0; i < Count; i++)
+        {
+            if (i < Package->RetInfo3.Count)
+            {
+                /* These are the required package elements (0, 1, or 2) */
+
+                Status = AcpiNsCheckObjectType (Pathname, Elements,
+                            Package->RetInfo3.ObjectType[i], i);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+            }
+            else
+            {
+                /* These are the optional package elements */
+
+                Status = AcpiNsCheckObjectType (Pathname, Elements,
+                            Package->RetInfo3.TailObjectType, i);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+            }
+            Elements++;
+        }
+        break;
+
+
+    case ACPI_PTYPE2_PKG_COUNT:
+
+        /* First element is the (Integer) count of sub-packages to follow */
+
+        Status = AcpiNsCheckObjectType (Pathname, Elements,
+                    ACPI_RTYPE_INTEGER, 0);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+
+        /*
+         * Count cannot be larger than the parent package length, but allow it
+         * to be smaller. The >= accounts for the Integer above.
+         */
+        ExpectedCount = (UINT32) (*Elements)->Integer.Value;
+        if (ExpectedCount >= Count)
+        {
+            goto PackageTooSmall;
+        }
+
+        Count = ExpectedCount;
+        Elements++;
+
+        /* Now we can walk the sub-packages */
+
+        /*lint -fallthrough */
+
+
+    case ACPI_PTYPE2:
+    case ACPI_PTYPE2_FIXED:
+    case ACPI_PTYPE2_MIN:
+    case ACPI_PTYPE2_COUNT:
+
+        /*
+         * These types all return a single package that consists of a variable
+         * number of sub-packages
+         */
+        for (i = 0; i < Count; i++)
+        {
+            SubPackage = *Elements;
+            SubElements = SubPackage->Package.Elements;
+
+            /* Each sub-object must be of type Package */
+
+            Status = AcpiNsCheckObjectType (Pathname, &SubPackage,
+                        ACPI_RTYPE_PACKAGE, i);
+            if (ACPI_FAILURE (Status))
+            {
+                return (Status);
+            }
+
+            /* Examine the different types of sub-packages */
+
+            switch (Package->RetInfo.Type)
+            {
+            case ACPI_PTYPE2:
+            case ACPI_PTYPE2_PKG_COUNT:
+
+                /* Each subpackage has a fixed number of elements */
+
+                ExpectedCount =
+                    Package->RetInfo.Count1 + Package->RetInfo.Count2;
+                if (SubPackage->Package.Count != ExpectedCount)
+                {
+                    Count = SubPackage->Package.Count;
+                    goto PackageTooSmall;
+                }
+
+                Status = AcpiNsCheckPackageElements (Pathname, SubElements,
+                            Package->RetInfo.ObjectType1,
+                            Package->RetInfo.Count1,
+                            Package->RetInfo.ObjectType2,
+                            Package->RetInfo.Count2, 0);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+                break;
+
+            case ACPI_PTYPE2_FIXED:
+
+                /* Each sub-package has a fixed length */
+
+                ExpectedCount = Package->RetInfo2.Count;
+                if (SubPackage->Package.Count < ExpectedCount)
+                {
+                    Count = SubPackage->Package.Count;
+                    goto PackageTooSmall;
+                }
+
+                /* Check the type of each sub-package element */
+
+                for (j = 0; j < ExpectedCount; j++)
+                {
+                    Status = AcpiNsCheckObjectType (Pathname, &SubElements[j],
+                                Package->RetInfo2.ObjectType[j], j);
+                    if (ACPI_FAILURE (Status))
+                    {
+                        return (Status);
+                    }
+                }
+                break;
+
+            case ACPI_PTYPE2_MIN:
+
+                /* Each sub-package has a variable but minimum length */
+
+                ExpectedCount = Package->RetInfo.Count1;
+                if (SubPackage->Package.Count < ExpectedCount)
+                {
+                    Count = SubPackage->Package.Count;
+                    goto PackageTooSmall;
+                }
+
+                /* Check the type of each sub-package element */
+
+                Status = AcpiNsCheckPackageElements (Pathname, SubElements,
+                            Package->RetInfo.ObjectType1,
+                            SubPackage->Package.Count, 0, 0, 0);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+                break;
+
+            case ACPI_PTYPE2_COUNT:
+
+                /* First element is the (Integer) count of elements to follow */
+
+                Status = AcpiNsCheckObjectType (Pathname, SubElements,
+                            ACPI_RTYPE_INTEGER, 0);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+
+                /* Make sure package is large enough for the Count */
+
+                ExpectedCount = (UINT32) (*SubElements)->Integer.Value;
+                if (SubPackage->Package.Count < ExpectedCount)
+                {
+                    Count = SubPackage->Package.Count;
+                    goto PackageTooSmall;
+                }
+
+                /* Check the type of each sub-package element */
+
+                Status = AcpiNsCheckPackageElements (Pathname,
+                            (SubElements + 1),
+                            Package->RetInfo.ObjectType1,
+                            (ExpectedCount - 1), 0, 0, 1);
+                if (ACPI_FAILURE (Status))
+                {
+                    return (Status);
+                }
+                break;
+
+            default:
+                break;
+            }
+
+            Elements++;
+        }
+        break;
+
+
+    default:
+
+        /* Should not get here if predefined info table is correct */
+
+        ACPI_WARNING ((AE_INFO,
+            "%s: Invalid internal return type in table entry: %X",
+            Pathname, Package->RetInfo.Type));
+
+        return (AE_AML_INTERNAL);
+    }
+
+    return (AE_OK);
+
+
+PackageTooSmall:
+
+    /* Error exit for the case with an incorrect package count */
+
+    ACPI_WARNING ((AE_INFO, "%s: Return Package is too small - "
+        "found %u, expected %u", Pathname, Count, ExpectedCount));
+
+    return (AE_AML_OPERAND_VALUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckPackageElements
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              Elements        - Pointer to the package elements array
+ *              Type1           - Object type for first group
+ *              Count1          - Count for first group
+ *              Type2           - Object type for second group
+ *              Count2          - Count for second group
+ *              StartIndex      - Start of the first group of elements
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check that all elements of a package are of the correct object
+ *              type. Supports up to two groups of different object types.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsCheckPackageElements (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **Elements,
+    UINT8                       Type1,
+    UINT32                      Count1,
+    UINT8                       Type2,
+    UINT32                      Count2,
+    UINT32                      StartIndex)
+{
+    ACPI_OPERAND_OBJECT         **ThisElement = Elements;
+    ACPI_STATUS                 Status;
+    UINT32                      i;
+
+
+    /*
+     * Up to two groups of package elements are supported by the data
+     * structure. All elements in each group must be of the same type.
+     * The second group can have a count of zero.
+     */
+    for (i = 0; i < Count1; i++)
+    {
+        Status = AcpiNsCheckObjectType (Pathname, ThisElement,
+                    Type1, i + StartIndex);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        ThisElement++;
+    }
+
+    for (i = 0; i < Count2; i++)
+    {
+        Status = AcpiNsCheckObjectType (Pathname, ThisElement,
+                    Type2, (i + Count1 + StartIndex));
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        ThisElement++;
+    }
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckObjectType
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              ReturnObjectPtr - Pointer to the object returned from the
+ *                                evaluation of a method or object
+ *              ExpectedBtypes  - Bitmap of expected return type(s)
+ *              PackageIndex    - Index of object within parent package (if
+ *                                applicable - ACPI_NOT_PACKAGE otherwise)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check the type of the return object against the expected object
+ *              type(s). Use of Btype allows multiple expected object types.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsCheckObjectType (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr,
+    UINT32                      ExpectedBtypes,
+    UINT32                      PackageIndex)
+{
+    ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;
+    ACPI_STATUS                 Status = AE_OK;
+    UINT32                      ReturnBtype;
+    char                        TypeBuffer[48]; /* Room for 5 types */
+    UINT32                      ThisRtype;
+    UINT32                      i;
+    UINT32                      j;
+
+
+    /*
+     * If we get a NULL ReturnObject here, it is a NULL package element,
+     * and this is always an error.
+     */
+    if (!ReturnObject)
+    {
+        goto TypeErrorExit;
+    }
+
+    /* A Namespace node should not get here, but make sure */
+
+    if (ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED)
+    {
+        ACPI_WARNING ((AE_INFO,
+            "%s: Invalid return type - Found a Namespace node [%4.4s] type %s",
+            Pathname, ReturnObject->Node.Name.Ascii,
+            AcpiUtGetTypeName (ReturnObject->Node.Type)));
+        return (AE_AML_OPERAND_TYPE);
+    }
+
+    /*
+     * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type.
+     * The bitmapped type allows multiple possible return types.
+     *
+     * Note, the cases below must handle all of the possible types returned
+     * from all of the predefined names (including elements of returned
+     * packages)
+     */
+    switch (ReturnObject->Common.Type)
+    {
+    case ACPI_TYPE_INTEGER:
+        ReturnBtype = ACPI_RTYPE_INTEGER;
+        break;
+
+    case ACPI_TYPE_BUFFER:
+        ReturnBtype = ACPI_RTYPE_BUFFER;
+        break;
+
+    case ACPI_TYPE_STRING:
+        ReturnBtype = ACPI_RTYPE_STRING;
+        break;
+
+    case ACPI_TYPE_PACKAGE:
+        ReturnBtype = ACPI_RTYPE_PACKAGE;
+        break;
+
+    case ACPI_TYPE_LOCAL_REFERENCE:
+        ReturnBtype = ACPI_RTYPE_REFERENCE;
+        break;
+
+    default:
+        /* Not one of the supported objects, must be incorrect */
+
+        goto TypeErrorExit;
+    }
+
+    /* Is the object one of the expected types? */
+
+    if (!(ReturnBtype & ExpectedBtypes))
+    {
+        /* Type mismatch -- attempt repair of the returned object */
+
+        Status = AcpiNsRepairObject (ExpectedBtypes, PackageIndex,
+                    ReturnObjectPtr);
+        if (ACPI_SUCCESS (Status))
+        {
+            return (Status);
+        }
+        goto TypeErrorExit;
+    }
+
+    /* For reference objects, check that the reference type is correct */
+
+    if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
+    {
+        Status = AcpiNsCheckReference (Pathname, ReturnObject);
+    }
+
+    return (Status);
+
+
+TypeErrorExit:
+
+    /* Create a string with all expected types for this predefined object */
+
+    j = 1;
+    TypeBuffer[0] = 0;
+    ThisRtype = ACPI_RTYPE_INTEGER;
+
+    for (i = 0; i < ACPI_NUM_RTYPES; i++)
+    {
+        /* If one of the expected types, concatenate the name of this type */
+
+        if (ExpectedBtypes & ThisRtype)
+        {
+            ACPI_STRCAT (TypeBuffer, &AcpiRtypeNames[i][j]);
+            j = 0;              /* Use name separator from now on */
+        }
+        ThisRtype <<= 1;    /* Next Rtype */
+    }
+
+    if (PackageIndex == ACPI_NOT_PACKAGE)
+    {
+        ACPI_WARNING ((AE_INFO,
+            "%s: Return type mismatch - found %s, expected %s",
+            Pathname, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
+    }
+    else
+    {
+        ACPI_WARNING ((AE_INFO,
+            "%s: Return Package type mismatch at index %u - "
+            "found %s, expected %s", Pathname, PackageIndex,
+            AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer));
+    }
+
+    return (AE_AML_OPERAND_TYPE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsCheckReference
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              ReturnObject    - Object returned from the evaluation of a
+ *                                method or object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check a returned reference object for the correct reference
+ *              type. The only reference type that can be returned from a
+ *              predefined method is a named reference. All others are invalid.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsCheckReference (
+    char                        *Pathname,
+    ACPI_OPERAND_OBJECT         *ReturnObject)
+{
+
+    /*
+     * Check the reference object for the correct reference type (opcode).
+     * The only type of reference that can be converted to an ACPI_OBJECT is
+     * a reference to a named object (reference class: NAME)
+     */
+    if (ReturnObject->Reference.Class == ACPI_REFCLASS_NAME)
+    {
+        return (AE_OK);
+    }
+
+    ACPI_WARNING ((AE_INFO,
+        "%s: Return type mismatch - "
+        "unexpected reference object type [%s] %2.2X",
+        Pathname, AcpiUtGetReferenceName (ReturnObject),
+        ReturnObject->Reference.Class));
+
+    return (AE_AML_OPERAND_TYPE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsRepairObject
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              PackageIndex    - Used to determine if target is in a package
+ *              ReturnObjectPtr - Pointer to the object returned from the
+ *                                evaluation of a method or object
+ *
+ * RETURN:      Status. AE_OK if repair was successful.
+ *
+ * DESCRIPTION: Attempt to repair/convert a return object of a type that was
+ *              not expected.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsRepairObject (
+    UINT32                      ExpectedBtypes,
+    UINT32                      PackageIndex,
+    ACPI_OPERAND_OBJECT         **ReturnObjectPtr)
+{
+    ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;
+    ACPI_OPERAND_OBJECT         *NewObject;
+    ACPI_SIZE                   Length;
+
+
+    switch (ReturnObject->Common.Type)
+    {
+    case ACPI_TYPE_BUFFER:
+
+        if (!(ExpectedBtypes & ACPI_RTYPE_STRING))
+        {
+            return (AE_AML_OPERAND_TYPE);
+        }
+
+        /*
+         * Have a Buffer, expected a String, convert. Use a ToString
+         * conversion, no transform performed on the buffer data. The best
+         * example of this is the _BIF method, where the string data from
+         * the battery is often (incorrectly) returned as buffer object(s).
+         */
+        Length = 0;
+        while ((Length < ReturnObject->Buffer.Length) &&
+                (ReturnObject->Buffer.Pointer[Length]))
+        {
+            Length++;
+        }
+
+        /* Allocate a new string object */
+
+        NewObject = AcpiUtCreateStringObject (Length);
+        if (!NewObject)
+        {
+            return (AE_NO_MEMORY);
+        }
+
+        /*
+         * Copy the raw buffer data with no transform. String is already NULL
+         * terminated at Length+1.
+         */
+        ACPI_MEMCPY (NewObject->String.Pointer,
+            ReturnObject->Buffer.Pointer, Length);
+
+        /* Install the new return object */
+
+        AcpiUtRemoveReference (ReturnObject);
+        *ReturnObjectPtr = NewObject;
+
+        /*
+         * If the object is a package element, we need to:
+         * 1. Decrement the reference count of the orignal object, it was
+         *    incremented when building the package
+         * 2. Increment the reference count of the new object, it will be
+         *    decremented when releasing the package
+         */
+        if (PackageIndex != ACPI_NOT_PACKAGE)
+        {
+            AcpiUtRemoveReference (ReturnObject);
+            AcpiUtAddReference (NewObject);
+        }
+        return (AE_OK);
+
+    default:
+        break;
+    }
+
+    return (AE_AML_OPERAND_TYPE);
+}
+
--- a/usr/src/uts/intel/io/acpica/namespace/nssearch.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nssearch.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: nssearch - Namespace search
- *              $Revision: 1.123 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,8 +116,12 @@
 #define __NSSEARCH_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
+#ifdef ACPI_ASL_COMPILER
+#include "amlcode.h"
+#endif
 
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nssearch")
@@ -245,7 +248,8 @@
     /* Searched entire namespace level, not found */
 
     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-        "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
+        "Name [%4.4s] (%s) not found in search in scope [%4.4s] "
+        "%p first child %p\n",
         ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type),
         AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child));
 
@@ -319,9 +323,8 @@
         "Searching parent [%4.4s] for [%4.4s]\n",
         AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName)));
 
-    /*
-     * Search parents until target is found or we have backed up to the root
-     */
+    /* Search parents until target is found or we have backed up to the root */
+
     while (ParentNode)
     {
         /*
@@ -426,6 +429,13 @@
             Status = AE_ALREADY_EXISTS;
         }
 
+#ifdef ACPI_ASL_COMPILER
+        if (*ReturnNode && (*ReturnNode)->Type == ACPI_TYPE_ANY)
+        {
+            (*ReturnNode)->Flags |= ANOBJ_IS_EXTERNAL;
+        }
+#endif
+
         /* Either found it or there was an error: finished either way */
 
         return_ACPI_STATUS (Status);
@@ -473,10 +483,11 @@
     }
 
 #ifdef ACPI_ASL_COMPILER
-    /*
-     * Node is an object defined by an External() statement
-     */
-    if (Flags & ACPI_NS_EXTERNAL)
+
+    /* Node is an object defined by an External() statement */
+
+    if (Flags & ACPI_NS_EXTERNAL ||
+        (WalkState && WalkState->Opcode == AML_SCOPE_OP))
     {
         NewNode->Flags |= ANOBJ_IS_EXTERNAL;
     }
--- a/usr/src/uts/intel/io/acpica/namespace/nsutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  *                        parents and siblings and Scope manipulation
- *              $Revision: 1.157 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSUTILS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "amlcode.h"
 
@@ -434,16 +434,22 @@
      *
      * strlen() + 1 covers the first NameSeg, which has no path separator
      */
-    if (AcpiNsValidRootPrefix (NextExternalChar[0]))
+    if (AcpiNsValidRootPrefix (*NextExternalChar))
     {
         Info->FullyQualified = TRUE;
         NextExternalChar++;
+
+        /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
+
+        while (AcpiNsValidRootPrefix (*NextExternalChar))
+        {
+            NextExternalChar++;
+        }
     }
     else
     {
-        /*
-         * Handle Carat prefixes
-         */
+        /* Handle Carat prefixes */
+
         while (*NextExternalChar == '^')
         {
             Info->NumCarats++;
@@ -716,9 +722,8 @@
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
 
-    /*
-     * Check for a prefix (one '\' | one or more '^').
-     */
+    /* Check for a prefix (one '\' | one or more '^') */
+
     switch (InternalName[0])
     {
     case '\\':
@@ -750,7 +755,7 @@
     }
 
     /*
-     * Check for object names.  Note that there could be 0-255 of these
+     * Check for object names. Note that there could be 0-255 of these
      * 4-byte elements.
      */
     if (PrefixLength < InternalNameLength)
@@ -810,9 +815,8 @@
         return_ACPI_STATUS (AE_BAD_PATHNAME);
     }
 
-    /*
-     * Build ConvertedName
-     */
+    /* Build the ConvertedName */
+
     *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength);
     if (!(*ConvertedName))
     {
@@ -865,6 +869,9 @@
  *       and keep all pointers within this subsystem - however this introduces
  *       more (and perhaps unnecessary) overhead.
  *
+ * The current implemenation is basically a placeholder until such time comes
+ * that it is needed.
+ *
  ******************************************************************************/
 
 ACPI_NAMESPACE_NODE *
@@ -875,9 +882,8 @@
     ACPI_FUNCTION_ENTRY ();
 
 
-    /*
-     * Simple implementation
-     */
+    /* Parameter validation */
+
     if ((!Handle) || (Handle == ACPI_ROOT_OBJECT))
     {
         return (AcpiGbl_RootNode);
@@ -1082,7 +1088,7 @@
                 NULL, ReturnNode);
     if (ACPI_FAILURE (Status))
     {
-        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n",
                 Pathname, AcpiFormatException (Status)));
     }
 
--- a/usr/src/uts/intel/io/acpica/namespace/nswalk.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nswalk.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: nswalk - Functions for walking the ACPI namespace
- *              $Revision: 1.47 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __NSWALK_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -129,6 +129,55 @@
  *
  * FUNCTION:    AcpiNsGetNextNode
  *
+ * PARAMETERS:  ParentNode          - Parent node whose children we are
+ *                                    getting
+ *              ChildNode           - Previous child that was found.
+ *                                    The NEXT child will be returned
+ *
+ * RETURN:      ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
+ *                                    none is found.
+ *
+ * DESCRIPTION: Return the next peer node within the namespace.  If Handle
+ *              is valid, Scope is ignored.  Otherwise, the first node
+ *              within Scope is returned.
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextNode (
+    ACPI_NAMESPACE_NODE     *ParentNode,
+    ACPI_NAMESPACE_NODE     *ChildNode)
+{
+    ACPI_FUNCTION_ENTRY ();
+
+
+    if (!ChildNode)
+    {
+        /* It's really the parent's _scope_ that we want */
+
+        return (ParentNode->Child);
+    }
+
+    /*
+     * Get the next node.
+     *
+     * If we are at the end of this peer list, return NULL
+     */
+    if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)
+    {
+        return NULL;
+    }
+
+    /* Otherwise just return the next peer */
+
+    return (ChildNode->Peer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsGetNextNodeTyped
+ *
  * PARAMETERS:  Type                - Type of node to be searched for
  *              ParentNode          - Parent node whose children we are
  *                                    getting
@@ -145,7 +194,7 @@
  ******************************************************************************/
 
 ACPI_NAMESPACE_NODE *
-AcpiNsGetNextNode (
+AcpiNsGetNextNodeTyped (
     ACPI_OBJECT_TYPE        Type,
     ACPI_NAMESPACE_NODE     *ParentNode,
     ACPI_NAMESPACE_NODE     *ChildNode)
@@ -156,19 +205,7 @@
     ACPI_FUNCTION_ENTRY ();
 
 
-    if (!ChildNode)
-    {
-        /* It's really the parent's _scope_ that we want */
-
-        NextNode = ParentNode->Child;
-    }
-
-    else
-    {
-        /* Start search at the NEXT node */
-
-        NextNode = AcpiNsGetNextValidNode (ChildNode);
-    }
+    NextNode = AcpiNsGetNextNode (ParentNode, ChildNode);
 
     /* If any type is OK, we are done */
 
@@ -220,8 +257,8 @@
  *              starting (and ending) at the node specified by StartHandle.
  *              The UserFunction is called whenever a node that matches
  *              the type parameter is found.  If the user function returns
- *              a non-zero value, the search is terminated immediately and this
- *              value is returned to the caller.
+ *              a non-zero value, the search is terminated immediately and
+ *              this value is returned to the caller.
  *
  *              The point of this procedure is to provide a generic namespace
  *              walk routine that can be called from multiple places to
@@ -276,7 +313,7 @@
         /* Get the next node in this scope.  Null if not found */
 
         Status = AE_OK;
-        ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
+        ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
         if (ChildNode)
         {
             /* Found next child, get the type if we are not searching for ANY */
@@ -289,10 +326,10 @@
             /*
              * Ignore all temporary namespace nodes (created during control
              * method execution) unless told otherwise. These temporary nodes
-             * can cause a race condition because they can be deleted during the
-             * execution of the user function (if the namespace is unlocked before
-             * invocation of the user function.) Only the debugger namespace dump
-             * will examine the temporary nodes.
+             * can cause a race condition because they can be deleted during
+             * the execution of the user function (if the namespace is
+             * unlocked before invocation of the user function.) Only the
+             * debugger namespace dump will examine the temporary nodes.
              */
             if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
                 !(Flags & ACPI_NS_WALK_TEMP_NODES))
@@ -358,7 +395,7 @@
              */
             if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH))
             {
-                if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
+                if (ChildNode->Child)
                 {
                     /* There is at least one child of this node, visit it */
 
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfeval.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
  *                         ACPI Object evaluation interfaces
- *              $Revision: 1.33 $
  *
  ******************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __NSXFEVAL_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acinterp.h"
 
@@ -492,7 +492,7 @@
 
     /* We are interested in reference objects only */
 
-    if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_LOCAL_REFERENCE)
+    if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
     {
         return;
     }
@@ -592,22 +592,41 @@
     }
 
     /*
-     * Lock the namespace around the walk.
-     * The namespace will be unlocked/locked around each call
-     * to the user function - since this function
-     * must be allowed to make Acpi calls itself.
+     * Need to acquire the namespace reader lock to prevent interference
+     * with any concurrent table unloads (which causes the deletion of
+     * namespace objects). We cannot allow the deletion of a namespace node
+     * while the user function is using it. The exception to this are the
+     * nodes created and deleted during control method execution -- these
+     * nodes are marked as temporary nodes and are ignored by the namespace
+     * walk. Thus, control methods can be executed while holding the
+     * namespace deletion lock (and the user function can execute control
+     * methods.)
+     */
+    Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /*
+     * Lock the namespace around the walk. The namespace will be
+     * unlocked/locked around each call to the user function - since the user
+     * function must be allowed to make ACPICA calls itself (for example, it
+     * will typically execute control methods during device enumeration.)
      */
     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        goto UnlockAndExit;
     }
 
     Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
-                    ACPI_NS_WALK_UNLOCK,
-                    UserFunction, Context, ReturnValue);
+                ACPI_NS_WALK_UNLOCK, UserFunction, Context, ReturnValue);
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+UnlockAndExit:
+    (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock);
     return_ACPI_STATUS (Status);
 }
 
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfname.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfname.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: nsxfname - Public interfaces to the ACPI subsystem
  *                         ACPI Namespace oriented interfaces
- *              $Revision: 1.113 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,7 +117,10 @@
 #define __NSXFNAME_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
+#include "acparser.h"
+#include "amlcode.h"
 
 
 #define _COMPONENT          ACPI_NAMESPACE
@@ -478,3 +480,165 @@
 
 ACPI_EXPORT_SYMBOL (AcpiGetObjectInfo)
 
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiInstallMethod
+ *
+ * PARAMETERS:  Buffer         - An ACPI table containing one control method
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Install a control method into the namespace. If the method
+ *              name already exists in the namespace, it is overwritten. The
+ *              input buffer must contain a valid DSDT or SSDT containing a
+ *              single control method.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallMethod (
+    UINT8                   *Buffer)
+{
+    ACPI_TABLE_HEADER       *Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Buffer);
+    UINT8                   *AmlBuffer;
+    UINT8                   *AmlStart;
+    char                    *Path;
+    ACPI_NAMESPACE_NODE     *Node;
+    ACPI_OPERAND_OBJECT     *MethodObj;
+    ACPI_PARSE_STATE        ParserState;
+    UINT32                  AmlLength;
+    UINT16                  Opcode;
+    UINT8                   MethodFlags;
+    ACPI_STATUS             Status;
+
+
+    /* Parameter validation */
+
+    if (!Buffer)
+    {
+        return (AE_BAD_PARAMETER);
+    }
+
+    /* Table must be a DSDT or SSDT */
+
+    if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) &&
+        !ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
+    {
+        return (AE_BAD_HEADER);
+    }
+
+    /* First AML opcode in the table must be a control method */
+
+    ParserState.Aml = Buffer + sizeof (ACPI_TABLE_HEADER);
+    Opcode = AcpiPsPeekOpcode (&ParserState);
+    if (Opcode != AML_METHOD_OP)
+    {
+        return (AE_BAD_PARAMETER);
+    }
+
+    /* Extract method information from the raw AML */
+
+    ParserState.Aml += AcpiPsGetOpcodeSize (Opcode);
+    ParserState.PkgEnd = AcpiPsGetNextPackageEnd (&ParserState);
+    Path = AcpiPsGetNextNamestring (&ParserState);
+    MethodFlags = *ParserState.Aml++;
+    AmlStart = ParserState.Aml;
+    AmlLength = ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart);
+
+    /*
+     * Allocate resources up-front. We don't want to have to delete a new
+     * node from the namespace if we cannot allocate memory.
+     */
+    AmlBuffer = ACPI_ALLOCATE (AmlLength);
+    if (!AmlBuffer)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+    if (!MethodObj)
+    {
+        ACPI_FREE (AmlBuffer);
+        return (AE_NO_MEMORY);
+    }
+
+    /* Lock namespace for AcpiNsLookup, we may be creating a new node */
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorExit;
+    }
+
+    /* The lookup either returns an existing node or creates a new one */
+
+    Status = AcpiNsLookup (NULL, Path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1,
+                ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node);
+
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
+    if (ACPI_FAILURE (Status)) /* NsLookup */
+    {
+        if (Status != AE_ALREADY_EXISTS)
+        {
+            goto ErrorExit;
+        }
+
+        /* Node existed previously, make sure it is a method node */
+
+        if (Node->Type != ACPI_TYPE_METHOD)
+        {
+            Status = AE_TYPE;
+            goto ErrorExit;
+        }
+    }
+
+    /* Copy the method AML to the local buffer */
+
+    ACPI_MEMCPY (AmlBuffer, AmlStart, AmlLength);
+
+    /* Initialize the method object with the new method's information */
+
+    MethodObj->Method.AmlStart = AmlBuffer;
+    MethodObj->Method.AmlLength = AmlLength;
+
+    MethodObj->Method.ParamCount = (UINT8)
+        (MethodFlags & AML_METHOD_ARG_COUNT);
+
+    MethodObj->Method.MethodFlags = (UINT8)
+        (MethodFlags & ~AML_METHOD_ARG_COUNT);
+
+    if (MethodFlags & AML_METHOD_SERIALIZED)
+    {
+        MethodObj->Method.SyncLevel = (UINT8)
+            ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
+    }
+
+    /*
+     * Now that it is complete, we can attach the new method object to
+     * the method Node (detaches/deletes any existing object)
+     */
+    Status = AcpiNsAttachObject (Node, MethodObj,
+                ACPI_TYPE_METHOD);
+
+    /*
+     * Flag indicates AML buffer is dynamic, must be deleted later.
+     * Must be set only after attach above.
+     */
+    Node->Flags |= ANOBJ_ALLOCATED_BUFFER;
+
+    /* Remove local reference to the method object */
+
+    AcpiUtRemoveReference (MethodObj);
+    return (Status);
+
+
+ErrorExit:
+
+    ACPI_FREE (AmlBuffer);
+    ACPI_FREE (MethodObj);
+    return (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiInstallMethod)
--- a/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/namespace/nsxfobj.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: nsxfobj - Public interfaces to the ACPI subsystem
  *                         ACPI Object oriented interfaces
- *              $Revision: 1.123 $
  *
  ******************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,6 +118,7 @@
 #define __NSXFOBJ_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -209,6 +209,7 @@
     ACPI_HANDLE             *RetHandle)
 {
     ACPI_NAMESPACE_NODE     *Node;
+    ACPI_NAMESPACE_NODE     *ParentNode;
     ACPI_STATUS             Status;
 
 
@@ -241,12 +242,12 @@
 
     /* Get the parent entry */
 
-    *RetHandle =
-        AcpiNsConvertEntryToHandle (AcpiNsGetParentNode (Node));
+    ParentNode = AcpiNsGetParentNode (Node);
+    *RetHandle = AcpiNsConvertEntryToHandle (ParentNode);
 
     /* Return exception if parent is null */
 
-    if (!AcpiNsGetParentNode (Node))
+    if (!ParentNode)
     {
         Status = AE_NULL_ENTRY;
     }
@@ -333,7 +334,7 @@
 
     /* Internal function does the real work */
 
-    Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode);
+    Node = AcpiNsGetNextNodeTyped (Type, ParentNode, ChildNode);
     if (!Node)
     {
         Status = AE_NOT_FOUND;
--- a/usr/src/uts/intel/io/acpica/osl.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/osl.c	Fri Jun 26 17:26:34 2009 -0700
@@ -47,7 +47,6 @@
 
 #include <sys/acpi/acpi.h>
 #include <sys/acpica.h>
-#include <sys/acpi/acinterp.h>
 
 #define	MAX_DAT_FILE_SIZE	(64*1024)
 
@@ -701,11 +700,12 @@
 AcpiOsGetThreadId(void)
 {
 	/*
-	 * ACPI CA regards thread ID as an error, but it's valid
-	 * on Solaris during kernel initialization.  Thus, 1 is added
-	 * to the kernel thread ID to avoid returning 0
+	 * ACPI CA doesn't care what actual value is returned as long
+	 * as it is non-zero and unique to each existing thread.
+	 * ACPI CA assumes that thread ID is castable to a pointer,
+	 * so we use the current thread pointer.
 	 */
-	return (ddi_get_kt_did() + 1);
+	return (curthread);
 }
 
 /*
--- a/usr/src/uts/intel/io/acpica/parser/psargs.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psargs.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psargs - Parse AML opcode arguments
- *              $Revision: 1.95 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __PSARGS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 #include "acnamesp.h"
--- a/usr/src/uts/intel/io/acpica/parser/psloop.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psloop.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psloop - Main AML parse loop
- *              $Revision: 1.19 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -124,6 +123,7 @@
  */
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "amlcode.h"
--- a/usr/src/uts/intel/io/acpica/parser/psopcode.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psopcode.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psopcode - Parser/Interpreter opcode information table
- *              $Revision: 1.103 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acopcode.h"
 #include "amlcode.h"
--- a/usr/src/uts/intel/io/acpica/parser/psparse.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psparse.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psparse - Parser top level AML parse routines
- *              $Revision: 1.176 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -125,6 +124,7 @@
  */
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "amlcode.h"
@@ -222,6 +222,7 @@
     ACPI_PARSE_OBJECT       *Next;
     const ACPI_OPCODE_INFO  *ParentInfo;
     ACPI_PARSE_OBJECT       *ReplacementOp = NULL;
+    ACPI_STATUS             Status = AE_OK;
 
 
     ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);
@@ -274,7 +275,7 @@
             ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
             if (!ReplacementOp)
             {
-                goto AllocateError;
+                Status = AE_NO_MEMORY;
             }
             break;
 
@@ -294,7 +295,7 @@
                 ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
                 if (!ReplacementOp)
                 {
-                    goto AllocateError;
+                    Status = AE_NO_MEMORY;
                 }
             }
             else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
@@ -307,11 +308,13 @@
                     ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
                     if (!ReplacementOp)
                     {
-                        goto AllocateError;
+                        Status = AE_NO_MEMORY;
                     }
-
-                    ReplacementOp->Named.Data = Op->Named.Data;
-                    ReplacementOp->Named.Length = Op->Named.Length;
+                    else
+                    {
+                        ReplacementOp->Named.Data = Op->Named.Data;
+                        ReplacementOp->Named.Length = Op->Named.Length;
+                    }
                 }
             }
             break;
@@ -321,7 +324,7 @@
             ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
             if (!ReplacementOp)
             {
-                goto AllocateError;
+                Status = AE_NO_MEMORY;
             }
         }
 
@@ -379,15 +382,7 @@
     /* Now we can actually delete the subtree rooted at Op */
 
     AcpiPsDeleteParseTree (Op);
-    return_ACPI_STATUS (AE_OK);
-
-
-AllocateError:
-
-    /* Always delete the subtree, even on error */
-
-    AcpiPsDeleteParseTree (Op);
-    return_ACPI_STATUS (AE_NO_MEMORY);
+    return_ACPI_STATUS (Status);
 }
 
 
@@ -545,12 +540,23 @@
         WalkState, WalkState->ParserState.Aml,
         WalkState->ParserState.AmlSize));
 
+    if (!WalkState->ParserState.Aml)
+    {
+        return_ACPI_STATUS (AE_NULL_OBJECT);
+    }
 
     /* Create and initialize a new thread state */
 
     Thread = AcpiUtCreateThreadState ();
     if (!Thread)
     {
+        if (WalkState->MethodDesc)
+        {
+            /* Executing a control method - additional cleanup */
+
+            AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
+        }
+
         AcpiDsDeleteWalkState (WalkState);
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
@@ -731,9 +737,10 @@
             }
             else
             {
-                /* On error, delete any return object */
+                /* On error, delete any return object or implicit return */
 
                 AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+                AcpiDsClearImplicitReturn (PreviousWalkState);
             }
         }
 
--- a/usr/src/uts/intel/io/acpica/parser/psscope.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psscope.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psscope - Parser scope stack management routines
- *              $Revision: 1.48 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 
 #define _COMPONENT          ACPI_PARSER
--- a/usr/src/uts/intel/io/acpica/parser/pstree.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/pstree.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: pstree - Parser op tree manipulation/traversal/search
- *              $Revision: 1.52 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __PSTREE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 
--- a/usr/src/uts/intel/io/acpica/parser/psutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 1.71 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
 
--- a/usr/src/uts/intel/io/acpica/parser/pswalk.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/pswalk.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: pswalk - Parser routines to walk parsed op tree(s)
- *              $Revision: 1.79 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -116,6 +115,7 @@
 
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 
 #define _COMPONENT          ACPI_PARSER
--- a/usr/src/uts/intel/io/acpica/parser/psxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/parser/psxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 1.94 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,9 +116,11 @@
 #define __PSXFACE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acparser.h"
 #include "acdispat.h"
 #include "acinterp.h"
+#include "amlcode.h"
 
 
 #define _COMPONENT          ACPI_PARSER
@@ -393,6 +394,40 @@
         goto Cleanup;
     }
 
+    /* Invoke an internal method if necessary */
+
+    if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
+    {
+        Status = Info->ObjDesc->Method.Implementation (WalkState);
+        Info->ReturnObject = WalkState->ReturnDesc;
+
+        /* Cleanup states */
+
+        AcpiDsScopeStackClear (WalkState);
+        AcpiPsCleanupScope (&WalkState->ParserState);
+        AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
+        AcpiDsDeleteWalkState (WalkState);
+        goto Cleanup;
+    }
+
+    /*
+     * Start method evaluation with an implicit return of zero. This is done
+     * for Windows compatibility.
+     */
+    if (AcpiGbl_EnableInterpreterSlack)
+    {
+        WalkState->ImplicitReturnObj =
+            AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        if (!WalkState->ImplicitReturnObj)
+        {
+            Status = AE_NO_MEMORY;
+            AcpiDsDeleteWalkState (WalkState);
+            goto Cleanup;
+        }
+
+        WalkState->ImplicitReturnObj->Integer.Value = 0;
+    }
+
     /* Parse the AML */
 
     Status = AcpiPsParseAml (WalkState);
--- a/usr/src/uts/intel/io/acpica/resources/rsaddr.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsaddr.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsaddr - Address resource descriptors (16/32/64)
- *              $Revision: 1.51 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSADDR_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rscalc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rscalc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rscalc - Calculate stream and list lengths
- *              $Revision: 1.84 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSCALC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 #include "acnamesp.h"
 
@@ -656,6 +656,14 @@
 
         PackageElement = *TopObjectList;
 
+        /* We must have a valid Package object */
+
+        if (!PackageElement ||
+            (PackageElement->Common.Type != ACPI_TYPE_PACKAGE))
+        {
+            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+        }
+
         /*
          * The SubObjectList will now point to an array of the
          * four IRQ elements: Address, Pin, Source and SourceIndex
@@ -671,10 +679,10 @@
             if (*SubObjectList && /* Null object allowed */
 
                 ((ACPI_TYPE_STRING ==
-                    ACPI_GET_OBJECT_TYPE (*SubObjectList)) ||
+                    (*SubObjectList)->Common.Type) ||
 
                 ((ACPI_TYPE_LOCAL_REFERENCE ==
-                    ACPI_GET_OBJECT_TYPE (*SubObjectList)) &&
+                    (*SubObjectList)->Common.Type) &&
 
                     ((*SubObjectList)->Reference.Class ==
                         ACPI_REFCLASS_NAME))))
@@ -695,7 +703,7 @@
 
         if (NameFound)
         {
-            if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING)
+            if ((*SubObjectList)->Common.Type == ACPI_TYPE_STRING)
             {
                 /*
                  * The length String.Length field does not include the
@@ -708,10 +716,6 @@
             {
                 TempSizeNeeded += AcpiNsGetPathnameLength (
                                     (*SubObjectList)->Reference.Node);
-                if (!TempSizeNeeded)
-                {
-                    return_ACPI_STATUS (AE_BAD_PARAMETER);
-                }
             }
         }
         else
--- a/usr/src/uts/intel/io/acpica/resources/rscreate.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rscreate.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rscreate - Create resource lists/tables
- *              $Revision: 1.79 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSCREATE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 #include "acnamesp.h"
 
@@ -298,7 +298,7 @@
 
         /* Each element of the top-level package must also be a package */
 
-        if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE)
+        if ((*TopObjectList)->Common.Type != ACPI_TYPE_PACKAGE)
         {
             ACPI_ERROR ((AE_INFO,
                 "(PRT[%X]) Need sub-package, found %s",
@@ -326,7 +326,7 @@
         /* 1) First subobject: Dereference the PRT.Address */
 
         ObjDesc = SubObjectList[0];
-        if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
+        if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
         {
             ACPI_ERROR ((AE_INFO, "(PRT[%X].Address) Need Integer, found %s",
                 Index, AcpiUtGetObjectTypeName (ObjDesc)));
@@ -338,7 +338,7 @@
         /* 2) Second subobject: Dereference the PRT.Pin */
 
         ObjDesc = SubObjectList[1];
-        if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
+        if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
         {
             ACPI_ERROR ((AE_INFO, "(PRT[%X].Pin) Need Integer, found %s",
                 Index, AcpiUtGetObjectTypeName (ObjDesc)));
@@ -354,7 +354,7 @@
          * other ACPI implementations.
          */
         ObjDesc = SubObjectList[3];
-        if (!ObjDesc || (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
+        if (!ObjDesc || (ObjDesc->Common.Type != ACPI_TYPE_INTEGER))
         {
             SubObjectList[3] = SubObjectList[2];
             SubObjectList[2] = ObjDesc;
@@ -371,7 +371,7 @@
         ObjDesc = SubObjectList[2];
         if (ObjDesc)
         {
-            switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+            switch (ObjDesc->Common.Type)
             {
             case ACPI_TYPE_LOCAL_REFERENCE:
 
@@ -439,7 +439,7 @@
         /* 4) Fourth subobject: Dereference the PRT.SourceIndex */
 
         ObjDesc = SubObjectList[3];
-        if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
+        if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
         {
             ACPI_ERROR ((AE_INFO,
                 "(PRT[%X].SourceIndex) Need Integer, found %s",
--- a/usr/src/uts/intel/io/acpica/resources/rsdump.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsdump.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsdump - Functions to display the resource structures.
- *              $Revision: 1.64 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __RSDUMP_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsinfo.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsinfo.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsinfo - Dispatch and Info tables
- *              $Revision: 1.9 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSINFO_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsio.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsio.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsio - IO and DMA resource descriptors
- *              $Revision: 1.38 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSIO_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsirq.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsirq.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsirq - IRQ resource descriptors
- *              $Revision: 1.52 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSIRQ_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rslist.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rslist.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rslist - Linked list utilities
- *              $Revision: 1.63 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSLIST_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsmemory.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsmemory.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsmem24 - Memory resource descriptors
- *              $Revision: 1.35 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSMEMORY_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsmisc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsmisc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsmisc - Miscellaneous resource descriptors
- *              $Revision: 1.48 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __RSMISC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 
 #define _COMPONENT          ACPI_RESOURCES
--- a/usr/src/uts/intel/io/acpica/resources/rsutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 1.69 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __RSUTILS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acresrc.h"
 
--- a/usr/src/uts/intel/io/acpica/resources/rsxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/resources/rsxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: rsxface - Public interfaces to the resource manager
- *              $Revision: 1.49 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __RSXFACE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acresrc.h"
 #include "acnamesp.h"
 
@@ -460,13 +460,13 @@
     {
     case ACPI_RESOURCE_TYPE_ADDRESS16:
 
-        Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
+        Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data);
         ACPI_COPY_ADDRESS (Out, Address16);
         break;
 
     case ACPI_RESOURCE_TYPE_ADDRESS32:
 
-        Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
+        Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data);
         ACPI_COPY_ADDRESS (Out, Address32);
         break;
 
--- a/usr/src/uts/intel/io/acpica/tables/tbfadt.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbfadt.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: tbfadt   - FADT table utilities
- *              $Revision: 1.8 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __TBFADT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "actables.h"
 
 #define _COMPONENT          ACPI_TABLES
@@ -124,10 +124,11 @@
 
 /* Local prototypes */
 
-static void inline
+static inline void
 AcpiTbInitGenericAddress (
     ACPI_GENERIC_ADDRESS    *GenericAddress,
-    UINT8                   BitWidth,
+    UINT8                   SpaceId,
+    UINT8                   ByteWidth,
     UINT64                  Address);
 
 static void
@@ -138,15 +139,20 @@
 AcpiTbValidateFadt (
     void);
 
+static void
+AcpiTbSetupFadtRegisters (
+    void);
+
 
 /* Table for conversion of FADT to common internal format and FADT validation */
 
 typedef struct acpi_fadt_info
 {
     char                    *Name;
-    UINT8                   Target;
-    UINT8                   Source;
+    UINT8                   Address64;
+    UINT8                   Address32;
     UINT8                   Length;
+    UINT8                   DefaultLength;
     UINT8                   Type;
 
 } ACPI_FADT_INFO;
@@ -156,40 +162,98 @@
 
 static ACPI_FADT_INFO     FadtInfoTable[] =
 {
-    {"Pm1aEventBlock",      ACPI_FADT_OFFSET (XPm1aEventBlock),
-                            ACPI_FADT_OFFSET (Pm1aEventBlock),
-                            ACPI_FADT_OFFSET (Pm1EventLength),      ACPI_FADT_REQUIRED},
+    {"Pm1aEventBlock",
+        ACPI_FADT_OFFSET (XPm1aEventBlock),
+        ACPI_FADT_OFFSET (Pm1aEventBlock),
+        ACPI_FADT_OFFSET (Pm1EventLength),
+        ACPI_PM1_REGISTER_WIDTH * 2,        /* Enable + Status register */
+        ACPI_FADT_REQUIRED},
 
-    {"Pm1bEventBlock",      ACPI_FADT_OFFSET (XPm1bEventBlock),
-                            ACPI_FADT_OFFSET (Pm1bEventBlock),
-                            ACPI_FADT_OFFSET (Pm1EventLength),      0},
+    {"Pm1bEventBlock",
+        ACPI_FADT_OFFSET (XPm1bEventBlock),
+        ACPI_FADT_OFFSET (Pm1bEventBlock),
+        ACPI_FADT_OFFSET (Pm1EventLength),
+        ACPI_PM1_REGISTER_WIDTH * 2,        /* Enable + Status register */
+        0},
 
-    {"Pm1aControlBlock",    ACPI_FADT_OFFSET (XPm1aControlBlock),
-                            ACPI_FADT_OFFSET (Pm1aControlBlock),
-                            ACPI_FADT_OFFSET (Pm1ControlLength),    ACPI_FADT_REQUIRED},
+    {"Pm1aControlBlock",
+        ACPI_FADT_OFFSET (XPm1aControlBlock),
+        ACPI_FADT_OFFSET (Pm1aControlBlock),
+        ACPI_FADT_OFFSET (Pm1ControlLength),
+        ACPI_PM1_REGISTER_WIDTH,
+        ACPI_FADT_REQUIRED},
 
-    {"Pm1bControlBlock",    ACPI_FADT_OFFSET (XPm1bControlBlock),
-                            ACPI_FADT_OFFSET (Pm1bControlBlock),
-                            ACPI_FADT_OFFSET (Pm1ControlLength),    0},
+    {"Pm1bControlBlock",
+        ACPI_FADT_OFFSET (XPm1bControlBlock),
+        ACPI_FADT_OFFSET (Pm1bControlBlock),
+        ACPI_FADT_OFFSET (Pm1ControlLength),
+        ACPI_PM1_REGISTER_WIDTH,
+        0},
 
-    {"Pm2ControlBlock",     ACPI_FADT_OFFSET (XPm2ControlBlock),
-                            ACPI_FADT_OFFSET (Pm2ControlBlock),
-                            ACPI_FADT_OFFSET (Pm2ControlLength),    ACPI_FADT_SEPARATE_LENGTH},
+    {"Pm2ControlBlock",
+        ACPI_FADT_OFFSET (XPm2ControlBlock),
+        ACPI_FADT_OFFSET (Pm2ControlBlock),
+        ACPI_FADT_OFFSET (Pm2ControlLength),
+        ACPI_PM2_REGISTER_WIDTH,
+        ACPI_FADT_SEPARATE_LENGTH},
 
-    {"PmTimerBlock",        ACPI_FADT_OFFSET (XPmTimerBlock),
-                            ACPI_FADT_OFFSET (PmTimerBlock),
-                            ACPI_FADT_OFFSET (PmTimerLength),       ACPI_FADT_REQUIRED},
+    {"PmTimerBlock",
+        ACPI_FADT_OFFSET (XPmTimerBlock),
+        ACPI_FADT_OFFSET (PmTimerBlock),
+        ACPI_FADT_OFFSET (PmTimerLength),
+        ACPI_PM_TIMER_WIDTH,
+        ACPI_FADT_REQUIRED},
 
-    {"Gpe0Block",           ACPI_FADT_OFFSET (XGpe0Block),
-                            ACPI_FADT_OFFSET (Gpe0Block),
-                            ACPI_FADT_OFFSET (Gpe0BlockLength),     ACPI_FADT_SEPARATE_LENGTH},
+    {"Gpe0Block",
+        ACPI_FADT_OFFSET (XGpe0Block),
+        ACPI_FADT_OFFSET (Gpe0Block),
+        ACPI_FADT_OFFSET (Gpe0BlockLength),
+        0,
+        ACPI_FADT_SEPARATE_LENGTH},
 
-    {"Gpe1Block",           ACPI_FADT_OFFSET (XGpe1Block),
-                            ACPI_FADT_OFFSET (Gpe1Block),
-                            ACPI_FADT_OFFSET (Gpe1BlockLength),     ACPI_FADT_SEPARATE_LENGTH}
+    {"Gpe1Block",
+        ACPI_FADT_OFFSET (XGpe1Block),
+        ACPI_FADT_OFFSET (Gpe1Block),
+        ACPI_FADT_OFFSET (Gpe1BlockLength),
+        0,
+        ACPI_FADT_SEPARATE_LENGTH}
 };
 
-#define ACPI_FADT_INFO_ENTRIES        (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
+#define ACPI_FADT_INFO_ENTRIES \
+            (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
+
+
+/* Table used to split Event Blocks into separate status/enable registers */
+
+typedef struct acpi_fadt_pm_info
+{
+    ACPI_GENERIC_ADDRESS    *Target;
+    UINT8                   Source;
+    UINT8                   RegisterNum;
+
+} ACPI_FADT_PM_INFO;
+
+static ACPI_FADT_PM_INFO    FadtPmInfoTable[] =
+{
+    {&AcpiGbl_XPm1aStatus,
+        ACPI_FADT_OFFSET (XPm1aEventBlock),
+        0},
+
+    {&AcpiGbl_XPm1aEnable,
+        ACPI_FADT_OFFSET (XPm1aEventBlock),
+        1},
+
+    {&AcpiGbl_XPm1bStatus,
+        ACPI_FADT_OFFSET (XPm1bEventBlock),
+        0},
+
+    {&AcpiGbl_XPm1bEnable,
+        ACPI_FADT_OFFSET (XPm1bEventBlock),
+        1}
+};
+
+#define ACPI_FADT_PM_INFO_ENTRIES \
+            (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
 
 
 /*******************************************************************************
@@ -197,7 +261,8 @@
  * FUNCTION:    AcpiTbInitGenericAddress
  *
  * PARAMETERS:  GenericAddress      - GAS struct to be initialized
- *              BitWidth            - Width of this register
+ *              SpaceId             - ACPI Space ID for this register
+ *              ByteWidth           - Width of this register, in bytes
  *              Address             - Address of the register
  *
  * RETURN:      None
@@ -208,10 +273,11 @@
  *
  ******************************************************************************/
 
-static void inline
+static inline void
 AcpiTbInitGenericAddress (
     ACPI_GENERIC_ADDRESS    *GenericAddress,
-    UINT8                   BitWidth,
+    UINT8                   SpaceId,
+    UINT8                   ByteWidth,
     UINT64                  Address)
 {
 
@@ -223,10 +289,10 @@
 
     /* All other fields are byte-wide */
 
-    GenericAddress->SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
-    GenericAddress->BitWidth = BitWidth;
+    GenericAddress->SpaceId = SpaceId;
+    GenericAddress->BitWidth = (UINT8) ACPI_MUL_8 (ByteWidth);
     GenericAddress->BitOffset = 0;
-    GenericAddress->AccessWidth = 0;
+    GenericAddress->AccessWidth = 0; /* Access width ANY */
 }
 
 
@@ -235,7 +301,6 @@
  * FUNCTION:    AcpiTbParseFadt
  *
  * PARAMETERS:  TableIndex          - Index for the FADT
- *              Flags               - Flags
  *
  * RETURN:      None
  *
@@ -246,8 +311,7 @@
 
 void
 AcpiTbParseFadt (
-    UINT32                  TableIndex,
-    UINT8                   Flags)
+    UINT32                  TableIndex)
 {
     UINT32                  Length;
     ACPI_TABLE_HEADER       *Table;
@@ -275,7 +339,7 @@
      */
     (void) AcpiTbVerifyChecksum (Table, Length);
 
-    /* Obtain a local copy of the FADT in common ACPI 2.0+ format */
+    /* Create a local copy of the FADT in common ACPI 2.0+ format */
 
     AcpiTbCreateLocalFadt (Table, Length);
 
@@ -286,10 +350,10 @@
     /* Obtain the DSDT and FACS tables via their addresses within the FADT */
 
     AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
-        Flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
+        ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
 
     AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
-        Flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
+        ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
 }
 
 
@@ -323,8 +387,9 @@
     if (Length > sizeof (ACPI_TABLE_FADT))
     {
         ACPI_WARNING ((AE_INFO,
-            "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%X",
-            Table->Revision, Length, sizeof (ACPI_TABLE_FADT)));
+            "FADT (revision %u) is longer than ACPI 2.0 version, "
+            "truncating length 0x%X to 0x%X",
+            Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
     }
 
     /* Clear the entire local FADT */
@@ -336,12 +401,17 @@
     ACPI_MEMCPY (&AcpiGbl_FADT, Table,
         ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
 
-    /*
-     * 1) Convert the local copy of the FADT to the common internal format
-     * 2) Validate some of the important values within the FADT
-     */
+    /* Convert the local copy of the FADT to the common internal format */
+
     AcpiTbConvertFadt ();
+
+    /* Validate FADT values now, before we make any changes */
+
     AcpiTbValidateFadt ();
+
+    /* Initialize the global ACPI register structures */
+
+    AcpiTbSetupFadtRegisters ();
 }
 
 
@@ -354,23 +424,28 @@
  * RETURN:      None
  *
  * DESCRIPTION: Converts all versions of the FADT to a common internal format.
- *              Expand all 32-bit addresses to 64-bit.
+ *              Expand 32-bit addresses to 64-bit as necessary.
  *
  * NOTE:        AcpiGbl_FADT must be of size (ACPI_TABLE_FADT),
  *              and must contain a copy of the actual FADT.
  *
- * ACPICA will use the "X" fields of the FADT for all addresses.
+ * Notes on 64-bit register addresses:
+ *
+ * After this FADT conversion, later ACPICA code will only use the 64-bit "X"
+ * fields of the FADT for all ACPI register addresses.
  *
- * "X" fields are optional extensions to the original V1.0 fields. Even if
- * they are present in the structure, they can be optionally not used by
- * setting them to zero. Therefore, we must selectively expand V1.0 fields
- * if the corresponding X field is zero.
+ * The 64-bit "X" fields are optional extensions to the original 32-bit FADT
+ * V1.0 fields. Even if they are present in the FADT, they are optional and
+ * are unused if the BIOS sets them to zero. Therefore, we must copy/expand
+ * 32-bit V1.0 fields if the corresponding X field is zero.
  *
- * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding
- * "X" fields.
+ * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the
+ * corresponding "X" fields in the internal FADT.
  *
- * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by
- * expanding the corresponding ACPI 1.0 field.
+ * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded
+ * to the corresponding 64-bit X fields. For compatibility with other ACPI
+ * implementations, we ignore the 64-bit field if the 32-bit field is valid,
+ * regardless of whether the host OS is 32-bit or 64-bit.
  *
  ******************************************************************************/
 
@@ -378,8 +453,8 @@
 AcpiTbConvertFadt (
     void)
 {
-    UINT8                   Pm1RegisterLength;
-    ACPI_GENERIC_ADDRESS    *Target;
+    ACPI_GENERIC_ADDRESS    *Address64;
+    UINT32                  Address32;
     UINT32                  i;
 
 
@@ -387,13 +462,14 @@
 
     AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
 
-    /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */
-
+    /*
+     * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+     * Later code will always use the X 64-bit field.
+     */
     if (!AcpiGbl_FADT.XFacs)
     {
         AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
     }
-
     if (!AcpiGbl_FADT.XDsdt)
     {
         AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
@@ -404,8 +480,8 @@
      * should be zero are indeed zero. This will workaround BIOSs that
      * inadvertently place values in these fields.
      *
-     * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at
-     * offset 45, 55, 95, and the word located at offset 109, 110.
+     * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
+     * at offset 45, 55, 95, and the word located at offset 109, 110.
      */
     if (AcpiGbl_FADT.Header.Revision < 3)
     {
@@ -416,51 +492,57 @@
     }
 
     /*
-     * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X"
-     * generic address structures as necessary.
+     * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
+     * generic address structures as necessary. Later code will always use
+     * the 64-bit address structures.
+     *
+     * March 2009:
+     * We now always use the 32-bit address if it is valid (non-null). This
+     * is not in accordance with the ACPI specification which states that
+     * the 64-bit address supersedes the 32-bit version, but we do this for
+     * compatibility with other ACPI implementations. Most notably, in the
+     * case where both the 32 and 64 versions are non-null, we use the 32-bit
+     * version. This is the only address that is guaranteed to have been
+     * tested by the BIOS manufacturer.
      */
     for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
     {
-        Target = ACPI_ADD_PTR (
-            ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target);
-
-        /* Expand only if the X target is null */
+        Address32 = *ACPI_ADD_PTR (UINT32,
+            &AcpiGbl_FADT, FadtInfoTable[i].Address32);
 
-        if (!Target->Address)
-        {
-            AcpiTbInitGenericAddress (Target,
-                *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
-                (UINT64) *ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source));
-        }
-    }
+        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
+            &AcpiGbl_FADT, FadtInfoTable[i].Address64);
 
-    /*
-     * Calculate separate GAS structs for the PM1 Enable registers.
-     * These addresses do not appear (directly) in the FADT, so it is
-     * useful to calculate them once, here.
-     *
-     * The PM event blocks are split into two register blocks, first is the
-     * PM Status Register block, followed immediately by the PM Enable Register
-     * block. Each is of length (Pm1EventLength/2)
-     */
-    Pm1RegisterLength = (UINT8) ACPI_DIV_2 (AcpiGbl_FADT.Pm1EventLength);
+        /*
+         * If both 32- and 64-bit addresses are valid (non-zero),
+         * they must match.
+         */
+        if (Address64->Address && Address32 &&
+           (Address64->Address != (UINT64) Address32))
+        {
+            ACPI_ERROR ((AE_INFO,
+                "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32",
+                FadtInfoTable[i].Name, Address32,
+                ACPI_FORMAT_UINT64 (Address64->Address)));
+        }
 
-    /* The PM1A register block is required */
-
-    AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable, Pm1RegisterLength,
-        (AcpiGbl_FADT.XPm1aEventBlock.Address + Pm1RegisterLength));
+        /* Always use 32-bit address if it is valid (non-null) */
 
-    /* The PM1B register block is optional, ignore if not present */
-
-    if (AcpiGbl_FADT.XPm1bEventBlock.Address)
-    {
-        AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable, Pm1RegisterLength,
-            (AcpiGbl_FADT.XPm1bEventBlock.Address + Pm1RegisterLength));
+        if (Address32)
+        {
+            /*
+             * Copy the 32-bit address to the 64-bit GAS structure. The
+             * Space ID is always I/O for 32-bit legacy address fields
+             */
+            AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO,
+                *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length),
+                (UINT64) Address32);
+        }
     }
 }
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    AcpiTbValidateFadt
  *
@@ -484,21 +566,64 @@
 AcpiTbValidateFadt (
     void)
 {
-    UINT32                  *Address32;
+    char                    *Name;
     ACPI_GENERIC_ADDRESS    *Address64;
     UINT8                   Length;
     UINT32                  i;
 
 
+    /*
+     * Check for FACS and DSDT address mismatches. An address mismatch between
+     * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
+     * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.
+     */
+    if (AcpiGbl_FADT.Facs &&
+        (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs))
+    {
+        ACPI_WARNING ((AE_INFO,
+            "32/64X FACS address mismatch in FADT - "
+            "%8.8X/%8.8X%8.8X, using 32",
+            AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs)));
+
+        AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs;
+    }
+
+    if (AcpiGbl_FADT.Dsdt &&
+        (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt))
+    {
+        ACPI_WARNING ((AE_INFO,
+            "32/64X DSDT address mismatch in FADT - "
+            "%8.8X/%8.8X%8.8X, using 32",
+            AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt)));
+
+        AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt;
+    }
+
     /* Examine all of the 64-bit extended address fields (X fields) */
 
     for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
     {
-        /* Generate pointers to the 32-bit and 64-bit addresses and get the length */
+        /*
+         * Generate pointer to the 64-bit address, get the register
+         * length (width) and the register name
+         */
+        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
+                        &AcpiGbl_FADT, FadtInfoTable[i].Address64);
+        Length = *ACPI_ADD_PTR (UINT8,
+                        &AcpiGbl_FADT, FadtInfoTable[i].Length);
+        Name = FadtInfoTable[i].Name;
 
-        Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target);
-        Address32 = ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source);
-        Length = *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length);
+        /*
+         * For each extended field, check for length mismatch between the
+         * legacy length field and the corresponding 64-bit X length field.
+         */
+        if (Address64->Address &&
+           (Address64->BitWidth != ACPI_MUL_8 (Length)))
+        {
+            ACPI_WARNING ((AE_INFO,
+                "32/64X length mismatch in %s: %d/%d",
+                Name, ACPI_MUL_8 (Length), Address64->BitWidth));
+        }
 
         if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED)
         {
@@ -509,33 +634,119 @@
             if (!Address64->Address || !Length)
             {
                 ACPI_ERROR ((AE_INFO,
-                    "Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X",
-                    FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
+                    "Required field %s has zero address and/or length:"
+                    " %8.8X%8.8X/%X",
+                    Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
             }
         }
         else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH)
         {
             /*
              * Field is optional (PM2Control, GPE0, GPE1) AND has its own
-             * length field. If present, both the address and length must be valid.
+             * length field. If present, both the address and length must
+             * be valid.
              */
-            if ((Address64->Address && !Length) || (!Address64->Address && Length))
+            if ((Address64->Address && !Length) ||
+                (!Address64->Address && Length))
             {
                 ACPI_WARNING ((AE_INFO,
-                    "Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X",
-                    FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
+                    "Optional field %s has zero address or length: "
+                    "%8.8X%8.8X/%X",
+                    Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
             }
         }
-
-        /* If both 32- and 64-bit addresses are valid (non-zero), they must match */
-
-        if (Address64->Address && *Address32 &&
-           (Address64->Address != (UINT64) *Address32))
-        {
-            ACPI_ERROR ((AE_INFO,
-                "32/64X address mismatch in \"%s\": [%8.8X] [%8.8X%8.8X], using 64X",
-                FadtInfoTable[i].Name, *Address32, ACPI_FORMAT_UINT64 (Address64->Address)));
-        }
     }
 }
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiTbSetupFadtRegisters
+ *
+ * PARAMETERS:  None, uses AcpiGbl_FADT.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally,
+ *              force FADT register definitions to their default lengths.
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbSetupFadtRegisters (
+    void)
+{
+    ACPI_GENERIC_ADDRESS    *Target64;
+    ACPI_GENERIC_ADDRESS    *Source64;
+    UINT8                   Pm1RegisterByteWidth;
+    UINT32                  i;
+
+
+    /*
+     * Optionally check all register lengths against the default values and
+     * update them if they are incorrect.
+     */
+    if (AcpiGbl_UseDefaultRegisterWidths)
+    {
+        for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
+        {
+            Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
+                FadtInfoTable[i].Address64);
+
+            /*
+             * If a valid register (Address != 0) and the (DefaultLength > 0)
+             * (Not a GPE register), then check the width against the default.
+             */
+            if ((Target64->Address) &&
+                (FadtInfoTable[i].DefaultLength > 0) &&
+                (FadtInfoTable[i].DefaultLength != Target64->BitWidth))
+            {
+                ACPI_WARNING ((AE_INFO,
+                    "Invalid length for %s: %d, using default %d",
+                    FadtInfoTable[i].Name, Target64->BitWidth,
+                    FadtInfoTable[i].DefaultLength));
+
+                /* Incorrect size, set width to the default */
+
+                Target64->BitWidth = FadtInfoTable[i].DefaultLength;
+            }
+        }
+    }
+
+    /*
+     * Get the length of the individual PM1 registers (enable and status).
+     * Each register is defined to be (event block length / 2). Extra divide
+     * by 8 converts bits to bytes.
+     */
+    Pm1RegisterByteWidth = (UINT8)
+        ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
+
+    /*
+     * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
+     * registers. These addresses do not appear (directly) in the FADT, so it
+     * is useful to pre-calculate them from the PM1 Event Block definitions.
+     *
+     * The PM event blocks are split into two register blocks, first is the
+     * PM Status Register block, followed immediately by the PM Enable
+     * Register block. Each is of length (Pm1EventLength/2)
+     *
+     * Note: The PM1A event block is required by the ACPI specification.
+     * However, the PM1B event block is optional and is rarely, if ever,
+     * used.
+     */
+
+    for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
+    {
+        Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
+            FadtPmInfoTable[i].Source);
+
+        if (Source64->Address)
+        {
+            AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
+                Source64->SpaceId, Pm1RegisterByteWidth,
+                Source64->Address +
+                    (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth));
+        }
+    }
+}
+
--- a/usr/src/uts/intel/io/acpica/tables/tbfind.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbfind.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: tbfind   - find table
- *              $Revision: 1.5 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __TBFIND_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "actables.h"
 
 #define _COMPONENT          ACPI_TABLES
--- a/usr/src/uts/intel/io/acpica/tables/tbinstal.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbinstal.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: tbinstal - ACPI table installation and removal
- *              $Revision: 1.94 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __TBINSTAL_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "actables.h"
 
@@ -155,7 +155,8 @@
         if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
             ACPI_TABLE_ORIGIN_MAPPED)
         {
-            TableDesc->Pointer = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
+            TableDesc->Pointer = AcpiOsMapMemory (
+                TableDesc->Address, TableDesc->Length);
         }
 
         if (!TableDesc->Pointer)
@@ -186,7 +187,9 @@
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to add the ACPI table
+ * DESCRIPTION: This function is called to add an ACPI table. It is used to
+ *              dynamically load tables via the Load and LoadTable AML
+ *              operators.
  *
  ******************************************************************************/
 
@@ -197,6 +200,7 @@
 {
     UINT32                  i;
     ACPI_STATUS             Status = AE_OK;
+    ACPI_TABLE_HEADER       *OverrideTable = NULL;
 
 
     ACPI_FUNCTION_TRACE (TbAddTable);
@@ -228,7 +232,8 @@
         if (!AcpiGbl_RootTableList.Tables[i].Pointer)
         {
             Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
-            if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer)
+            if (ACPI_FAILURE (Status) ||
+                !AcpiGbl_RootTableList.Tables[i].Pointer)
             {
                 continue;
             }
@@ -290,6 +295,30 @@
         }
     }
 
+    /*
+     * ACPI Table Override:
+     * Allow the host to override dynamically loaded tables.
+     */
+    Status = AcpiOsTableOverride (TableDesc->Pointer, &OverrideTable);
+    if (ACPI_SUCCESS (Status) && OverrideTable)
+    {
+        ACPI_INFO ((AE_INFO,
+            "%4.4s @ 0x%p Table override, replaced with:",
+            TableDesc->Pointer->Signature,
+            ACPI_CAST_PTR (void, TableDesc->Address)));
+
+        /* We can delete the table that was passed as a parameter */
+
+        AcpiTbDeleteTable (TableDesc);
+
+        /* Setup descriptor for the new table */
+
+        TableDesc->Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
+        TableDesc->Pointer = OverrideTable;
+        TableDesc->Length = OverrideTable->Length;
+        TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
+    }
+
     /* Add the table to the global root table list */
 
     Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
@@ -341,8 +370,9 @@
     /* Increase the Table Array size */
 
     Tables = ACPI_ALLOCATE_ZEROED (
-        ((ACPI_SIZE) AcpiGbl_RootTableList.Size + ACPI_ROOT_TABLE_SIZE_INCREMENT)
-        * sizeof (ACPI_TABLE_DESC));
+        ((ACPI_SIZE) AcpiGbl_RootTableList.Size +
+            ACPI_ROOT_TABLE_SIZE_INCREMENT) *
+        sizeof (ACPI_TABLE_DESC));
     if (!Tables)
     {
         ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
@@ -522,32 +552,62 @@
  *
  * PARAMETERS:  TableIndex          - Table index
  *
- * RETURN:      None
+ * RETURN:      Status
  *
  * DESCRIPTION: Delete all namespace objects created when this table was loaded.
  *
  ******************************************************************************/
 
-void
+ACPI_STATUS
 AcpiTbDeleteNamespaceByOwner (
     UINT32                  TableIndex)
 {
     ACPI_OWNER_ID           OwnerId;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner);
 
 
-    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-    if (TableIndex < AcpiGbl_RootTableList.Count)
+    Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+    if (ACPI_FAILURE (Status))
     {
-        OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
+        return_ACPI_STATUS (Status);
     }
-    else
+
+    if (TableIndex >= AcpiGbl_RootTableList.Count)
     {
+        /* The table index does not exist */
+
         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-        return;
+        return_ACPI_STATUS (AE_NOT_EXIST);
     }
 
+    /* Get the owner ID for this table, used to delete namespace nodes */
+
+    OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+
+    /*
+     * Need to acquire the namespace writer lock to prevent interference
+     * with any concurrent namespace walks. The interpreter must be
+     * released during the deletion since the acquisition of the deletion
+     * lock may block, and also since the execution of a namespace walk
+     * must be allowed to use the interpreter.
+     */
+    (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
+    Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
+
     AcpiNsDeleteNamespaceByOwner (OwnerId);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
+    return_ACPI_STATUS (Status);
 }
 
 
@@ -610,7 +670,8 @@
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     if (TableIndex < AcpiGbl_RootTableList.Count)
     {
-        AcpiUtReleaseOwnerId (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
+        AcpiUtReleaseOwnerId (
+            &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
         Status = AE_OK;
     }
 
@@ -676,7 +737,8 @@
     if (TableIndex < AcpiGbl_RootTableList.Count)
     {
         IsLoaded = (BOOLEAN)
-            (AcpiGbl_RootTableList.Tables[TableIndex].Flags & ACPI_TABLE_IS_LOADED);
+            (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
+            ACPI_TABLE_IS_LOADED);
     }
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
@@ -708,11 +770,13 @@
     {
         if (IsLoaded)
         {
-            AcpiGbl_RootTableList.Tables[TableIndex].Flags |= ACPI_TABLE_IS_LOADED;
+            AcpiGbl_RootTableList.Tables[TableIndex].Flags |=
+                ACPI_TABLE_IS_LOADED;
         }
         else
         {
-            AcpiGbl_RootTableList.Tables[TableIndex].Flags &= ~ACPI_TABLE_IS_LOADED;
+            AcpiGbl_RootTableList.Tables[TableIndex].Flags &=
+                ~ACPI_TABLE_IS_LOADED;
         }
     }
 
--- a/usr/src/uts/intel/io/acpica/tables/tbutils.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbutils.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: tbutils   - table utilities
- *              $Revision: 1.91 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __TBUTILS_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "actables.h"
 
 #define _COMPONENT          ACPI_TABLES
@@ -132,6 +132,32 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiTbInitializeFacs
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
+ *              for accessing the Global Lock and Firmware Waking Vector
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbInitializeFacs (
+    void)
+{
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
+                ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiTbTablesLoaded
  *
  * PARAMETERS:  None
@@ -176,18 +202,23 @@
     ACPI_TABLE_HEADER       *Header)
 {
 
+    /*
+     * The reason that the Address is cast to a void pointer is so that we
+     * can use %p which will work properly on both 32-bit and 64-bit hosts.
+     */
     if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
     {
-        /* FACS only has signature and length fields of common table header */
+        /* FACS only has signature and length fields */
 
-        ACPI_INFO ((AE_INFO, "%4.4s @ 0x%p/0x%04X",
-            Header->Signature, ACPI_CAST_PTR (UINT64, Address), Header->Length));
+        ACPI_INFO ((AE_INFO, "%4.4s %p %05X",
+            Header->Signature, ACPI_CAST_PTR (void, Address),
+            Header->Length));
     }
     else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
     {
         /* RSDP has no common fields */
 
-        ACPI_INFO ((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)",
+        ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
             ACPI_CAST_PTR (void, Address),
             (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
                 ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
@@ -199,7 +230,7 @@
         /* Standard ACPI table with full common header */
 
         ACPI_INFO ((AE_INFO,
-            "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)",
+            "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
             Header->Signature, ACPI_CAST_PTR (void, Address),
             Header->Length, Header->Revision, Header->OemId,
             Header->OemTableId, Header->OemRevision, Header->AslCompilerId,
@@ -240,7 +271,8 @@
     {
         ACPI_WARNING ((AE_INFO,
             "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X",
-            Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum)));
+            Table->Signature, Table->Checksum,
+            (UINT8) (Table->Checksum - Checksum)));
 
 #if (ACPI_CHECKSUM_ABORT)
         return (AE_BAD_CHECKSUM);
@@ -287,25 +319,30 @@
  * FUNCTION:    AcpiTbInstallTable
  *
  * PARAMETERS:  Address                 - Physical address of DSDT or FACS
- *              Flags                   - Flags
  *              Signature               - Table signature, NULL if no need to
  *                                        match
  *              TableIndex              - Index into root table array
  *
  * RETURN:      None
  *
- * DESCRIPTION: Install an ACPI table into the global data structure.
+ * DESCRIPTION: Install an ACPI table into the global data structure. The
+ *              table override mechanism is implemented here to allow the host
+ *              OS to replace any table before it is installed in the root
+ *              table array.
  *
  ******************************************************************************/
 
 void
 AcpiTbInstallTable (
     ACPI_PHYSICAL_ADDRESS   Address,
-    UINT8                   Flags,
     char                    *Signature,
     UINT32                  TableIndex)
 {
-    ACPI_TABLE_HEADER       *Table;
+    UINT8                   Flags;
+    ACPI_STATUS             Status;
+    ACPI_TABLE_HEADER       *TableToInstall;
+    ACPI_TABLE_HEADER       *MappedTable;
+    ACPI_TABLE_HEADER       *OverrideTable = NULL;
 
 
     if (!Address)
@@ -317,43 +354,70 @@
 
     /* Map just the table header */
 
-    Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
-    if (!Table)
+    MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+    if (!MappedTable)
     {
         return;
     }
 
-    /* If a particular signature is expected, signature must match */
+    /* If a particular signature is expected (DSDT/FACS), it must match */
 
     if (Signature &&
-        !ACPI_COMPARE_NAME (Table->Signature, Signature))
+        !ACPI_COMPARE_NAME (MappedTable->Signature, Signature))
     {
-        ACPI_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table [%s]",
-            *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
+        ACPI_ERROR ((AE_INFO,
+            "Invalid signature 0x%X for ACPI table, expected [%s]",
+            *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature));
         goto UnmapAndExit;
     }
 
+    /*
+     * ACPI Table Override:
+     *
+     * Before we install the table, let the host OS override it with a new
+     * one if desired. Any table within the RSDT/XSDT can be replaced,
+     * including the DSDT which is pointed to by the FADT.
+     */
+    Status = AcpiOsTableOverride (MappedTable, &OverrideTable);
+    if (ACPI_SUCCESS (Status) && OverrideTable)
+    {
+        ACPI_INFO ((AE_INFO,
+            "%4.4s @ 0x%p Table override, replaced with:",
+            MappedTable->Signature, ACPI_CAST_PTR (void, Address)));
+
+        AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable;
+        Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
+
+        TableToInstall = OverrideTable;
+        Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
+    }
+    else
+    {
+        TableToInstall = MappedTable;
+        Flags = ACPI_TABLE_ORIGIN_MAPPED;
+    }
+
     /* Initialize the table entry */
 
     AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
-    AcpiGbl_RootTableList.Tables[TableIndex].Length = Table->Length;
+    AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length;
     AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
 
     ACPI_MOVE_32_TO_32 (
         &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
-        Table->Signature);
+        TableToInstall->Signature);
 
-    AcpiTbPrintTableHeader (Address, Table);
+    AcpiTbPrintTableHeader (Address, TableToInstall);
 
     if (TableIndex == ACPI_TABLE_INDEX_DSDT)
     {
         /* Global integer width is based upon revision of the DSDT */
 
-        AcpiUtSetIntegerWidth (Table->Revision);
+        AcpiUtSetIntegerWidth (TableToInstall->Revision);
     }
 
 UnmapAndExit:
-    AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
+    AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
 }
 
 
@@ -398,7 +462,8 @@
     {
         /*
          * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
-         * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit
+         * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
+         *  return 64-bit
          */
         ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
 
@@ -408,7 +473,8 @@
             /* Will truncate 64-bit address to 32 bits, issue warning */
 
             ACPI_WARNING ((AE_INFO,
-                "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating",
+                "64-bit Physical Address in XSDT is too large (%8.8X%8.8X),"
+                " truncating",
                 ACPI_FORMAT_UINT64 (Address64)));
         }
 #endif
@@ -422,7 +488,6 @@
  * FUNCTION:    AcpiTbParseRootTable
  *
  * PARAMETERS:  Rsdp                    - Pointer to the RSDP
- *              Flags                   - Flags
  *
  * RETURN:      Status
  *
@@ -437,8 +502,7 @@
 
 ACPI_STATUS
 AcpiTbParseRootTable (
-    ACPI_PHYSICAL_ADDRESS   RsdpAddress,
-    UINT8                   Flags)
+    ACPI_PHYSICAL_ADDRESS   RsdpAddress)
 {
     ACPI_TABLE_RSDP         *Rsdp;
     UINT32                  TableEntrySize;
@@ -463,7 +527,8 @@
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
-    AcpiTbPrintTableHeader (RsdpAddress, ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
+    AcpiTbPrintTableHeader (RsdpAddress,
+        ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
 
     /* Differentiate between RSDT and XSDT root tables */
 
@@ -530,11 +595,13 @@
 
     /* Calculate the number of tables described in the root table */
 
-    TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / TableEntrySize);
+    TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
+        TableEntrySize);
 
     /*
-     * First two entries in the table array are reserved for the DSDT and FACS,
-     * which are not actually present in the RSDT/XSDT - they come from the FADT
+     * First two entries in the table array are reserved for the DSDT
+     * and FACS, which are not actually present in the RSDT/XSDT - they
+     * come from the FADT
      */
     TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
     AcpiGbl_RootTableList.Count = 2;
@@ -552,7 +619,8 @@
             if (ACPI_FAILURE (Status))
             {
                 ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
-                    (unsigned) (AcpiGbl_RootTableList.Size - AcpiGbl_RootTableList.Count)));
+                    (unsigned) (TableCount -
+                    (AcpiGbl_RootTableList.Count - 2))));
                 break;
             }
         }
@@ -579,14 +647,14 @@
     for (i = 2; i < AcpiGbl_RootTableList.Count; i++)
     {
         AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
-            Flags, NULL, i);
+            NULL, i);
 
         /* Special case for FADT - get the DSDT and FACS */
 
         if (ACPI_COMPARE_NAME (
                 &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
         {
-            AcpiTbParseFadt (i, Flags);
+            AcpiTbParseFadt (i);
         }
     }
 
--- a/usr/src/uts/intel/io/acpica/tables/tbxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
  *
  * Module Name: tbxface - Public interfaces to the ACPI subsystem
  *                         ACPI table oriented interfaces
- *              $Revision: 1.88 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __TBXFACE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "actables.h"
 
@@ -237,7 +237,7 @@
      * Root Table Array. This array contains the information of the RSDT/XSDT
      * in a common, more useable format.
      */
-    Status = AcpiTbParseRootTable (RsdpAddress, ACPI_TABLE_ORIGIN_MAPPED);
+    Status = AcpiTbParseRootTable (RsdpAddress);
     return_ACPI_STATUS (Status);
 }
 
@@ -304,7 +304,7 @@
 ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    AcpiGetTableHeader
  *
@@ -319,7 +319,7 @@
  * NOTE:        Caller is responsible in unmapping the header with
  *              AcpiOsUnmapMemory
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 AcpiGetTableHeader (
@@ -339,9 +339,8 @@
         return (AE_BAD_PARAMETER);
     }
 
-    /*
-     * Walk the root table list
-     */
+    /* Walk the root table list */
+
     for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
     {
         if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
@@ -357,10 +356,12 @@
 
         if (!AcpiGbl_RootTableList.Tables[i].Pointer)
         {
-            if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) ==
+            if ((AcpiGbl_RootTableList.Tables[i].Flags &
+                    ACPI_TABLE_ORIGIN_MASK) ==
                 ACPI_TABLE_ORIGIN_MAPPED)
             {
-                Header = AcpiOsMapMemory (AcpiGbl_RootTableList.Tables[i].Address,
+                Header = AcpiOsMapMemory (
+                            AcpiGbl_RootTableList.Tables[i].Address,
                             sizeof (ACPI_TABLE_HEADER));
                 if (!Header)
                 {
@@ -370,16 +371,15 @@
                 ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER));
                 AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER));
             }
-
             else
             {
                 return AE_NOT_FOUND;
             }
         }
-
         else
         {
-            ACPI_MEMCPY (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer,
+            ACPI_MEMCPY (OutTableHeader,
+                AcpiGbl_RootTableList.Tables[i].Pointer,
                 sizeof(ACPI_TABLE_HEADER));
         }
 
@@ -392,7 +392,7 @@
 ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
 
 
-/******************************************************************************
+/*******************************************************************************
  *
  * FUNCTION:    AcpiGetTable
  *
@@ -404,7 +404,7 @@
  *
  * DESCRIPTION: Finds and verifies an ACPI table.
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 ACPI_STATUS
 AcpiGetTable (
@@ -424,9 +424,8 @@
         return (AE_BAD_PARAMETER);
     }
 
-    /*
-     * Walk the root table list
-     */
+    /* Walk the root table list */
+
     for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
     {
         if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
@@ -534,7 +533,6 @@
     void)
 {
     ACPI_STATUS             Status;
-    ACPI_TABLE_HEADER       *Table;
     UINT32                  i;
 
 
@@ -548,56 +546,38 @@
      * are optional.
      */
     if (!AcpiGbl_RootTableList.Count ||
-        !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
-                ACPI_SIG_DSDT) ||
-        ACPI_FAILURE (AcpiTbVerifyTable(&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
+        !ACPI_COMPARE_NAME (
+            &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
+            ACPI_SIG_DSDT) ||
+        ACPI_FAILURE (AcpiTbVerifyTable (
+            &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
     {
         Status = AE_NO_ACPI_TABLES;
         goto UnlockAndExit;
     }
 
-    /*
-     * Find DSDT table
-     */
-    Status = AcpiOsTableOverride (
-                AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer, &Table);
-    if (ACPI_SUCCESS (Status) && Table)
-    {
-        /*
-         * DSDT table has been found
-         */
-        AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
-        AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer = Table;
-        AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Length = Table->Length;
-        AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags = ACPI_TABLE_ORIGIN_UNKNOWN;
+    /* A valid DSDT is required */
 
-        ACPI_INFO ((AE_INFO, "Table DSDT replaced by host OS"));
-        AcpiTbPrintTableHeader (0, Table);
-    }
-
-    Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
+    Status = AcpiTbVerifyTable (
+        &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
     if (ACPI_FAILURE (Status))
     {
-        /* A valid DSDT is required */
-
         Status = AE_NO_ACPI_TABLES;
         goto UnlockAndExit;
     }
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
 
-    /*
-     * Load and parse tables.
-     */
+    /* Load and parse tables */
+
     Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
 
-    /*
-     * Load any SSDT or PSDT tables. Note: Loop leaves tables locked
-     */
+    /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
+
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
     {
@@ -605,7 +585,8 @@
                     ACPI_SIG_SSDT) &&
              !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
                     ACPI_SIG_PSDT)) ||
-             ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i])))
+             ACPI_FAILURE (AcpiTbVerifyTable (
+                &AcpiGbl_RootTableList.Tables[i])))
         {
             continue;
         }
@@ -647,13 +628,13 @@
     ACPI_FUNCTION_TRACE (AcpiLoadTables);
 
 
-    /*
-     * Load the namespace from the tables
-     */
+    /* Load the namespace from the tables */
+
     Status = AcpiTbLoadNamespace ();
     if (ACPI_FAILURE (Status))
     {
-        ACPI_EXCEPTION ((AE_INFO, Status, "While loading namespace from ACPI tables"));
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "While loading namespace from ACPI tables"));
     }
 
     return_ACPI_STATUS (Status);
--- a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: tbxfroot - Find the root ACPI table (RSDT)
- *              $Revision: 1.106 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __TBXFROOT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "actables.h"
 
 
@@ -160,7 +160,8 @@
      * Note: Sometimes there exists more than one RSDP in memory; the valid
      * RSDP has a valid checksum, all others have an invalid checksum.
      */
-    if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP, sizeof (ACPI_SIG_RSDP)-1) != 0)
+    if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP,
+            sizeof (ACPI_SIG_RSDP)-1) != 0)
     {
         /* Nope, BAD Signature */
 
@@ -188,7 +189,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiTbFindRsdp
+ * FUNCTION:    AcpiFindRootPointer
  *
  * PARAMETERS:  TableAddress            - Where the table pointer is returned
  *
--- a/usr/src/uts/intel/io/acpica/utilities/utalloc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utalloc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utalloc - local memory allocation routines
- *              $Revision: 1.166 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTALLOC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acdebug.h"
 
 #define _COMPONENT          ACPI_UTILITIES
@@ -318,7 +318,7 @@
  * RETURN:      Status
  *
  * DESCRIPTION: Validate that the buffer is of the required length or
- *              allocate a new buffer.  Returned buffer is always zeroed.
+ *              allocate a new buffer. Returned buffer is always zeroed.
  *
  ******************************************************************************/
 
@@ -327,7 +327,7 @@
     ACPI_BUFFER             *Buffer,
     ACPI_SIZE               RequiredLength)
 {
-    ACPI_STATUS             Status = AE_OK;
+    ACPI_SIZE               InputBufferLength;
 
 
     /* Parameter validation */
@@ -337,62 +337,61 @@
         return (AE_BAD_PARAMETER);
     }
 
-    switch (Buffer->Length)
+    /*
+     * Buffer->Length is used as both an input and output parameter. Get the
+     * input actual length and set the output required buffer length.
+     */
+    InputBufferLength = Buffer->Length;
+    Buffer->Length = RequiredLength;
+
+    /*
+     * The input buffer length contains the actual buffer length, or the type
+     * of buffer to be allocated by this routine.
+     */
+    switch (InputBufferLength)
     {
     case ACPI_NO_BUFFER:
 
-        /* Set the exception and returned the required length */
+        /* Return the exception (and the required buffer length) */
 
-        Status = AE_BUFFER_OVERFLOW;
-        break;
-
+        return (AE_BUFFER_OVERFLOW);
 
     case ACPI_ALLOCATE_BUFFER:
 
         /* Allocate a new buffer */
 
         Buffer->Pointer = AcpiOsAllocate (RequiredLength);
-        if (!Buffer->Pointer)
-        {
-            return (AE_NO_MEMORY);
-        }
-
-        /* Clear the buffer */
-
-        ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
         break;
 
-
     case ACPI_ALLOCATE_LOCAL_BUFFER:
 
         /* Allocate a new buffer with local interface to allow tracking */
 
-        Buffer->Pointer = ACPI_ALLOCATE_ZEROED (RequiredLength);
-        if (!Buffer->Pointer)
-        {
-            return (AE_NO_MEMORY);
-        }
+        Buffer->Pointer = ACPI_ALLOCATE (RequiredLength);
         break;
 
-
     default:
 
         /* Existing buffer: Validate the size of the buffer */
 
-        if (Buffer->Length < RequiredLength)
+        if (InputBufferLength < RequiredLength)
         {
-            Status = AE_BUFFER_OVERFLOW;
-            break;
+            return (AE_BUFFER_OVERFLOW);
         }
-
-        /* Clear the buffer */
-
-        ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
         break;
     }
 
-    Buffer->Length = RequiredLength;
-    return (Status);
+    /* Validate allocation from above or input buffer pointer */
+
+    if (!Buffer->Pointer)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    /* Have a valid buffer, clear it */
+
+    ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
+    return (AE_OK);
 }
 
 
--- a/usr/src/uts/intel/io/acpica/utilities/utcache.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utcache.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utcache - local cache allocation routines
- *              $Revision: 1.9 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTCACHE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utcache")
@@ -194,6 +194,7 @@
     ACPI_MEMORY_LIST        *Cache)
 {
     char                    *Next;
+    ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_ENTRY ();
@@ -204,6 +205,12 @@
         return (AE_BAD_PARAMETER);
     }
 
+    Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
     /* Walk the list of objects in this cache */
 
     while (Cache->ListHead)
@@ -218,6 +225,7 @@
         Cache->CurrentDepth--;
     }
 
+    (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
     return (AE_OK);
 }
 
--- a/usr/src/uts/intel/io/acpica/utilities/utclib.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utclib.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: cmclib - Local implementation of C library functions
- * $Revision: 1.61 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __CMCLIB_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 /*
  * These implementations of standard C Library routines can optionally be
--- a/usr/src/uts/intel/io/acpica/utilities/utcopy.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utcopy.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utcopy - Internal to external object translation utilities
- *              $Revision: 1.137 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTCOPY_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -226,11 +226,11 @@
      * In general, the external object will be the same type as
      * the internal object
      */
-    ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
+    ExternalObject->Type = InternalObject->Common.Type;
 
     /* However, only a limited number of external types are supported */
 
-    switch (ACPI_GET_OBJECT_TYPE (InternalObject))
+    switch (InternalObject->Common.Type)
     {
     case ACPI_TYPE_STRING:
 
@@ -318,7 +318,7 @@
          */
         ACPI_ERROR ((AE_INFO,
             "Unsupported object type, cannot convert to external object: %s",
-            AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (InternalObject))));
+            AcpiUtGetTypeName (InternalObject->Common.Type)));
 
         return_ACPI_STATUS (AE_SUPPORT);
     }
@@ -458,7 +458,7 @@
     Info.ObjectSpace = 0;
     Info.NumPackages = 1;
 
-    ExternalObject->Type             = ACPI_GET_OBJECT_TYPE (InternalObject);
+    ExternalObject->Type             = InternalObject->Common.Type;
     ExternalObject->Package.Count    = InternalObject->Package.Count;
     ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT,
                                             Info.FreeSpace);
@@ -505,7 +505,7 @@
     ACPI_FUNCTION_TRACE (UtCopyIobjectToEobject);
 
 
-    if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)
+    if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)
     {
         /*
          * Package object:  Copy all subobjects (including
@@ -588,7 +588,8 @@
     default:
         /* All other types are not supported */
 
-        ACPI_ERROR ((AE_INFO, "Unsupported object type, cannot convert to internal object: %s",
+        ACPI_ERROR ((AE_INFO,
+            "Unsupported object type, cannot convert to internal object: %s",
             AcpiUtGetTypeName (ExternalObject->Type)));
 
         return_ACPI_STATUS (AE_SUPPORT);
@@ -602,7 +603,9 @@
     case ACPI_TYPE_STRING:
 
         InternalObject->String.Pointer =
-            ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) ExternalObject->String.Length + 1);
+            ACPI_ALLOCATE_ZEROED ((ACPI_SIZE)
+                ExternalObject->String.Length + 1);
+
         if (!InternalObject->String.Pointer)
         {
             goto ErrorExit;
@@ -793,6 +796,7 @@
 {
     UINT16                  ReferenceCount;
     ACPI_OPERAND_OBJECT     *NextObject;
+    ACPI_STATUS             Status;
 
 
     /* Save fields from destination that we don't want to overwrite */
@@ -816,7 +820,7 @@
 
     /* Handle the objects with extra data */
 
-    switch (ACPI_GET_OBJECT_TYPE (DestDesc))
+    switch (DestDesc->Common.Type)
     {
     case ACPI_TYPE_BUFFER:
         /*
@@ -891,6 +895,29 @@
         }
         break;
 
+    /*
+     * For Mutex and Event objects, we cannot simply copy the underlying
+     * OS object. We must create a new one.
+     */
+    case ACPI_TYPE_MUTEX:
+
+        Status = AcpiOsCreateMutex (&DestDesc->Mutex.OsMutex);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        break;
+
+    case ACPI_TYPE_EVENT:
+
+        Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
+                    &DestDesc->Event.OsSemaphore);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        break;
+
     default:
         /* Nothing to do for other simple objects */
         break;
@@ -944,7 +971,7 @@
              * This is a simple object, just copy it
              */
             TargetObject = AcpiUtCreateInternalObject (
-                                ACPI_GET_OBJECT_TYPE (SourceObject));
+                                SourceObject->Common.Type);
             if (!TargetObject)
             {
                 return (AE_NO_MEMORY);
@@ -1029,7 +1056,7 @@
     ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage);
 
 
-    DestObj->Common.Type    = ACPI_GET_OBJECT_TYPE (SourceObj);
+    DestObj->Common.Type    = SourceObj->Common.Type;
     DestObj->Common.Flags   = SourceObj->Common.Flags;
     DestObj->Package.Count  = SourceObj->Package.Count;
 
@@ -1090,7 +1117,7 @@
 
     /* Create the top level object */
 
-    *DestDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceDesc));
+    *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
     if (!*DestDesc)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
@@ -1098,7 +1125,7 @@
 
     /* Copy the object and possible subobjects */
 
-    if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_PACKAGE)
+    if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
     {
         Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
                         WalkState);
--- a/usr/src/uts/intel/io/acpica/utilities/utdebug.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utdebug.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utdebug - Debug print routines
- *              $Revision: 1.137 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTDEBUG_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utdebug")
@@ -124,7 +124,7 @@
 
 #ifdef ACPI_DEBUG_OUTPUT
 
-static ACPI_THREAD_ID       AcpiGbl_PrevThreadId = 0xFFFFFFFF;
+static ACPI_THREAD_ID       AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
 static char                 *AcpiGbl_FnEntryStr = "----Entry";
 static char                 *AcpiGbl_FnExitStr  = "----Exit-";
 
@@ -230,7 +230,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtDebugPrint
+ * FUNCTION:    AcpiDebugPrint
  *
  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
  *              LineNumber          - Caller's line number (for error output)
@@ -248,7 +248,7 @@
  ******************************************************************************/
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtDebugPrint (
+AcpiDebugPrint (
     UINT32                  RequestedDebugLevel,
     UINT32                  LineNumber,
     const char              *FunctionName,
@@ -279,8 +279,9 @@
         if (ACPI_LV_THREADS & AcpiDbgLevel)
         {
             AcpiOsPrintf (
-                "\n**** Context Switch from TID %X to TID %X ****\n\n",
-                AcpiGbl_PrevThreadId, ThreadId);
+                "\n**** Context Switch from TID %p to TID %p ****\n\n",
+                ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId),
+                ACPI_CAST_PTR (void, ThreadId));
         }
 
         AcpiGbl_PrevThreadId = ThreadId;
@@ -294,7 +295,7 @@
 
     if (ACPI_LV_THREADS & AcpiDbgLevel)
     {
-        AcpiOsPrintf ("[%04lX] ", ThreadId);
+        AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId));
     }
 
     AcpiOsPrintf ("[%02ld] %-22.22s: ",
@@ -305,12 +306,12 @@
     va_end (args);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint)
+ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
 
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtDebugPrintRaw
+ * FUNCTION:    AcpiDebugPrintRaw
  *
  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
  *              LineNumber          - Caller's line number
@@ -328,7 +329,7 @@
  ******************************************************************************/
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtDebugPrintRaw (
+AcpiDebugPrintRaw (
     UINT32                  RequestedDebugLevel,
     UINT32                  LineNumber,
     const char              *FunctionName,
@@ -351,7 +352,7 @@
     va_end (args);
 }
 
-ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw)
+ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
 
 
 /*******************************************************************************
@@ -381,7 +382,7 @@
     AcpiGbl_NestingLevel++;
     AcpiUtTrackStackPtr ();
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s\n", AcpiGbl_FnEntryStr);
 }
@@ -417,7 +418,7 @@
     AcpiGbl_NestingLevel++;
     AcpiUtTrackStackPtr ();
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
 }
@@ -452,7 +453,7 @@
     AcpiGbl_NestingLevel++;
     AcpiUtTrackStackPtr ();
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s %s\n", AcpiGbl_FnEntryStr, String);
 }
@@ -487,7 +488,7 @@
     AcpiGbl_NestingLevel++;
     AcpiUtTrackStackPtr ();
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
 }
@@ -517,7 +518,7 @@
     UINT32                  ComponentId)
 {
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s\n", AcpiGbl_FnExitStr);
 
@@ -555,14 +556,14 @@
 
     if (ACPI_SUCCESS (Status))
     {
-        AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+        AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
             "%s %s\n", AcpiGbl_FnExitStr,
             AcpiFormatException (Status));
     }
     else
     {
-        AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+        AcpiDebugPrint (ACPI_LV_FUNCTIONS,
             LineNumber, FunctionName, ModuleName, ComponentId,
             "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
             AcpiFormatException (Status));
@@ -600,7 +601,7 @@
     ACPI_INTEGER            Value)
 {
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
         ACPI_FORMAT_UINT64 (Value));
@@ -637,7 +638,7 @@
     UINT8                   *Ptr)
 {
 
-    AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+    AcpiDebugPrint (ACPI_LV_FUNCTIONS,
         LineNumber, FunctionName, ModuleName, ComponentId,
         "%s %p\n", AcpiGbl_FnExitStr, Ptr);
 
--- a/usr/src/uts/intel/io/acpica/utilities/utdelete.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utdelete.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utdelete - object deletion and reference count utilities
- *              $Revision: 1.126 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTDELETE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acinterp.h"
 #include "acnamesp.h"
 #include "acevents.h"
@@ -158,6 +158,7 @@
     ACPI_OPERAND_OBJECT     *HandlerDesc;
     ACPI_OPERAND_OBJECT     *SecondDesc;
     ACPI_OPERAND_OBJECT     *NextDesc;
+    ACPI_OPERAND_OBJECT     **LastObjPtr;
 
 
     ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
@@ -172,7 +173,7 @@
      * Must delete or free any pointers within the object that are not
      * actual ACPI objects (for example, a raw buffer pointer).
      */
-    switch (ACPI_GET_OBJECT_TYPE (Object))
+    switch (Object->Common.Type)
     {
     case ACPI_TYPE_STRING:
 
@@ -317,6 +318,25 @@
             HandlerDesc = Object->Region.Handler;
             if (HandlerDesc)
             {
+                NextDesc = HandlerDesc->AddressSpace.RegionList;
+                LastObjPtr = &HandlerDesc->AddressSpace.RegionList;
+
+                /* Remove the region object from the handler's list */
+
+                while (NextDesc)
+                {
+                    if (NextDesc == Object)
+                    {
+                        *LastObjPtr = NextDesc->Region.Next;
+                        break;
+                    }
+
+                    /* Walk the linked list of handler */
+
+                    LastObjPtr = &NextDesc->Region.Next;
+                    NextDesc = NextDesc->Region.Next;
+                }
+
                 if (HandlerDesc->AddressSpace.HandlerFlags &
                     ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
                 {
@@ -494,7 +514,7 @@
                 Object, NewCount));
         }
 
-        if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
+        if (Object->Common.Type == ACPI_TYPE_METHOD)
         {
             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
                 "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount));
@@ -587,7 +607,7 @@
          * All sub-objects must have their reference count incremented also.
          * Different object types have different subobjects.
          */
-        switch (ACPI_GET_OBJECT_TYPE (Object))
+        switch (Object->Common.Type)
         {
         case ACPI_TYPE_DEVICE:
         case ACPI_TYPE_PROCESSOR:
@@ -696,11 +716,20 @@
 
     return_ACPI_STATUS (AE_OK);
 
+
 ErrorExit:
 
     ACPI_EXCEPTION ((AE_INFO, Status,
         "Could not update object reference count"));
 
+    /* Free any stacked Update State objects */
+
+    while (StateList)
+    {
+        State = AcpiUtPopGenericState (&StateList);
+        AcpiUtDeleteGenericState (State);
+    }
+
     return_ACPI_STATUS (Status);
 }
 
--- a/usr/src/uts/intel/io/acpica/utilities/uteval.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/uteval.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: uteval - Object evaluation
- *              $Revision: 1.73 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTEVAL_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acinterp.h"
 
@@ -140,23 +140,30 @@
 
 /*
  * Strings supported by the _OSI predefined (internal) method.
+ *
+ * March 2009: Removed "Linux" as this host no longer wants to respond true
+ * for this string. Basically, the only safe OS strings are windows-related
+ * and in many or most cases represent the only test path within the 
+ * BIOS-provided ASL code.
+ *
+ * The second element of each entry is used to track the newest version of
+ * Windows that the BIOS has requested.
  */
-static const char               *AcpiInterfacesSupported[] =
+static const ACPI_INTERFACE_INFO    AcpiInterfacesSupported[] =
 {
     /* Operating System Vendor Strings */
 
-    "Linux",
-    "Windows 2000",         /* Windows 2000 */
-    "Windows 2001",         /* Windows XP */
-    "Windows 2001 SP1",     /* Windows XP SP1 */
-    "Windows 2001 SP2",     /* Windows XP SP2 */
-    "Windows 2001.1",       /* Windows Server 2003 */
-    "Windows 2001.1 SP1",   /* Windows Server 2003 SP1 - Added 03/2006 */
-    "Windows 2006",         /* Windows Vista - Added 03/2006 */
+    {"Windows 2000",        ACPI_OSI_WIN_2000},         /* Windows 2000 */
+    {"Windows 2001",        ACPI_OSI_WIN_XP},           /* Windows XP */
+    {"Windows 2001 SP1",    ACPI_OSI_WIN_XP_SP1},       /* Windows XP SP1 */
+    {"Windows 2001.1",      ACPI_OSI_WINSRV_2003},      /* Windows Server 2003 */
+    {"Windows 2001 SP2",    ACPI_OSI_WIN_XP_SP2},       /* Windows XP SP2 */
+    {"Windows 2001.1 SP1",  ACPI_OSI_WINSRV_2003_SP1},  /* Windows Server 2003 SP1 - Added 03/2006 */
+    {"Windows 2006",        ACPI_OSI_WIN_VISTA},        /* Windows Vista - Added 03/2006 */
 
     /* Feature Group Strings */
 
-    "Extended Address Space Descriptor"
+    {"Extended Address Space Descriptor", 0}
 
     /*
      * All "optional" feature group strings (features that are implemented
@@ -185,6 +192,7 @@
     ACPI_STATUS             Status;
     ACPI_OPERAND_OBJECT     *StringDesc;
     ACPI_OPERAND_OBJECT     *ReturnDesc;
+    UINT32                  ReturnValue;
     UINT32                  i;
 
 
@@ -207,20 +215,29 @@
         return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
-    /* Default return value is SUPPORTED */
+    /* Default return value is 0, NOT SUPPORTED */
 
-    ReturnDesc->Integer.Value = ACPI_UINT32_MAX;
-    WalkState->ReturnDesc = ReturnDesc;
+    ReturnValue = 0;
 
     /* Compare input string to static table of supported interfaces */
 
     for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++)
     {
-        if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i]))
+        if (!ACPI_STRCMP (StringDesc->String.Pointer,
+                AcpiInterfacesSupported[i].Name))
         {
-            /* The interface is supported */
+            /*
+             * The interface is supported.
+             * Update the OsiData if necessary. We keep track of the latest
+             * version of Windows that has been requested by the BIOS.
+             */
+            if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData)
+            {
+                AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value;
+            }
 
-            return_ACPI_STATUS (AE_CTRL_TERMINATE);
+            ReturnValue = ACPI_UINT32_MAX;
+            goto Exit;
         }
     }
 
@@ -234,13 +251,20 @@
     {
         /* The interface is supported */
 
-        return_ACPI_STATUS (AE_CTRL_TERMINATE);
+        ReturnValue = ACPI_UINT32_MAX;
     }
 
-    /* The interface is not supported */
+
+Exit:
+    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
+        "ACPI: BIOS _OSI(%s) is %ssupported\n",
+        StringDesc->String.Pointer, ReturnValue == 0 ? "not " : ""));
 
-    ReturnDesc->Integer.Value = 0;
-    return_ACPI_STATUS (AE_CTRL_TERMINATE);
+    /* Complete the return value */
+
+    ReturnDesc->Integer.Value = ReturnValue;
+    WalkState->ReturnDesc = ReturnDesc;
+    return_ACPI_STATUS (AE_OK);
 }
 
 
@@ -325,7 +349,7 @@
 
     /* Map the return object type to the bitmapped type */
 
-    switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject))
+    switch ((Info->ReturnObject)->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
         ReturnBtype = ACPI_BTYPE_INTEGER;
@@ -512,7 +536,7 @@
         return_ACPI_STATUS (Status);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+    if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
     {
         /* Convert the Numeric HID to string */
 
@@ -557,7 +581,7 @@
 {
 
 
-    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+    switch (ObjDesc->Common.Type)
     {
     case ACPI_TYPE_INTEGER:
 
@@ -631,7 +655,7 @@
     /* Get the number of _CIDs returned */
 
     Count = 1;
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+    if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
     {
         Count = ObjDesc->Package.Count;
     }
@@ -661,7 +685,7 @@
 
     /* The _CID object can be either a single CID or a package (list) of CIDs */
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
+    if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
     {
         /* Translate each package element */
 
@@ -735,7 +759,7 @@
         return_ACPI_STATUS (Status);
     }
 
-    if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
+    if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
     {
         /* Convert the Numeric UID to string */
 
--- a/usr/src/uts/intel/io/acpica/utilities/utglobal.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utglobal.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utglobal - Global variables for the ACPI subsystem
- *              $Revision: 1.256 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,10 +117,9 @@
 #define DEFINE_ACPI_GLOBALS
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
-ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
-
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utglobal")
 
@@ -356,14 +354,12 @@
     /* ACPI_BITREG_POWER_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_POWER_BUTTON_ENABLE,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
     /* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
     /* ACPI_BITREG_RT_CLOCK_ENABLE      */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_RT_CLOCK_ENABLE,       ACPI_BITMASK_RT_CLOCK_ENABLE},
-    /* ACPI_BITREG_WAKE_ENABLE          */   {ACPI_REGISTER_PM1_ENABLE,   0,                                      0},
     /* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,   ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
 
     /* ACPI_BITREG_SCI_ENABLE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SCI_ENABLE,            ACPI_BITMASK_SCI_ENABLE},
     /* ACPI_BITREG_BUS_MASTER_RLD       */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_BUS_MASTER_RLD,        ACPI_BITMASK_BUS_MASTER_RLD},
     /* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,   ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
-    /* ACPI_BITREG_SLEEP_TYPE_A         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
-    /* ACPI_BITREG_SLEEP_TYPE_B         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
+    /* ACPI_BITREG_SLEEP_TYPE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE,            ACPI_BITMASK_SLEEP_TYPE},
     /* ACPI_BITREG_SLEEP_ENABLE         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_ENABLE,          ACPI_BITMASK_SLEEP_ENABLE},
 
     /* ACPI_BITREG_ARB_DIS              */   {ACPI_REGISTER_PM2_CONTROL,  ACPI_BITPOSITION_ARB_DISABLE,           ACPI_BITMASK_ARB_DISABLE}
@@ -400,7 +396,7 @@
     "PCI_Config",
     "EmbeddedControl",
     "SMBus",
-    "CMOS",
+    "SystemCMOS",
     "PCIBARTarget",
     "DataTable"
 };
@@ -546,7 +542,7 @@
         return ("[NULL Object Descriptor]");
     }
 
-    return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)));
+    return (AcpiUtGetTypeName (ObjDesc->Common.Type));
 }
 
 
@@ -869,7 +865,10 @@
     {
         AcpiGbl_OwnerIdMask[i]              = 0;
     }
-    AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
+
+    /* Last OwnerID is never valid */
+
+    AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
 
     /* Event counters */
 
@@ -887,6 +886,7 @@
     AcpiGbl_GpeXruptListHead            = NULL;
     AcpiGbl_GpeFadtBlocks[0]            = NULL;
     AcpiGbl_GpeFadtBlocks[1]            = NULL;
+    AcpiCurrentGpeCount                 = 0;
 
     /* Global handlers */
 
@@ -902,6 +902,7 @@
     AcpiGbl_GlobalLockMutex             = NULL;
     AcpiGbl_GlobalLockAcquired          = FALSE;
     AcpiGbl_GlobalLockHandle            = 0;
+    AcpiGbl_GlobalLockPresent           = FALSE;
 
     /* Miscellaneous variables */
 
@@ -918,6 +919,7 @@
     AcpiGbl_TraceDbgLayer               = 0;
     AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
     AcpiGbl_DbOutputFlags               = ACPI_DB_CONSOLE_OUTPUT;
+    AcpiGbl_OsiData                     = 0;
 
     /* Hardware oriented */
 
@@ -949,8 +951,10 @@
 
 /* Public globals */
 
+ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
 ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
 ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
 ACPI_EXPORT_SYMBOL (AcpiGpeCount)
+ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount)
 
 
--- a/usr/src/uts/intel/io/acpica/utilities/utinit.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utinit.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utinit - Common ACPI subsystem initialization
- *              $Revision: 1.137 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTINIT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 #include "acevents.h"
 #include "actables.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/io/acpica/utilities/utlock.c	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,277 @@
+/******************************************************************************
+ *
+ * Module Name: utlock - Reader/Writer lock interfaces
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#define __UTLOCK_C__
+
+#include "acpi.h"
+#include "accommon.h"
+
+
+#define _COMPONENT          ACPI_UTILITIES
+        ACPI_MODULE_NAME    ("utlock")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtCreateRwLock
+ *              AcpiUtDeleteRwLock
+ *
+ * PARAMETERS:  Lock                - Pointer to a valid RW lock
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Reader/writer lock creation and deletion interfaces.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreateRwLock (
+    ACPI_RW_LOCK            *Lock)
+{
+    ACPI_STATUS             Status;
+
+
+    Lock->NumReaders = 0;
+    Status = AcpiOsCreateMutex (&Lock->ReaderMutex);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    Status = AcpiOsCreateMutex (&Lock->WriterMutex);
+    return (Status);
+}
+
+
+void
+AcpiUtDeleteRwLock (
+    ACPI_RW_LOCK            *Lock)
+{
+
+    AcpiOsDeleteMutex (Lock->ReaderMutex);
+    AcpiOsDeleteMutex (Lock->WriterMutex);
+
+    Lock->NumReaders = 0;
+    Lock->ReaderMutex = NULL;
+    Lock->WriterMutex = NULL;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtAcquireReadLock
+ *              AcpiUtReleaseReadLock
+ *
+ * PARAMETERS:  Lock                - Pointer to a valid RW lock
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Reader interfaces for reader/writer locks. On acquisition,
+ *              only the first reader acquires the write mutex. On release,
+ *              only the last reader releases the write mutex. Although this
+ *              algorithm can in theory starve writers, this should not be a
+ *              problem with ACPICA since the subsystem is infrequently used
+ *              in comparison to (for example) an I/O system.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAcquireReadLock (
+    ACPI_RW_LOCK            *Lock)
+{
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /* Acquire the write lock only for the first reader */
+
+    Lock->NumReaders++;
+    if (Lock->NumReaders == 1)
+    {
+        Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER);
+    }
+
+    AcpiOsReleaseMutex (Lock->ReaderMutex);
+    return (Status);
+}
+
+
+ACPI_STATUS
+AcpiUtReleaseReadLock (
+    ACPI_RW_LOCK            *Lock)
+{
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /* Release the write lock only for the very last reader */
+
+    Lock->NumReaders--;
+    if (Lock->NumReaders == 0)
+    {
+        AcpiOsReleaseMutex (Lock->WriterMutex);
+    }
+
+    AcpiOsReleaseMutex (Lock->ReaderMutex);
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtAcquireWriteLock
+ *              AcpiUtReleaseWriteLock
+ *
+ * PARAMETERS:  Lock                - Pointer to a valid RW lock
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Writer interfaces for reader/writer locks. Simply acquire or
+ *              release the writer mutex associated with the lock. Acquisition
+ *              of the lock is fully exclusive and will block all readers and
+ *              writers until it is released.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAcquireWriteLock (
+    ACPI_RW_LOCK            *Lock)
+{
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER);
+    return (Status);
+}
+
+
+void
+AcpiUtReleaseWriteLock (
+    ACPI_RW_LOCK            *Lock)
+{
+
+    AcpiOsReleaseMutex (Lock->WriterMutex);
+}
+
--- a/usr/src/uts/intel/io/acpica/utilities/utmath.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utmath.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utmath - Integer math support routines
- *              $Revision: 1.24 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTMATH_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 
 #define _COMPONENT          ACPI_UTILITIES
--- a/usr/src/uts/intel/io/acpica/utilities/utmisc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utmisc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utmisc - common utility procedures
- *              $Revision: 1.154 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTMISC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -1176,7 +1176,7 @@
          */
         if ((!ThisSourceObj) ||
             (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) ||
-            (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE))
+            (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE))
         {
             Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj,
                                     State, Context);
@@ -1237,6 +1237,13 @@
                                             State->Pkg.ThisTargetObj, 0);
             if (!State)
             {
+                /* Free any stacked Update State objects */
+
+                while (StateList)
+                {
+                    State = AcpiUtPopGenericState (&StateList);
+                    AcpiUtDeleteGenericState (State);
+                }
                 return_ACPI_STATUS (AE_NO_MEMORY);
             }
         }
@@ -1250,7 +1257,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiUtError, AcpiUtWarning, AcpiUtInfo
+ * FUNCTION:    AcpiError, AcpiException, AcpiWarning, AcpiInfo
  *
  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
  *              LineNumber          - Caller's line number (for error output)
@@ -1263,7 +1270,7 @@
  ******************************************************************************/
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtError (
+AcpiError (
     const char              *ModuleName,
     UINT32                  LineNumber,
     const char              *Format,
@@ -1272,16 +1279,16 @@
     va_list                 args;
 
 
-    AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
+    AcpiOsPrintf ("ACPI Error: ");
 
     va_start (args, Format);
     AcpiOsVprintf (Format, args);
-    AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
+    AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber);
     va_end (args);
 }
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtException (
+AcpiException (
     const char              *ModuleName,
     UINT32                  LineNumber,
     ACPI_STATUS             Status,
@@ -1291,17 +1298,16 @@
     va_list                 args;
 
 
-    AcpiOsPrintf ("ACPI Exception (%s-%04d): %s, ", ModuleName, LineNumber,
-        AcpiFormatException (Status));
+    AcpiOsPrintf ("ACPI Exception: %s, ", AcpiFormatException (Status));
 
     va_start (args, Format);
     AcpiOsVprintf (Format, args);
-    AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
+    AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber);
     va_end (args);
 }
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtWarning (
+AcpiWarning (
     const char              *ModuleName,
     UINT32                  LineNumber,
     const char              *Format,
@@ -1310,16 +1316,16 @@
     va_list                 args;
 
 
-    AcpiOsPrintf ("ACPI Warning (%s-%04d): ", ModuleName, LineNumber);
+    AcpiOsPrintf ("ACPI Warning: ");
 
     va_start (args, Format);
     AcpiOsVprintf (Format, args);
-    AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
+    AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber);
     va_end (args);
 }
 
 void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtInfo (
+AcpiInfo (
     const char              *ModuleName,
     UINT32                  LineNumber,
     const char              *Format,
@@ -1328,10 +1334,6 @@
     va_list                 args;
 
 
-    /*
-     * Removed ModuleName, LineNumber, and acpica version, not needed
-     * for info output
-     */
     AcpiOsPrintf ("ACPI: ");
 
     va_start (args, Format);
@@ -1340,3 +1342,9 @@
     va_end (args);
 }
 
+ACPI_EXPORT_SYMBOL (AcpiError)
+ACPI_EXPORT_SYMBOL (AcpiException)
+ACPI_EXPORT_SYMBOL (AcpiWarning)
+ACPI_EXPORT_SYMBOL (AcpiInfo)
+
+
--- a/usr/src/uts/intel/io/acpica/utilities/utmutex.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utmutex.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utmutex - local mutex support
- *              $Revision: 1.13 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTMUTEX_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utmutex")
@@ -141,7 +141,8 @@
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Create the system mutex objects.
+ * DESCRIPTION: Create the system mutex objects. This includes mutexes,
+ *              spin locks, and reader/writer locks.
  *
  ******************************************************************************/
 
@@ -156,9 +157,8 @@
     ACPI_FUNCTION_TRACE (UtMutexInitialize);
 
 
-    /*
-     * Create each of the predefined mutex objects
-     */
+    /* Create each of the predefined mutex objects */
+
     for (i = 0; i < ACPI_NUM_MUTEX; i++)
     {
         Status = AcpiUtCreateMutex (i);
@@ -177,6 +177,14 @@
     }
 
     Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Create the reader/writer lock for namespace access */
+
+    Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock);
     return_ACPI_STATUS (Status);
 }
 
@@ -189,7 +197,8 @@
  *
  * RETURN:      None.
  *
- * DESCRIPTION: Delete all of the system mutex objects.
+ * DESCRIPTION: Delete all of the system mutex objects. This includes mutexes,
+ *              spin locks, and reader/writer locks.
  *
  ******************************************************************************/
 
@@ -203,9 +212,8 @@
     ACPI_FUNCTION_TRACE (UtMutexTerminate);
 
 
-    /*
-     * Delete each predefined mutex object
-     */
+    /* Delete each predefined mutex object */
+
     for (i = 0; i < ACPI_NUM_MUTEX; i++)
     {
         (void) AcpiUtDeleteMutex (i);
@@ -215,6 +223,10 @@
 
     AcpiOsDeleteLock (AcpiGbl_GpeLock);
     AcpiOsDeleteLock (AcpiGbl_HardwareLock);
+
+    /* Delete the reader/writer lock */
+
+    AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
     return_VOID;
 }
 
@@ -339,15 +351,16 @@
                 if (i == MutexId)
                 {
                     ACPI_ERROR ((AE_INFO,
-                        "Mutex [%s] already acquired by this thread [%X]",
-                        AcpiUtGetMutexName (MutexId), ThisThreadId));
+                        "Mutex [%s] already acquired by this thread [%p]",
+                        AcpiUtGetMutexName (MutexId),
+                        ACPI_CAST_PTR (void, ThisThreadId)));
 
                     return (AE_ALREADY_ACQUIRED);
                 }
 
                 ACPI_ERROR ((AE_INFO,
-                    "Invalid acquire order: Thread %X owns [%s], wants [%s]",
-                    ThisThreadId, AcpiUtGetMutexName (i),
+                    "Invalid acquire order: Thread %p owns [%s], wants [%s]",
+                    ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (i),
                     AcpiUtGetMutexName (MutexId)));
 
                 return (AE_ACQUIRE_DEADLOCK);
@@ -357,15 +370,15 @@
 #endif
 
     ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
-        "Thread %X attempting to acquire Mutex [%s]\n",
-        ThisThreadId, AcpiUtGetMutexName (MutexId)));
+        "Thread %p attempting to acquire Mutex [%s]\n",
+        ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
 
     Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex,
                 ACPI_WAIT_FOREVER);
     if (ACPI_SUCCESS (Status))
     {
-        ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
-            ThisThreadId, AcpiUtGetMutexName (MutexId)));
+        ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p acquired Mutex [%s]\n",
+            ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
 
         AcpiGbl_MutexInfo[MutexId].UseCount++;
         AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId;
@@ -373,7 +386,8 @@
     else
     {
         ACPI_EXCEPTION ((AE_INFO, Status,
-            "Thread %X could not acquire Mutex [%X]", ThisThreadId, MutexId));
+            "Thread %p could not acquire Mutex [%X]",
+            ACPI_CAST_PTR (void, ThisThreadId), MutexId));
     }
 
     return (Status);
@@ -403,9 +417,8 @@
 
 
     ThisThreadId = AcpiOsGetThreadId ();
-    ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
-        "Thread %X releasing Mutex [%s]\n", ThisThreadId,
-        AcpiUtGetMutexName (MutexId)));
+    ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
+        ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId)));
 
     if (MutexId > ACPI_MAX_MUTEX)
     {
--- a/usr/src/uts/intel/io/acpica/utilities/utobject.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utobject.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utobject - ACPI object create/delete/size/cache routines
- *              $Revision: 1.108 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,6 +116,7 @@
 #define __UTOBJECT_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acnamesp.h"
 
 
@@ -419,7 +419,7 @@
 
     if (!Object)
     {
-        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n"));
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Null Object Ptr\n"));
         return (FALSE);
     }
 
@@ -434,7 +434,7 @@
         return (TRUE);
 
     default:
-        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
                 "%p is not not an ACPI operand obj [%s]\n",
                 Object, AcpiUtGetDescriptorName (Object)));
         break;
@@ -586,7 +586,7 @@
      * must be accessed bytewise or there may be alignment problems on
      * certain processors
      */
-    switch (ACPI_GET_OBJECT_TYPE (InternalObject))
+    switch (InternalObject->Common.Type)
     {
     case ACPI_TYPE_STRING:
 
@@ -650,7 +650,7 @@
         ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
             "unsupported type [%s] %X in object %p",
             AcpiUtGetObjectTypeName (InternalObject),
-            ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject));
+            InternalObject->Common.Type, InternalObject));
         Status = AE_TYPE;
         break;
     }
@@ -809,7 +809,7 @@
 
 
     if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) &&
-        (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE))
+        (InternalObject->Common.Type == ACPI_TYPE_PACKAGE))
     {
         Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength);
     }
--- a/usr/src/uts/intel/io/acpica/utilities/utresrc.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utresrc.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utresrc - Resource managment utilities
- *              $Revision: 1.15 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTRESRC_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "amlresrc.h"
 
 
--- a/usr/src/uts/intel/io/acpica/utilities/utstate.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utstate.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
  * Module Name: utstate - state object support procedures
- *              $Revision: 1.9 $
  *
  ******************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,6 +117,7 @@
 #define __UTSTATE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utstate")
@@ -302,7 +302,7 @@
     if (!State->Thread.ThreadId)
     {
         ACPI_ERROR ((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
-        State->Thread.ThreadId = 1;
+        State->Thread.ThreadId = (ACPI_THREAD_ID) 1;
     }
 
     return_PTR ((ACPI_THREAD_STATE *) State);
--- a/usr/src/uts/intel/io/acpica/utilities/uttrack.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/uttrack.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: uttrack - Memory allocation tracking routines (debug only)
- *              $Revision: 1.6 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -128,6 +127,7 @@
 #define __UTTRACK_C__
 
 #include "acpi.h"
+#include "accommon.h"
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
--- a/usr/src/uts/intel/io/acpica/utilities/utxface.c	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/io/acpica/utilities/utxface.c	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: utxface - External interfaces for "global" ACPI functions
- *              $Revision: 1.128 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,9 +117,11 @@
 #define __UTXFACE_C__
 
 #include "acpi.h"
+#include "accommon.h"
 #include "acevents.h"
 #include "acnamesp.h"
 #include "acdebug.h"
+#include "actables.h"
 
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utxface")
@@ -241,6 +242,17 @@
     }
 
     /*
+     * Obtain a permanent mapping for the FACS. This is required for the
+     * Global Lock and the Firmware Waking Vector
+     */
+    Status = AcpiTbInitializeFacs ();
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
+        return_ACPI_STATUS (Status);
+    }
+
+    /*
      * Install the default OpRegion handlers.  These are installed unless
      * other handlers have already been installed via the
      * InstallAddressSpaceHandler interface.
@@ -695,4 +707,5 @@
 
 ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
 
-#endif
+#endif /* ACPI_ASL_COMPILER */
+
--- a/usr/src/uts/intel/sys/acpi/acapps.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acapps.h	Fri Jun 26 17:26:34 2009 -0700
@@ -8,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -169,7 +169,9 @@
 ACPI_STATUS
 AdParseTable (
     ACPI_TABLE_HEADER       *Table,
-    BOOLEAN                 LoadTable);
+    ACPI_OWNER_ID           *OwnerId,
+    BOOLEAN                 LoadTable,
+    BOOLEAN                 External);
 
 ACPI_STATUS
 AdDisplayTables (
@@ -185,7 +187,8 @@
 void
 AcpiDmCrossReferenceNamespace (
     ACPI_PARSE_OBJECT       *ParseTreeRoot,
-    ACPI_NAMESPACE_NODE     *NamespaceRoot);
+    ACPI_NAMESPACE_NODE     *NamespaceRoot,
+    ACPI_OWNER_ID           OwnerId);
 
 void
 AcpiDmDumpTree (
@@ -198,7 +201,8 @@
 void
 AcpiDmFinishNamespaceLoad (
     ACPI_PARSE_OBJECT       *ParseTreeRoot,
-    ACPI_NAMESPACE_NODE     *NamespaceRoot);
+    ACPI_NAMESPACE_NODE     *NamespaceRoot,
+    ACPI_OWNER_ID           OwnerId);
 
 void
 AcpiDmConvertResourceIndexes (
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/sys/acpi/accommon.h	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,136 @@
+/******************************************************************************
+ *
+ * Name: accommon.h - Common include files for generation of ACPICA source
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACCOMMON_H__
+#define __ACCOMMON_H__
+
+/*
+ * Common set of includes for all ACPICA source files.
+ * We put them here because we don't want to duplicate them
+ * in the the source code again and again.
+ *
+ * Note: The order of these include files is important.
+ */
+#include "acconfig.h"           /* Global configuration constants */
+#include "acmacros.h"           /* C macros */
+#include "aclocal.h"            /* Internal data types */
+#include "acobject.h"           /* ACPI internal object */
+#include "acstruct.h"           /* Common structures */
+#include "acglobal.h"           /* All global variables */
+#include "achware.h"            /* Hardware defines and interfaces */
+#include "acutils.h"            /* Utility interfaces */
+
+
+#endif /* __ACCOMMON_H__ */
--- a/usr/src/uts/intel/sys/acpi/acconfig.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acconfig.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acconfig.h - Global configuration constants
- *       $Revision: 1.243 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -135,10 +134,6 @@
  *
  */
 
-/* Current ACPICA subsystem version in YYYYMMDD format */
-
-#define ACPI_CA_VERSION                 0x20080829
-
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
  * but there is a large base of ASL/AML code in existing machines that check
@@ -194,6 +189,10 @@
 
 #define ACPI_ROOT_TABLE_SIZE_INCREMENT  4
 
+/* Maximum number of While() loop iterations before forced abort */
+
+#define ACPI_MAX_LOOP_ITERATIONS        0xFFFF
+
 
 /******************************************************************************
  *
@@ -201,11 +200,6 @@
  *
  *****************************************************************************/
 
-/* Number of distinct GPE register blocks and register width */
-
-#define ACPI_MAX_GPE_BLOCKS             2
-#define ACPI_GPE_REGISTER_WIDTH         8
-
 /* Method info (in WALK_STATE), containing local variables and argumetns */
 
 #define ACPI_METHOD_NUM_LOCALS          8
@@ -214,12 +208,6 @@
 #define ACPI_METHOD_NUM_ARGS            7
 #define ACPI_METHOD_MAX_ARG             6
 
-/* Length of _HID, _UID, _CID, and UUID values */
-
-#define ACPI_DEVICE_ID_LENGTH           0x09
-#define ACPI_MAX_CID_LENGTH             48
-#define ACPI_UUID_LENGTH                16
-
 /*
  * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
  */
@@ -237,17 +225,6 @@
  */
 #define ACPI_RESULTS_OBJ_NUM_MAX        255
 
-/* Names within the namespace are 4 bytes long */
-
-#define ACPI_NAME_SIZE                  4
-#define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
-#define ACPI_PATH_SEPARATOR             '.'
-
-/* Sizes for ACPI table headers */
-
-#define ACPI_OEM_ID_SIZE                6
-#define ACPI_OEM_TABLE_ID_SIZE          8
-
 /* Constants used in searching for the RSDP in low memory */
 
 #define ACPI_EBDA_PTR_LOCATION          0x0000040E     /* Physical Address */
--- a/usr/src/uts/intel/sys/acpi/acdebug.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acdebug.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acdebug.h - ACPI/AML debugger
- *       $Revision: 1.85 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -314,6 +313,13 @@
     ACPI_OPERAND_OBJECT     *ObjDesc,
     ACPI_WALK_STATE         *WalkState);
 
+void
+AcpiDbCheckPredefinedNames (
+    void);
+
+void
+AcpiDbBatchExecute (
+    void);
 
 /*
  * dbexec - debugger control method execution
--- a/usr/src/uts/intel/sys/acpi/acdisasm.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acdisasm.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acdisasm.h - AML disassembler
- *       $Revision: 1.45 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -183,6 +182,7 @@
 #define ACPI_DMT_SRAT                   29
 #define ACPI_DMT_EXIT                   30
 #define ACPI_DMT_SIG                    31
+#define ACPI_DMT_FADTPM                 32
 
 typedef
 void (*ACPI_DMTABLE_HANDLER) (
@@ -257,9 +257,18 @@
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFacs[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt1[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt2[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt3[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoGas[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHeader[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest0[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest1[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest3[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest4[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest5[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest6[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest7[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest8[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHest9[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHestNotify[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHpet[];
--- a/usr/src/uts/intel/sys/acpi/acdispat.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acdispat.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acdispat.h - dispatcher (parser to interpreter interface)
- *       $Revision: 1.79 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/acevents.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acevents.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acevents.h - Event subcomponent prototypes and defines
- *       $Revision: 1.110 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -199,12 +198,14 @@
 
 ACPI_STATUS
 AcpiEvWalkGpeList (
-    ACPI_GPE_CALLBACK       GpeWalkCallback);
+    ACPI_GPE_CALLBACK       GpeWalkCallback,
+    void                    *Context);
 
 ACPI_STATUS
 AcpiEvDeleteGpeHandlers (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock);
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
 
 ACPI_STATUS
 AcpiEvCreateGpeBlock (
@@ -262,7 +263,7 @@
 AcpiEvAddressSpaceDispatch (
     ACPI_OPERAND_OBJECT    *RegionObj,
     UINT32                  Function,
-    ACPI_PHYSICAL_ADDRESS   Address,
+    UINT32                  RegionOffset,
     UINT32                  BitWidth,
     ACPI_INTEGER            *Value);
 
--- a/usr/src/uts/intel/sys/acpi/acexcep.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acexcep.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acexcep.h - Exception codes returned by the ACPI subsystem
- *       $Revision: 1.80 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -180,8 +179,9 @@
 #define AE_BAD_OCTAL_CONSTANT           (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER)
 #define AE_BAD_DECIMAL_CONSTANT         (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER)
 #define AE_MISSING_ARGUMENTS            (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER)
+#define AE_BAD_ADDRESS                  (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER)
 
-#define AE_CODE_PGM_MAX                 0x0008
+#define AE_CODE_PGM_MAX                 0x0009
 
 
 /*
@@ -232,8 +232,9 @@
 #define AE_AML_CIRCULAR_REFERENCE       (ACPI_STATUS) (0x001E | AE_CODE_AML)
 #define AE_AML_BAD_RESOURCE_LENGTH      (ACPI_STATUS) (0x001F | AE_CODE_AML)
 #define AE_AML_ILLEGAL_ADDRESS          (ACPI_STATUS) (0x0020 | AE_CODE_AML)
+#define AE_AML_INFINITE_LOOP            (ACPI_STATUS) (0x0021 | AE_CODE_AML)
 
-#define AE_CODE_AML_MAX                 0x0020
+#define AE_CODE_AML_MAX                 0x0021
 
 
 /*
@@ -256,9 +257,10 @@
 #define AE_CODE_CTRL_MAX                0x000D
 
 
+/* Exception strings for AcpiFormatException */
+
 #ifdef DEFINE_ACPI_GLOBALS
 
-
 /*
  * String versions of the exception codes above
  * These strings must match the corresponding defines exactly
@@ -305,7 +307,8 @@
     "AE_BAD_HEX_CONSTANT",
     "AE_BAD_OCTAL_CONSTANT",
     "AE_BAD_DECIMAL_CONSTANT",
-    "AE_MISSING_ARGUMENTS"
+    "AE_MISSING_ARGUMENTS",
+    "AE_BAD_ADDRESS"
 };
 
 char const   *AcpiGbl_ExceptionNames_Tbl[] =
@@ -353,6 +356,7 @@
     "AE_AML_CIRCULAR_REFERENCE",
     "AE_AML_BAD_RESOURCE_LENGTH",
     "AE_AML_ILLEGAL_ADDRESS",
+    "AE_AML_INFINITE_LOOP"
 };
 
 char const   *AcpiGbl_ExceptionNames_Ctrl[] =
--- a/usr/src/uts/intel/sys/acpi/acglobal.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acglobal.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acglobal.h - Declarations for global variables
- *       $Revision: 1.199 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -177,6 +176,12 @@
  */
 ACPI_EXTERN UINT8       ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE);
 
+/*
+ * Optionally use default values for the ACPI register widths. Set this to
+ * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
+ */
+ACPI_EXTERN UINT8       ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE);
+
 
 /*****************************************************************************
  *
@@ -192,10 +197,14 @@
  */
 ACPI_EXTERN ACPI_INTERNAL_RSDT          AcpiGbl_RootTableList;
 ACPI_EXTERN ACPI_TABLE_FADT             AcpiGbl_FADT;
+ACPI_EXTERN ACPI_TABLE_FACS            *AcpiGbl_FACS;
 
-/* These addresses are calculated from FADT address values */
+/* These addresses are calculated from the FADT Event Block addresses */
 
+ACPI_EXTERN ACPI_GENERIC_ADDRESS        AcpiGbl_XPm1aStatus;
 ACPI_EXTERN ACPI_GENERIC_ADDRESS        AcpiGbl_XPm1aEnable;
+
+ACPI_EXTERN ACPI_GENERIC_ADDRESS        AcpiGbl_XPm1bStatus;
 ACPI_EXTERN ACPI_GENERIC_ADDRESS        AcpiGbl_XPm1bEnable;
 
 /*
@@ -238,6 +247,10 @@
 ACPI_EXTERN ACPI_SPINLOCK               AcpiGbl_GpeLock;      /* For GPE data structs and registers */
 ACPI_EXTERN ACPI_SPINLOCK               AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */
 
+/* Reader/Writer lock is used for namespace walk and dynamic table unload */
+
+ACPI_EXTERN ACPI_RW_LOCK                AcpiGbl_NamespaceRwLock;
+
 
 /*****************************************************************************
  *
@@ -282,6 +295,7 @@
 ACPI_EXTERN BOOLEAN                     AcpiGbl_AcpiHardwarePresent;
 ACPI_EXTERN BOOLEAN                     AcpiGbl_EventsInitialized;
 ACPI_EXTERN BOOLEAN                     AcpiGbl_SystemAwakeAndRunning;
+ACPI_EXTERN UINT8                       AcpiGbl_OsiData;
 
 
 #ifndef DEFINE_ACPI_GLOBALS
@@ -379,6 +393,7 @@
 ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER    AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
 ACPI_EXTERN ACPI_GPE_XRUPT_INFO        *AcpiGbl_GpeXruptListHead;
 ACPI_EXTERN ACPI_GPE_BLOCK_INFO        *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN UINT32                      AcpiCurrentGpeCount;
 
 
 /*****************************************************************************
@@ -434,9 +449,6 @@
 extern      BOOLEAN                     AcpiGbl_AbortMethod;
 extern      BOOLEAN                     AcpiGbl_DbTerminateThreads;
 
-ACPI_EXTERN int                         optind;
-ACPI_EXTERN char                       *optarg;
-
 ACPI_EXTERN BOOLEAN                     AcpiGbl_DbOpt_tables;
 ACPI_EXTERN BOOLEAN                     AcpiGbl_DbOpt_stats;
 ACPI_EXTERN BOOLEAN                     AcpiGbl_DbOpt_ini_methods;
@@ -452,7 +464,6 @@
 ACPI_EXTERN char                       *AcpiGbl_DbFilename;
 ACPI_EXTERN UINT32                      AcpiGbl_DbDebugLevel;
 ACPI_EXTERN UINT32                      AcpiGbl_DbConsoleDebugLevel;
-ACPI_EXTERN ACPI_TABLE_HEADER          *AcpiGbl_DbTablePtr;
 ACPI_EXTERN ACPI_NAMESPACE_NODE        *AcpiGbl_DbScopeNode;
 
 /*
--- a/usr/src/uts/intel/sys/acpi/achware.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/achware.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: achware.h -- hardware specific interfaces
- *       $Revision: 1.84 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,11 +117,7 @@
 #define __ACHWARE_H__
 
 
-/* PM Timer ticks per second (HZ) */
-
-#define PM_TIMER_FREQUENCY  3579545
-
-/* Values for the _SST reserved method */
+/* Values for the _SST predefined method */
 
 #define ACPI_SST_INDICATOR_OFF  0
 #define ACPI_SST_WORKING        1
@@ -131,9 +126,6 @@
 #define ACPI_SST_SLEEP_CONTEXT  4
 
 
-/* Prototypes */
-
-
 /*
  * hwacpi - high level functions
  */
@@ -154,6 +146,11 @@
     UINT32                  RegisterId);
 
 ACPI_STATUS
+AcpiHwWritePm1Control (
+    UINT32                  Pm1aControl,
+    UINT32                  Pm1bControl);
+
+ACPI_STATUS
 AcpiHwRegisterRead (
     UINT32                  RegisterId,
     UINT32                  *ReturnValue);
@@ -164,20 +161,24 @@
     UINT32                  Value);
 
 ACPI_STATUS
-AcpiHwLowLevelRead (
-    UINT32                  Width,
+AcpiHwClearAcpiStatus (
+    void);
+
+
+/*
+ * hwvalid - Port I/O with validation
+ */
+ACPI_STATUS
+AcpiHwReadPort (
+    ACPI_IO_ADDRESS         Address,
     UINT32                  *Value,
-    ACPI_GENERIC_ADDRESS    *Reg);
+    UINT32                  Width);
 
 ACPI_STATUS
-AcpiHwLowLevelWrite (
-    UINT32                  Width,
+AcpiHwWritePort (
+    ACPI_IO_ADDRESS         Address,
     UINT32                  Value,
-    ACPI_GENERIC_ADDRESS    *Reg);
-
-ACPI_STATUS
-AcpiHwClearAcpiStatus (
-    void);
+    UINT32                  Width);
 
 
 /*
@@ -194,7 +195,8 @@
 ACPI_STATUS
 AcpiHwDisableGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock);
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
 
 ACPI_STATUS
 AcpiHwClearGpe (
@@ -203,7 +205,8 @@
 ACPI_STATUS
 AcpiHwClearGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock);
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
 
 ACPI_STATUS
 AcpiHwGetGpeStatus (
@@ -225,7 +228,8 @@
 ACPI_STATUS
 AcpiHwEnableRuntimeGpeBlock (
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO     *GpeBlock);
+    ACPI_GPE_BLOCK_INFO     *GpeBlock,
+    void                    *Context);
 
 
 /*
--- a/usr/src/uts/intel/sys/acpi/acinterp.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acinterp.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
- *       $Revision: 1.173 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/aclocal.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/aclocal.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: aclocal.h - Internal data types used across the ACPI subsystem
- *       $Revision: 1.250 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,10 +116,9 @@
 #ifndef __ACLOCAL_H__
 #define __ACLOCAL_H__
 
+
 /* acpisrc:StructDefs -- for acpisrc conversion */
 
-#define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
-#define ACPI_DO_NOT_WAIT                0
 #define ACPI_SERIALIZED                 0xFF
 
 typedef UINT32                          ACPI_MUTEX_HANDLE;
@@ -187,6 +185,16 @@
 #endif
 #endif
 
+/* Lock structure for reader/writer interfaces */
+
+typedef struct acpi_rw_lock
+{
+    ACPI_MUTEX              WriterMutex;
+    ACPI_MUTEX              ReaderMutex;
+    UINT32                  NumReaders;
+
+} ACPI_RW_LOCK;
+
 
 /*
  * Predefined handles for spinlocks used within the subsystem.
@@ -199,14 +207,9 @@
 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
 
 
-/* Owner IDs are used to track namespace nodes for selective deletion */
-
-typedef UINT8                           ACPI_OWNER_ID;
-#define ACPI_OWNER_ID_MAX               0xFF
-
 /* This Thread ID means that the mutex is not in use (unlocked) */
 
-#define ACPI_MUTEX_NOT_ACQUIRED         (UINT32) -1
+#define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
 
 /* Table for the global mutexes */
 
@@ -252,13 +255,6 @@
 
 } ACPI_INTERPRETER_MODE;
 
-typedef union acpi_name_union
-{
-    UINT32                          Integer;
-    char                            Ascii[4];
-
-} ACPI_NAME_UNION;
-
 
 /*
  * The Namespace Node describes a named object that appears in the AML.
@@ -301,6 +297,8 @@
 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
+#define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
+#define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
 
 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
@@ -308,27 +306,6 @@
 #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
 
-/*
- * ACPI Table Descriptor.  One per ACPI table
- */
-typedef struct acpi_table_desc
-{
-    ACPI_PHYSICAL_ADDRESS           Address;
-    ACPI_TABLE_HEADER               *Pointer;
-    UINT32                          Length;     /* Length fixed at 32 bits */
-    ACPI_NAME_UNION                 Signature;
-    ACPI_OWNER_ID                   OwnerId;
-    UINT8                           Flags;
-
-} ACPI_TABLE_DESC;
-
-/* Flags for above */
-
-#define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
-#define ACPI_TABLE_ORIGIN_MAPPED        (1)
-#define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
-#define ACPI_TABLE_ORIGIN_MASK          (3)
-#define ACPI_TABLE_IS_LOADED            (4)
 
 /* One internal RSDT for table management */
 
@@ -370,18 +347,6 @@
 } ACPI_NS_SEARCH_DATA;
 
 
-/*
- * Predefined Namespace items
- */
-typedef struct acpi_predefined_names
-{
-    char                            *Name;
-    UINT8                           Type;
-    char                            *Val;
-
-} ACPI_PREDEFINED_NAMES;
-
-
 /* Object types used during package copies */
 
 #define ACPI_COPY_TYPE_SIMPLE           0
@@ -458,6 +423,93 @@
 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 
 
+/*
+ * Information structure for ACPI predefined names.
+ * Each entry in the table contains the following items:
+ *
+ * Name                 - The ACPI reserved name
+ * ParamCount           - Number of arguments to the method
+ * ExpectedReturnBtypes - Allowed type(s) for the return value
+ */
+typedef struct acpi_name_info
+{
+    char                        Name[ACPI_NAME_SIZE];
+    UINT8                       ParamCount;
+    UINT8                       ExpectedBtypes;
+
+} ACPI_NAME_INFO;
+
+/*
+ * Secondary information structures for ACPI predefined objects that return
+ * package objects. This structure appears as the next entry in the table
+ * after the NAME_INFO structure above.
+ *
+ * The reason for this is to minimize the size of the predefined name table.
+ */
+
+/*
+ * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
+ * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
+ */
+typedef struct acpi_package_info
+{
+    UINT8                       Type;
+    UINT8                       ObjectType1;
+    UINT8                       Count1;
+    UINT8                       ObjectType2;
+    UINT8                       Count2;
+    UINT8                       Reserved;
+
+} ACPI_PACKAGE_INFO;
+
+/* Used for ACPI_PTYPE2_FIXED */
+
+typedef struct acpi_package_info2
+{
+    UINT8                       Type;
+    UINT8                       Count;
+    UINT8                       ObjectType[4];
+
+} ACPI_PACKAGE_INFO2;
+
+/* Used for ACPI_PTYPE1_OPTION */
+
+typedef struct acpi_package_info3
+{
+    UINT8                       Type;
+    UINT8                       Count;
+    UINT8                       ObjectType[2];
+    UINT8                       TailObjectType;
+    UINT8                       Reserved;
+
+} ACPI_PACKAGE_INFO3;
+
+typedef union acpi_predefined_info
+{
+    ACPI_NAME_INFO              Info;
+    ACPI_PACKAGE_INFO           RetInfo;
+    ACPI_PACKAGE_INFO2          RetInfo2;
+    ACPI_PACKAGE_INFO3          RetInfo3;
+
+} ACPI_PREDEFINED_INFO;
+
+/*
+ * Bitmapped return value types
+ * Note: the actual data types must be contiguous, a loop in nspredef.c
+ * depends on this.
+ */
+#define ACPI_RTYPE_ANY                  0x00
+#define ACPI_RTYPE_NONE                 0x01
+#define ACPI_RTYPE_INTEGER              0x02
+#define ACPI_RTYPE_STRING               0x04
+#define ACPI_RTYPE_BUFFER               0x08
+#define ACPI_RTYPE_PACKAGE              0x10
+#define ACPI_RTYPE_REFERENCE            0x20
+#define ACPI_RTYPE_ALL                  0x3F
+
+#define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
+
+
 /*****************************************************************************
  *
  * Event typedefs and structs
@@ -535,7 +587,6 @@
 
 } ACPI_GPE_XRUPT_INFO;
 
-
 typedef struct acpi_gpe_walk_info
 {
     ACPI_NAMESPACE_NODE             *GpeDevice;
@@ -543,10 +594,19 @@
 
 } ACPI_GPE_WALK_INFO;
 
+typedef struct acpi_gpe_device_info
+{
+    UINT32                          Index;
+    UINT32                          NextBlockBaseIndex;
+    ACPI_STATUS                     Status;
+    ACPI_NAMESPACE_NODE             *GpeDevice;
+
+} ACPI_GPE_DEVICE_INFO;
 
 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
-    ACPI_GPE_BLOCK_INFO             *GpeBlock);
+    ACPI_GPE_BLOCK_INFO             *GpeBlock,
+    void                            *Context);
 
 
 /* Information about each particular fixed event */
@@ -644,6 +704,7 @@
     union acpi_parse_object         *PredicateOp;
     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
     UINT8                           *PackageEnd;            /* End of if/while block */
+    UINT32                          LoopCount;              /* While() loop counter */
 
 } ACPI_CONTROL_STATE;
 
@@ -784,6 +845,13 @@
 
 } ACPI_PARSE_VALUE;
 
+
+#ifdef ACPI_DISASSEMBLER
+#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
+#else
+#define ACPI_DISASM_ONLY_MEMBERS(a)
+#endif
+
 #define ACPI_PARSE_COMMON \
     union acpi_parse_object         *Parent;        /* Parent op */\
     UINT8                           DescriptorType; /* To differentiate various internal objs */\
@@ -921,9 +989,6 @@
  *
  ****************************************************************************/
 
-#define PCI_ROOT_HID_STRING             "PNP0A03"
-#define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
-
 typedef struct acpi_bit_register_info
 {
     UINT8                           ParentRegister;
@@ -938,8 +1003,27 @@
  * must be preserved.
  */
 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
-#define ACPI_PM1_CONTROL_PRESERVED_BITS         0x0201  /* Bit 9, Bit 0 (SCI_EN) */
+
+/* Write-only bits must be zeroed by software */
+
+#define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
+
+/* For control registers, both ignored and reserved bits must be preserved */
 
+/*
+ * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
+ * ACPI specification to be a "preserved" bit - "OSPM always preserves this
+ * bit position", section 4.7.3.2.1. However, on some machines the OS must
+ * write a one to this bit after resume for the machine to work properly.
+ * To enable this, we no longer attempt to preserve this bit. No machines
+ * are known to fail if the bit is not preserved. (May 2009)
+ */
+#define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
+#define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
+#define ACPI_PM1_CONTROL_PRESERVED_BITS \
+         (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
+
+#define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
 
 /*
  * Register IDs
@@ -948,12 +1032,10 @@
 #define ACPI_REGISTER_PM1_STATUS                0x01
 #define ACPI_REGISTER_PM1_ENABLE                0x02
 #define ACPI_REGISTER_PM1_CONTROL               0x03
-#define ACPI_REGISTER_PM1A_CONTROL              0x04
-#define ACPI_REGISTER_PM1B_CONTROL              0x05
-#define ACPI_REGISTER_PM2_CONTROL               0x06
-#define ACPI_REGISTER_PM_TIMER                  0x07
-#define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
-#define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
+#define ACPI_REGISTER_PM2_CONTROL               0x04
+#define ACPI_REGISTER_PM_TIMER                  0x05
+#define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
+#define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
 
 
 /* Masks used to access the BitRegisters */
@@ -986,7 +1068,7 @@
 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
-#define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
+#define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
 
 #define ACPI_BITMASK_ARB_DISABLE                0x0001
@@ -1013,12 +1095,41 @@
 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
-#define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
+#define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
 
 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
 
 
+/* Structs and definitions for _OSI support and I/O port validation */
+
+#define ACPI_OSI_WIN_2000               0x01
+#define ACPI_OSI_WIN_XP                 0x02
+#define ACPI_OSI_WIN_XP_SP1             0x03
+#define ACPI_OSI_WINSRV_2003            0x04
+#define ACPI_OSI_WIN_XP_SP2             0x05
+#define ACPI_OSI_WINSRV_2003_SP1        0x06
+#define ACPI_OSI_WIN_VISTA              0x07
+
+#define ACPI_ALWAYS_ILLEGAL             0x00
+
+typedef struct acpi_interface_info
+{
+    char                    *Name;
+    UINT8                   Value;
+
+} ACPI_INTERFACE_INFO;
+
+typedef struct acpi_port_info
+{
+    char                    *Name;
+    UINT16                  Start;
+    UINT16                  End;
+    UINT8                   OsiDependency;
+
+} ACPI_PORT_INFO;
+
+
 /*****************************************************************************
  *
  * Resource descriptors
@@ -1095,6 +1206,7 @@
 {
     ACPI_HANDLE                     MainThreadGate;
     ACPI_HANDLE                     ThreadCompleteGate;
+    ACPI_HANDLE                     InfoGate;
     UINT32                          *Threads;
     UINT32                          NumThreads;
     UINT32                          NumCreated;
@@ -1174,29 +1286,4 @@
 #define ACPI_NUM_MEM_LISTS              2
 
 
-typedef struct acpi_memory_list
-{
-    char                            *ListName;
-    void                            *ListHead;
-    UINT16                          ObjectSize;
-    UINT16                          MaxDepth;
-    UINT16                          CurrentDepth;
-    UINT16                          LinkOffset;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
-    /* Statistics for debug memory tracking only */
-
-    UINT32                          TotalAllocated;
-    UINT32                          TotalFreed;
-    UINT32                          MaxOccupied;
-    UINT32                          TotalSize;
-    UINT32                          CurrentTotalSize;
-    UINT32                          Requests;
-    UINT32                          Hits;
-#endif
-
-} ACPI_MEMORY_LIST;
-
-
 #endif /* __ACLOCAL_H__ */
--- a/usr/src/uts/intel/sys/acpi/acmacros.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acmacros.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acmacros.h - C macros for the entire subsystem.
- *       $Revision: 1.199 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -119,24 +118,6 @@
 
 
 /*
- * Data manipulation macros
- */
-#define ACPI_LOWORD(l)                  ((UINT16)(UINT32)(l))
-#define ACPI_HIWORD(l)                  ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF))
-#define ACPI_LOBYTE(l)                  ((UINT8)(UINT16)(l))
-#define ACPI_HIBYTE(l)                  ((UINT8)((((UINT16)(l)) >> 8) & 0xFF))
-
-#define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
-#define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
-#define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
-#define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
-
-/* Size calculation */
-
-#define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
-
-
-/*
  * Extract data using a pointer. Any more than a byte and we
  * get into potential aligment issues -- see the STORE macros below.
  * Use with care.
@@ -151,41 +132,6 @@
 #define ACPI_SET64(ptr)                 *ACPI_CAST_PTR (UINT64, ptr)
 
 /*
- * Pointer manipulation
- */
-#define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
-#define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
-#define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
-#define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
-
-/* Pointer/Integer type conversions */
-
-#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
-#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
-#define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
-#define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
-#define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
-
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
-#else
-#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
-#endif
-
-/*
- * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
- */
-typedef struct acpi_integer_overlay
-{
-    UINT32              LoDword;
-    UINT32              HiDword;
-
-} ACPI_INTEGER_OVERLAY;
-
-#define ACPI_LODWORD(Integer)           (ACPI_CAST_PTR (ACPI_INTEGER_OVERLAY, &Integer)->LoDword)
-#define ACPI_HIDWORD(Integer)           (ACPI_CAST_PTR (ACPI_INTEGER_OVERLAY, &Integer)->HiDword)
-
-/*
  * printf() format helpers
  */
 
@@ -287,7 +233,7 @@
 /*
  * The hardware does not support unaligned transfers. We must move the
  * data one byte at a time. These macros work whether the source or
- * the destination (or both) is/are unaligned.  (Little-endian move)
+ * the destination (or both) is/are unaligned. (Little-endian move)
  */
 
 /* 16-bit source, 16/32/64 destination */
@@ -409,10 +355,6 @@
 #define ACPI_GET_DESCRIPTOR_TYPE(d)     (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType)
 #define ACPI_SET_DESCRIPTOR_TYPE(d, t)  (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t)
 
-/* Macro to test the object type */
-
-#define ACPI_GET_OBJECT_TYPE(d)         (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type)
-
 /*
  * Macros for the master AML opcode table
  */
@@ -424,12 +366,6 @@
     {(UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type}
 #endif
 
-#ifdef ACPI_DISASSEMBLER
-#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
-#else
-#define ACPI_DISASM_ONLY_MEMBERS(a)
-#endif
-
 #define ARG_TYPE_WIDTH                  5
 #define ARG_1(x)                        ((UINT32)(x))
 #define ARG_2(x)                        ((UINT32)(x) << (1 * ARG_TYPE_WIDTH))
@@ -455,33 +391,15 @@
 #define GET_CURRENT_ARG_TYPE(List)      (List & ((UINT32) 0x1F))
 #define INCREMENT_ARG_LIST(List)        (List >>= ((UINT32) ARG_TYPE_WIDTH))
 
-
-#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
-/*
- * Module name is include in both debug and non-debug versions primarily for
- * error messages. The __FILE__ macro is not very useful for this, because it
- * often includes the entire pathname to the module
- */
-#define ACPI_MODULE_NAME(Name)          static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name;
-#else
-#define ACPI_MODULE_NAME(Name)
-#endif
-
 /*
  * Ascii error messages can be configured out
  */
 #ifndef ACPI_NO_ERROR_MESSAGES
-#define AE_INFO                         _AcpiModuleName, __LINE__
-
 /*
  * Error reporting. Callers module and line number are inserted by AE_INFO,
  * the plist contains a set of parens to allow variable-length lists.
  * These macros are used for both the debug and non-debug versions of the code.
  */
-#define ACPI_INFO(plist)                AcpiUtInfo plist
-#define ACPI_WARNING(plist)             AcpiUtWarning plist
-#define ACPI_EXCEPTION(plist)           AcpiUtException plist
-#define ACPI_ERROR(plist)               AcpiUtError plist
 #define ACPI_ERROR_NAMESPACE(s, e)      AcpiNsReportError (AE_INFO, s, e);
 #define ACPI_ERROR_METHOD(s, n, p, e)   AcpiNsReportMethodError (AE_INFO, s, n, p, e);
 
@@ -489,50 +407,18 @@
 
 /* No error messages */
 
-#define ACPI_INFO(plist)
-#define ACPI_WARNING(plist)
-#define ACPI_EXCEPTION(plist)
-#define ACPI_ERROR(plist)
 #define ACPI_ERROR_NAMESPACE(s, e)
 #define ACPI_ERROR_METHOD(s, n, p, e)
-#endif
+
+#endif /* ACPI_NO_ERROR_MESSAGES */
 
 /*
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
-
-/*
- * Common parameters used for debug output functions:
- * line number, function name, module(file) name, component ID
- */
-#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT
-
 /*
  * Function entry tracing
  */
-
-/*
- * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
- * define it now. This is the case where there the compiler does not support
- * a __FUNCTION__ macro or equivalent.
- */
-#ifndef ACPI_GET_FUNCTION_NAME
-#define ACPI_GET_FUNCTION_NAME          _AcpiFunctionName
-/*
- * The Name parameter should be the procedure name as a quoted string.
- * The function name is also used by the function exit macros below.
- * Note: (const char) is used to be compatible with the debug interfaces
- * and macros such as __FUNCTION__.
- */
-#define ACPI_FUNCTION_NAME(Name)        static const char _AcpiFunctionName[] = #Name;
-
-#else
-/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
-
-#define ACPI_FUNCTION_NAME(Name)
-#endif
-
 #define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
                                             AcpiUtTrace(ACPI_DEBUG_PARAMETERS)
 #define ACPI_FUNCTION_TRACE_PTR(a, b)   ACPI_FUNCTION_NAME(a) \
@@ -626,16 +512,6 @@
 #define ACPI_DUMP_PATHNAME(a, b, c, d)  AcpiNsDumpPathname(a, b, c, d)
 #define ACPI_DUMP_BUFFER(a, b)          AcpiUtDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
 
-/*
- * Master debug print macros
- * Print iff:
- *    1) Debug print for the current component is enabled
- *    2) Debug error level or trace level for the print statement is enabled
- */
-#define ACPI_DEBUG_PRINT(plist)         AcpiUtDebugPrint plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     AcpiUtDebugPrintRaw plist
-
-
 #else
 /*
  * This is the non-debug case -- make everything go away,
@@ -643,7 +519,6 @@
  */
 #define ACPI_DEBUG_EXEC(a)
 #define ACPI_DEBUG_ONLY_MEMBERS(a)
-#define ACPI_FUNCTION_NAME(a)
 #define ACPI_FUNCTION_TRACE(a)
 #define ACPI_FUNCTION_TRACE_PTR(a, b)
 #define ACPI_FUNCTION_TRACE_U32(a, b)
@@ -668,7 +543,7 @@
 #define return_UINT32(s)                return(s)
 #define return_PTR(s)                   return(s)
 
-#endif
+#endif /* ACPI_DEBUG_OUTPUT */
 
 /*
  * Some code only gets executed when the debugger is built in.
--- a/usr/src/uts/intel/sys/acpi/acnames.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acnames.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acnames.h - Global names and strings
- *       $Revision: 1.8 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/acnamesp.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acnamesp.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
- *       $Revision: 1.154 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -188,11 +187,15 @@
 
 ACPI_NAMESPACE_NODE *
 AcpiNsGetNextNode (
+    ACPI_NAMESPACE_NODE     *Parent,
+    ACPI_NAMESPACE_NODE     *Child);
+
+ACPI_NAMESPACE_NODE *
+AcpiNsGetNextNodeTyped (
     ACPI_OBJECT_TYPE        Type,
     ACPI_NAMESPACE_NODE     *Parent,
     ACPI_NAMESPACE_NODE     *Child);
 
-
 /*
  * nsparse - table parsing
  */
@@ -309,6 +312,28 @@
 
 
 /*
+ * nspredef - Support for predefined/reserved names
+ */
+ACPI_STATUS
+AcpiNsCheckPredefinedNames (
+    ACPI_NAMESPACE_NODE     *Node,
+    UINT32                  UserParamCount,
+    ACPI_STATUS             ReturnStatus,
+    ACPI_OPERAND_OBJECT     **ReturnObject);
+
+const ACPI_PREDEFINED_INFO *
+AcpiNsCheckForPredefinedName (
+    ACPI_NAMESPACE_NODE     *Node);
+
+void
+AcpiNsCheckParameterCount (
+    char                        *Pathname,
+    ACPI_NAMESPACE_NODE         *Node,
+    UINT32                      UserParamCount,
+    const ACPI_PREDEFINED_INFO  *Info);
+
+
+/*
  * nsnames - Name and Scope manipulation
  */
 UINT32
--- a/usr/src/uts/intel/sys/acpi/acobject.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acobject.h	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
- *       $Revision: 1.144 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -171,7 +170,6 @@
 #define AOPOBJ_OBJECT_INITIALIZED   0x08
 #define AOPOBJ_SETUP_COMPLETE       0x10
 #define AOPOBJ_SINGLE_DATUM         0x20
-#define AOPOBJ_INVALID              0x40 /* Used if host OS won't allow an OpRegion address */
 
 
 /******************************************************************************
--- a/usr/src/uts/intel/sys/acpi/acopcode.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acopcode.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acopcode.h - AML opcode information for the AML parser and interpreter
- *       $Revision: 1.9 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/acoutput.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acoutput.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acoutput.h -- debug output
- *       $Revision: 1.102 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,9 +117,9 @@
 #define __ACOUTPUT_H__
 
 /*
- * Debug levels and component IDs.  These are used to control the
- * granularity of the output of the DEBUG_PRINT macro -- on a per-
- * component basis and a per-exception-type basis.
+ * Debug levels and component IDs. These are used to control the
+ * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
+ * per-component basis and a per-exception-type basis.
  */
 
 /* Component IDs are used in the global "DebugLayer" */
@@ -142,8 +141,10 @@
 
 #define ACPI_COMPILER               0x00001000
 #define ACPI_TOOLS                  0x00002000
+#define ACPI_EXAMPLE                0x00004000
+#define ACPI_DRIVER                 0x00008000
 
-#define ACPI_ALL_COMPONENTS         0x00003FFF
+#define ACPI_ALL_COMPONENTS         0x0000FFFF
 #define ACPI_COMPONENT_DEFAULT      (ACPI_ALL_COMPONENTS)
 
 /* Component IDs reserved for ACPI drivers */
@@ -152,7 +153,7 @@
 
 
 /*
- * Raw debug output levels, do not use these in the DEBUG_PRINT macros
+ * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros
  */
 #define ACPI_LV_INIT                0x00000001
 #define ACPI_LV_DEBUG_OBJECT        0x00000002
@@ -245,7 +246,6 @@
 
 #define ACPI_DB_ALL                 ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
 
-
 /* Defaults for DebugLevel, debug and normal */
 
 #define ACPI_DEBUG_DEFAULT          (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
@@ -253,4 +253,97 @@
 #define ACPI_DEBUG_ALL              (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
 
+#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
+/*
+ * Module name is included in both debug and non-debug versions primarily for
+ * error messages. The __FILE__ macro is not very useful for this, because it
+ * often includes the entire pathname to the module
+ */
+#define ACPI_MODULE_NAME(Name)          static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name;
+#else
+#define ACPI_MODULE_NAME(Name)
+#endif
+
+/*
+ * Ascii error messages can be configured out
+ */
+#ifndef ACPI_NO_ERROR_MESSAGES
+#define AE_INFO                         _AcpiModuleName, __LINE__
+
+/*
+ * Error reporting. Callers module and line number are inserted by AE_INFO,
+ * the plist contains a set of parens to allow variable-length lists.
+ * These macros are used for both the debug and non-debug versions of the code.
+ */
+#define ACPI_INFO(plist)                AcpiInfo plist
+#define ACPI_WARNING(plist)             AcpiWarning plist
+#define ACPI_EXCEPTION(plist)           AcpiException plist
+#define ACPI_ERROR(plist)               AcpiError plist
+
+#else
+
+/* No error messages */
+
+#define ACPI_INFO(plist)
+#define ACPI_WARNING(plist)
+#define ACPI_EXCEPTION(plist)
+#define ACPI_ERROR(plist)
+
+#endif /* ACPI_NO_ERROR_MESSAGES */
+
+
+/*
+ * Debug macros that are conditionally compiled
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+
+/*
+ * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
+ * define it now. This is the case where there the compiler does not support
+ * a __FUNCTION__ macro or equivalent.
+ */
+#ifndef ACPI_GET_FUNCTION_NAME
+#define ACPI_GET_FUNCTION_NAME          _AcpiFunctionName
+
+/*
+ * The Name parameter should be the procedure name as a quoted string.
+ * The function name is also used by the function exit macros below.
+ * Note: (const char) is used to be compatible with the debug interfaces
+ * and macros such as __FUNCTION__.
+ */
+#define ACPI_FUNCTION_NAME(Name)        static const char _AcpiFunctionName[] = #Name;
+
+#else
+/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
+
+#define ACPI_FUNCTION_NAME(Name)
+#endif /* ACPI_GET_FUNCTION_NAME */
+
+/*
+ * Common parameters used for debug output functions:
+ * line number, function name, module(file) name, component ID
+ */
+#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT
+
+/*
+ * Master debug print macros
+ * Print message if and only if:
+ *    1) Debug print for the current component is enabled
+ *    2) Debug error level or trace level for the print statement is enabled
+ */
+#define ACPI_DEBUG_PRINT(plist)         AcpiDebugPrint plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     AcpiDebugPrintRaw plist
+
+#else
+/*
+ * This is the non-debug case -- make everything go away,
+ * leaving no executable debug code!
+ */
+#define ACPI_FUNCTION_NAME(a)
+#define ACPI_DEBUG_PRINT(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)
+
+#endif /* ACPI_DEBUG_OUTPUT */
+
+
 #endif /* __ACOUTPUT_H__ */
--- a/usr/src/uts/intel/sys/acpi/acparser.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acparser.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- *       $Revision: 1.84 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/acpi.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acpi.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
- * Name: acpi.h - Master include file, Publics and external data.
- *       $Revision: 1.62 $
+ * Name: acpi.h - Master public include file used to interface to ACPICA
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,26 +117,22 @@
 #define __ACPI_H__
 
 /*
- * Common includes for all ACPI driver files
- * We put them here because we don't want to duplicate them
- * in the rest of the source code again and again.
+ * Public include files for use by code that will interface to ACPICA.
+ *
+ * Information includes the ACPICA data types, names, exceptions, and
+ * external interface prototypes. Also included are the definitions for
+ * all ACPI tables (FADT, MADT, etc.)
+ *
+ * Note: The order of these include files is important.
  */
-#include "acnames.h"            /* Global ACPI names and strings */
-#include "acconfig.h"           /* Configuration constants */
-#include "platform/acenv.h"     /* Target environment specific items */
-#include "actypes.h"            /* Fundamental common data types */
-#include "acexcep.h"            /* ACPI exception codes */
-#include "acmacros.h"           /* C macros */
+#include "platform/acenv.h"     /* Environment-specific items */
+#include "acnames.h"            /* Common ACPI names and strings */
+#include "actypes.h"            /* ACPICA data types and structures */
+#include "acexcep.h"            /* ACPICA exceptions */
 #include "actbl.h"              /* ACPI table definitions */
-#include "aclocal.h"            /* Internal data types */
 #include "acoutput.h"           /* Error output and Debug macros */
-#include "acpiosxf.h"           /* Interfaces to the ACPI-to-OS layer*/
+#include "acrestyp.h"           /* Resource Descriptor structs */
+#include "acpiosxf.h"           /* OSL interfaces (ACPICA-to-OS) */
 #include "acpixf.h"             /* ACPI core subsystem external interfaces */
-#include "acobject.h"           /* ACPI internal object */
-#include "acstruct.h"           /* Common structures */
-#include "acglobal.h"           /* All global variables */
-#include "achware.h"            /* Hardware defines and interfaces */
-#include "acutils.h"            /* Utility interfaces */
-
 
 #endif /* __ACPI_H__ */
--- a/usr/src/uts/intel/sys/acpi/acpiosxf.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acpiosxf.h	Fri Jun 26 17:26:34 2009 -0700
@@ -12,7 +12,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -233,8 +233,11 @@
 
 
 /*
- * Mutex primitives
+ * Mutex primitives. May be configured to use semaphores instead via
+ * ACPI_MUTEX_TYPE (see platform/acenv.h)
  */
+#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
+
 ACPI_STATUS
 AcpiOsCreateMutex (
     ACPI_MUTEX              *OutHandle);
@@ -251,13 +254,7 @@
 void
 AcpiOsReleaseMutex (
     ACPI_MUTEX              Handle);
-
-/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
-
-#define AcpiOsCreateMutex(OutHandle)        AcpiOsCreateSemaphore (1, 1, OutHandle)
-#define AcpiOsDeleteMutex(Handle)           (void) AcpiOsDeleteSemaphore (Handle)
-#define AcpiOsAcquireMutex(Handle,Time)     AcpiOsWaitSemaphore (Handle, 1, Time)
-#define AcpiOsReleaseMutex(Handle)          (void) AcpiOsSignalSemaphore (Handle, 1)
+#endif
 
 
 /*
@@ -425,12 +422,6 @@
 AcpiOsValidateInterface (
     char                    *Interface);
 
-ACPI_STATUS
-AcpiOsValidateAddress (
-    UINT8                   SpaceId,
-    ACPI_PHYSICAL_ADDRESS   Address,
-    ACPI_SIZE               Length);
-
 BOOLEAN
 AcpiOsReadable (
     void                    *Pointer,
--- a/usr/src/uts/intel/sys/acpi/acpixf.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acpixf.h	Fri Jun 26 17:26:34 2009 -0700
@@ -9,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -118,9 +118,30 @@
 #ifndef __ACXFACE_H__
 #define __ACXFACE_H__
 
+/* Current ACPICA subsystem version in YYYYMMDD format */
+
+#define ACPI_CA_VERSION                 0x20090521
+
 #include "actypes.h"
 #include "actbl.h"
 
+/*
+ * Globals that are publically available
+ */
+extern UINT32               AcpiCurrentGpeCount;
+extern ACPI_TABLE_FADT      AcpiGbl_FADT;
+
+/* Run-time configuration */
+
+extern UINT32               AcpiDbgLevel;
+extern UINT32               AcpiDbgLayer;
+extern UINT8                AcpiGbl_EnableInterpreterSlack;
+extern UINT8                AcpiGbl_AllMethodsSerialized;
+extern UINT8                AcpiGbl_CreateOsiMethod;
+extern UINT8                AcpiGbl_LeaveWakeGpesDisabled;
+extern ACPI_NAME            AcpiGbl_TraceMethodName;
+extern UINT32               AcpiGbl_TraceFlags;
+
 
 /*
  * Global interfaces
@@ -175,10 +196,6 @@
 AcpiPurgeCachedObjects (
     void);
 
-ACPI_STATUS
-AcpiInstallInitializationHandler (
-    ACPI_INIT_HANDLER       Handler,
-    UINT32                  Function);
 
 /*
  * ACPI Memory managment
@@ -318,6 +335,10 @@
     ACPI_BUFFER             *ReturnBuffer);
 
 ACPI_STATUS
+AcpiInstallMethod (
+    UINT8                   *Buffer);
+
+ACPI_STATUS
 AcpiGetNextObject (
     ACPI_OBJECT_TYPE        Type,
     ACPI_HANDLE             Parent,
@@ -336,9 +357,14 @@
 
 
 /*
- * Event handler interfaces
+ * Handler interfaces
  */
 ACPI_STATUS
+AcpiInstallInitializationHandler (
+    ACPI_INIT_HANDLER       Handler,
+    UINT32                  Function);
+
+ACPI_STATUS
 AcpiInstallFixedEventHandler (
     UINT32                  AcpiEvent,
     ACPI_EVENT_HANDLER      Handler,
@@ -385,6 +411,12 @@
     void                    *Context);
 
 ACPI_STATUS
+AcpiRemoveGpeHandler (
+    ACPI_HANDLE             GpeDevice,
+    UINT32                  GpeNumber,
+    ACPI_EVENT_HANDLER      Address);
+
+ACPI_STATUS
 AcpiInstallExceptionHandler (
     ACPI_EXCEPTION_HANDLER  Handler);
 
@@ -402,12 +434,6 @@
     UINT32                  Handle);
 
 ACPI_STATUS
-AcpiRemoveGpeHandler (
-    ACPI_HANDLE             GpeDevice,
-    UINT32                  GpeNumber,
-    ACPI_EVENT_HANDLER      Address);
-
-ACPI_STATUS
 AcpiEnableEvent (
     UINT32                  Event,
     UINT32                  Flags);
@@ -426,6 +452,10 @@
     UINT32                  Event,
     ACPI_EVENT_STATUS       *EventStatus);
 
+
+/*
+ * GPE Interfaces
+ */
 ACPI_STATUS
 AcpiSetGpeType (
     ACPI_HANDLE             GpeDevice,
@@ -458,6 +488,19 @@
     ACPI_EVENT_STATUS       *EventStatus);
 
 ACPI_STATUS
+AcpiDisableAllGpes (
+    void);
+
+ACPI_STATUS
+AcpiEnableAllRuntimeGpes (
+    void);
+
+ACPI_STATUS
+AcpiGetGpeDevice (
+    UINT32                  GpeIndex,
+    ACPI_HANDLE             *GpeDevice);
+
+ACPI_STATUS
 AcpiInstallGpeBlock (
     ACPI_HANDLE             GpeDevice,
     ACPI_GENERIC_ADDRESS    *GpeBlockAddress,
@@ -516,33 +559,35 @@
     ACPI_RESOURCE           *Resource,
     ACPI_RESOURCE_ADDRESS64 *Out);
 
+
 /*
  * Hardware (ACPI device) interfaces
  */
 ACPI_STATUS
-AcpiGetRegister (
+AcpiReset (
+    void);
+
+ACPI_STATUS
+AcpiRead (
+    UINT32                  *Value,
+    ACPI_GENERIC_ADDRESS    *Reg);
+
+ACPI_STATUS
+AcpiWrite (
+    UINT32                  Value,
+    ACPI_GENERIC_ADDRESS    *Reg);
+
+ACPI_STATUS
+AcpiReadBitRegister (
     UINT32                  RegisterId,
     UINT32                  *ReturnValue);
 
 ACPI_STATUS
-AcpiGetRegisterUnlocked (
-    UINT32                  RegisterId,
-    UINT32                  *ReturnValue);
-
-ACPI_STATUS
-AcpiSetRegister (
+AcpiWriteBitRegister (
     UINT32                  RegisterId,
     UINT32                  Value);
 
 ACPI_STATUS
-AcpiSetFirmwareWakingVector (
-    ACPI_PHYSICAL_ADDRESS   PhysicalAddress);
-
-ACPI_STATUS
-AcpiGetFirmwareWakingVector (
-    ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
-
-ACPI_STATUS
 AcpiGetSleepTypeData (
     UINT8                   SleepState,
     UINT8                   *Slp_TypA,
@@ -562,7 +607,76 @@
 
 ACPI_STATUS
 AcpiLeaveSleepState (
-    UINT8                   SleepState);
+    UINT8                   SleepState)
+    ;
+ACPI_STATUS
+AcpiSetFirmwareWakingVector (
+    UINT32                  PhysicalAddress);
+
+#if ACPI_MACHINE_WIDTH == 64
+ACPI_STATUS
+AcpiSetFirmwareWakingVector64 (
+    UINT64                  PhysicalAddress);
+#endif
 
 
+/*
+ * Error/Warning output
+ */
+void ACPI_INTERNAL_VAR_XFACE
+AcpiError (
+    const char              *ModuleName,
+    UINT32                  LineNumber,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(3);
+
+void  ACPI_INTERNAL_VAR_XFACE
+AcpiException (
+    const char              *ModuleName,
+    UINT32                  LineNumber,
+    ACPI_STATUS             Status,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(4);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiWarning (
+    const char              *ModuleName,
+    UINT32                  LineNumber,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiInfo (
+    const char              *ModuleName,
+    UINT32                  LineNumber,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(3);
+
+
+/*
+ * Debug output
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiDebugPrint (
+    UINT32                  RequestedDebugLevel,
+    UINT32                  LineNumber,
+    const char              *FunctionName,
+    const char              *ModuleName,
+    UINT32                  ComponentId,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(6);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiDebugPrintRaw (
+    UINT32                  RequestedDebugLevel,
+    UINT32                  LineNumber,
+    const char              *FunctionName,
+    const char              *ModuleName,
+    UINT32                  ComponentId,
+    const char              *Format,
+    ...) ACPI_PRINTF_LIKE(6);
+#endif
+
 #endif /* __ACXFACE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/sys/acpi/acpredef.h	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,534 @@
+/******************************************************************************
+ *
+ * Name: acpredef - Information table for ACPI predefined methods and objects
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACPREDEF_H__
+#define __ACPREDEF_H__
+
+
+/******************************************************************************
+ *
+ * Return Package types
+ *
+ * 1) PTYPE1 packages do not contain sub-packages.
+ *
+ * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types:
+ *      object type
+ *      count
+ *      object type
+ *      count
+ *
+ * ACPI_PTYPE1_VAR: Variable-length length:
+ *      object type (Int/Buf/Ref)
+ *
+ * ACPI_PTYPE1_OPTION: Package has some required and some optional elements
+ *      (Used for _PRW)
+ *
+ *
+ * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each of the
+ *    different types describe the contents of each of the sub-packages.
+ *
+ * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
+ *      object type
+ *      count
+ *      object type
+ *      count
+ *      (Used for _ALR,_MLS,_PSS,_TRT,_TSS)
+ *
+ * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
+ *      object type
+ *      (Used for _CSD,_PSD,_TSD)
+ *
+ * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
+ *      object type
+ *      count
+ *      object type
+ *      count
+ *      (Used for _CST)
+ *
+ * ACPI_PTYPE2_Fixed-length: Each subpackage is of Fixed-length length
+ *      (Used for _PRT)
+ *
+ * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length
+ *      (Used for _HPX)
+ *
+ *****************************************************************************/
+
+enum AcpiReturnPackageTypes
+{
+    ACPI_PTYPE1_FIXED       = 1,
+    ACPI_PTYPE1_VAR         = 2,
+    ACPI_PTYPE1_OPTION      = 3,
+    ACPI_PTYPE2             = 4,
+    ACPI_PTYPE2_COUNT       = 5,
+    ACPI_PTYPE2_PKG_COUNT   = 6,
+    ACPI_PTYPE2_FIXED       = 7,
+    ACPI_PTYPE2_MIN         = 8
+};
+
+
+/*
+ * Predefined method/object information table.
+ *
+ * These are the names that can actually be evaluated via AcpiEvaluateObject.
+ * Not present in this table are the following:
+ *
+ *      1) Predefined/Reserved names that are never evaluated via
+ *         AcpiEvaluateObject:
+ *              _Lxx and _Exx GPE methods
+ *              _Qxx EC methods
+ *              _T_x compiler temporary Variable-lengths
+ *
+ *      2) Predefined names that never actually exist within the AML code:
+ *              Predefined resource descriptor field names
+ *
+ *      3) Predefined names that are implemented within ACPICA:
+ *              _OSI
+ *
+ *      4) Some predefined names that are not documented within the ACPI spec.
+ *              _WDG, _WED
+ *
+ * The main entries in the table each contain the following items:
+ *
+ * Name                 - The ACPI reserved name
+ * ParamCount           - Number of arguments to the method
+ * ExpectedBtypes       - Allowed type(s) for the return value.
+ *                        0 means that no return value is expected.
+ *
+ * For methods that return packages, the next entry in the table contains
+ * information about the expected structure of the package. This information
+ * is saved here (rather than in a separate table) in order to minimize the
+ * overall size of the stored data.
+ *
+ * Note: The additional braces are intended to promote portability.
+ */
+static const ACPI_PREDEFINED_INFO     PredefinedNames[] =
+{
+    {{"_AC0", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC1", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC2", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC3", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC4", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC5", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC6", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC7", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC8", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AC9", 0, ACPI_RTYPE_INTEGER}},
+    {{"_ADR", 0, ACPI_RTYPE_INTEGER}},
+    {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_ALC", 0, ACPI_RTYPE_INTEGER}},
+    {{"_ALI", 0, ACPI_RTYPE_INTEGER}},
+    {{"_ALP", 0, ACPI_RTYPE_INTEGER}},
+    {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */
+                    {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}},
+
+    {{"_ALT", 0, ACPI_RTYPE_INTEGER}},
+    {{"_BBN", 0, ACPI_RTYPE_INTEGER}},
+    {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+    {{"_BCM", 1, 0}},
+    {{"_BDN", 0, ACPI_RTYPE_INTEGER}},
+    {{"_BFS", 1, 0}},
+    {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}},
+
+    {{"_BLT", 3, 0}},
+    {{"_BMC", 1, 0}},
+    {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+    {{"_BQC", 0, ACPI_RTYPE_INTEGER}},
+    {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
+
+    {{"_BTM", 1, ACPI_RTYPE_INTEGER}},
+    {{"_BTP", 1, 0}},
+    {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */
+    {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}},
+
+    {{"_CRS", 0, ACPI_RTYPE_BUFFER}},
+    {{"_CRT", 0, ACPI_RTYPE_INTEGER}},
+    {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */
+                    {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+    {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
+                    {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}},
+
+    {{"_DCK", 1, ACPI_RTYPE_INTEGER}},
+    {{"_DCS", 0, ACPI_RTYPE_INTEGER}},
+    {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
+    {{"_DDN", 0, ACPI_RTYPE_STRING}},
+    {{"_DGS", 0, ACPI_RTYPE_INTEGER}},
+    {{"_DIS", 0, 0}},
+    {{"_DMA", 0, ACPI_RTYPE_BUFFER}},
+    {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+    {{"_DOS", 1, 0}},
+    {{"_DSM", 4, ACPI_RTYPE_ALL}},     /* Must return a type, but it can be of any type */
+    {{"_DSS", 1, 0}},
+    {{"_DSW", 3, 0}},
+    {{"_EC_", 0, ACPI_RTYPE_INTEGER}},
+    {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_EJ0", 1, 0}},
+    {{"_EJ1", 1, 0}},
+    {{"_EJ2", 1, 0}},
+    {{"_EJ3", 1, 0}},
+    {{"_EJ4", 1, 0}},
+    {{"_EJD", 0, ACPI_RTYPE_STRING}},
+    {{"_FDE", 0, ACPI_RTYPE_BUFFER}},
+    {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}},
+
+    {{"_FDM", 1, 0}},
+    {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+    {{"_GLK", 0, ACPI_RTYPE_INTEGER}},
+    {{"_GPD", 0, ACPI_RTYPE_INTEGER}},
+    {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
+    {{"_GSB", 0, ACPI_RTYPE_INTEGER}},
+    {{"_GTF", 0, ACPI_RTYPE_BUFFER}},
+    {{"_GTM", 0, ACPI_RTYPE_BUFFER}},
+    {{"_GTS", 1, 0}},
+    {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+    {{"_HOT", 0, ACPI_RTYPE_INTEGER}},
+    {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
+
+    /*
+     * For _HPX, a single package is returned, containing a Variable-length number
+     * of sub-packages. Each sub-package contains a PCI record setting.
+     * There are several different type of record settings, of different
+     * lengths, but all elements of all settings are Integers.
+     */
+    {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */
+                    {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+    {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
+    {{"_INI", 0, 0}},
+    {{"_IRC", 0, 0}},
+    {{"_LCK", 1, 0}},
+    {{"_LID", 0, ACPI_RTYPE_INTEGER}},
+    {{"_MAT", 0, ACPI_RTYPE_BUFFER}},
+    {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */
+                    {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}},
+
+    {{"_MSG", 1, 0}},
+    {{"_OFF", 0, 0}},
+    {{"_ON_", 0, 0}},
+    {{"_OS_", 0, ACPI_RTYPE_STRING}},
+    {{"_OSC", 4, ACPI_RTYPE_BUFFER}},
+    {{"_OST", 3, 0}},
+    {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
+
+    {{"_PDC", 1, 0}},
+    {{"_PIC", 1, 0}},
+    {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}},
+
+    {{"_PPC", 0, ACPI_RTYPE_INTEGER}},
+    {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */
+    {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_PRS", 0, ACPI_RTYPE_BUFFER}},
+
+    /*
+     * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
+     * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
+     * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
+     * type to the 2nd element (index 1) in the statement below.
+     */
+    {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */
+                    {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER},
+                    ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE,ACPI_RTYPE_INTEGER}},
+
+    {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */
+                    {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE,
+                    ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}},
+
+    {{"_PS0", 0, 0}},
+    {{"_PS1", 0, 0}},
+    {{"_PS2", 0, 0}},
+    {{"_PS3", 0, 0}},
+    {{"_PSC", 0, ACPI_RTYPE_INTEGER}},
+    {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */
+                    {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}},
+
+    {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_PSR", 0, ACPI_RTYPE_INTEGER}},
+    {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */
+                    {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}},
+
+    {{"_PSV", 0, ACPI_RTYPE_INTEGER}},
+    {{"_PSW", 1, 0}},
+    {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
+
+    {{"_PTS", 1, 0}},
+    {{"_PXM", 0, ACPI_RTYPE_INTEGER}},
+    {{"_REG", 2, 0}},
+    {{"_REV", 0, ACPI_RTYPE_INTEGER}},
+    {{"_RMV", 0, ACPI_RTYPE_INTEGER}},
+    {{"_ROM", 2, ACPI_RTYPE_BUFFER}},
+    {{"_RTV", 0, ACPI_RTYPE_INTEGER}},
+
+    /*
+     * For _S0_ through _S5_, the ACPI spec defines a return Package
+     * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers.
+     * Allow this by making the objects "Variable-length length", but all elements
+     * must be Integers.
+     */
+    {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+    {{"_S1D", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S2D", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S3D", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S4D", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S0W", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S1W", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S2W", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S3W", 0, ACPI_RTYPE_INTEGER}},
+    {{"_S4W", 0, ACPI_RTYPE_INTEGER}},
+    {{"_SBS", 0, ACPI_RTYPE_INTEGER}},
+    {{"_SCP", 0x13, 0}},               /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
+                                       /* Note: the 3-arg definition may be removed for ACPI 4.0 */
+    {{"_SDD", 1, 0}},
+    {{"_SEG", 0, ACPI_RTYPE_INTEGER}},
+    {{"_SLI", 0, ACPI_RTYPE_BUFFER}},
+    {{"_SPD", 1, ACPI_RTYPE_INTEGER}},
+    {{"_SRS", 1, 0}},
+    {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
+    {{"_SST", 1, 0}},
+    {{"_STA", 0, ACPI_RTYPE_INTEGER}},
+    {{"_STM", 3, 0}},
+    {{"_STR", 0, ACPI_RTYPE_BUFFER}},
+    {{"_SUN", 0, ACPI_RTYPE_INTEGER}},
+    {{"_SWS", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TC1", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TC2", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TMP", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TPC", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TPT", 1, 0}},
+    {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2Ref/6Int */
+                    {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}},
+
+    {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int with count */
+                    {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+    {{"_TSP", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int */
+                    {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+    {{"_TST", 0, ACPI_RTYPE_INTEGER}},
+    {{"_TTS", 1, 0}},
+    {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                    {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+    {{"_TZM", 0, ACPI_RTYPE_REFERENCE}},
+    {{"_TZP", 0, ACPI_RTYPE_INTEGER}},
+    {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+    {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
+
+    {{"_UPD", 0, ACPI_RTYPE_INTEGER}},
+    {{"_UPP", 0, ACPI_RTYPE_INTEGER}},
+    {{"_VPO", 0, ACPI_RTYPE_INTEGER}},
+
+    /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
+
+    {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
+                    {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
+
+    {{{0,0,0,0}, 0,0}} /* Table terminator */
+};
+
+#if 0
+    /* Not implemented */
+
+    {{"_WDG", 0, ACPI_RTYPE_BUFFER}},  /* MS Extension */
+    {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
+
+    /* This is an internally implemented control method, no need to check */
+    {{"_OSI", 1, ACPI_RTYPE_INTEGER}},
+
+    /* TBD: */
+
+    _PRT - currently ignore reversed entries. Attempt to fix here?
+    Think about possibly fixing package elements like _BIF, etc.
+#endif
+
+#endif
--- a/usr/src/uts/intel/sys/acpi/acresrc.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acresrc.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acresrc.h - Resource Manager function prototypes
- *       $Revision: 1.62 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/sys/acpi/acrestyp.h	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,544 @@
+/******************************************************************************
+ *
+ * Name: acrestyp.h - Defines, types, and structures for resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACRESTYP_H__
+#define __ACRESTYP_H__
+
+
+/*
+ * Definitions for Resource Attributes
+ */
+typedef UINT16                          ACPI_RS_LENGTH;    /* Resource Length field is fixed at 16 bits */
+typedef UINT32                          ACPI_RSDESC_SIZE;  /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
+
+/*
+ * Memory Attributes
+ */
+#define ACPI_READ_ONLY_MEMORY           (UINT8) 0x00
+#define ACPI_READ_WRITE_MEMORY          (UINT8) 0x01
+
+#define ACPI_NON_CACHEABLE_MEMORY       (UINT8) 0x00
+#define ACPI_CACHABLE_MEMORY            (UINT8) 0x01
+#define ACPI_WRITE_COMBINING_MEMORY     (UINT8) 0x02
+#define ACPI_PREFETCHABLE_MEMORY        (UINT8) 0x03
+
+/*
+ * IO Attributes
+ * The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
+ * The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
+ */
+#define ACPI_NON_ISA_ONLY_RANGES        (UINT8) 0x01
+#define ACPI_ISA_ONLY_RANGES            (UINT8) 0x02
+#define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
+
+/* Type of translation - 1=Sparse, 0=Dense */
+
+#define ACPI_SPARSE_TRANSLATION         (UINT8) 0x01
+
+/*
+ * IO Port Descriptor Decode
+ */
+#define ACPI_DECODE_10                  (UINT8) 0x00    /* 10-bit IO address decode */
+#define ACPI_DECODE_16                  (UINT8) 0x01    /* 16-bit IO address decode */
+
+/*
+ * IRQ Attributes
+ */
+#define ACPI_LEVEL_SENSITIVE            (UINT8) 0x00
+#define ACPI_EDGE_SENSITIVE             (UINT8) 0x01
+
+#define ACPI_ACTIVE_HIGH                (UINT8) 0x00
+#define ACPI_ACTIVE_LOW                 (UINT8) 0x01
+
+#define ACPI_EXCLUSIVE                  (UINT8) 0x00
+#define ACPI_SHARED                     (UINT8) 0x01
+
+/*
+ * DMA Attributes
+ */
+#define ACPI_COMPATIBILITY              (UINT8) 0x00
+#define ACPI_TYPE_A                     (UINT8) 0x01
+#define ACPI_TYPE_B                     (UINT8) 0x02
+#define ACPI_TYPE_F                     (UINT8) 0x03
+
+#define ACPI_NOT_BUS_MASTER             (UINT8) 0x00
+#define ACPI_BUS_MASTER                 (UINT8) 0x01
+
+#define ACPI_TRANSFER_8                 (UINT8) 0x00
+#define ACPI_TRANSFER_8_16              (UINT8) 0x01
+#define ACPI_TRANSFER_16                (UINT8) 0x02
+
+/*
+ * Start Dependent Functions Priority definitions
+ */
+#define ACPI_GOOD_CONFIGURATION         (UINT8) 0x00
+#define ACPI_ACCEPTABLE_CONFIGURATION   (UINT8) 0x01
+#define ACPI_SUB_OPTIMAL_CONFIGURATION  (UINT8) 0x02
+
+/*
+ * 16, 32 and 64-bit Address Descriptor resource types
+ */
+#define ACPI_MEMORY_RANGE               (UINT8) 0x00
+#define ACPI_IO_RANGE                   (UINT8) 0x01
+#define ACPI_BUS_NUMBER_RANGE           (UINT8) 0x02
+
+#define ACPI_ADDRESS_NOT_FIXED          (UINT8) 0x00
+#define ACPI_ADDRESS_FIXED              (UINT8) 0x01
+
+#define ACPI_POS_DECODE                 (UINT8) 0x00
+#define ACPI_SUB_DECODE                 (UINT8) 0x01
+
+#define ACPI_PRODUCER                   (UINT8) 0x00
+#define ACPI_CONSUMER                   (UINT8) 0x01
+
+
+/*
+ * If possible, pack the following structures to byte alignment
+ */
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#pragma pack(1)
+#endif
+
+/* UUID data structures for use in vendor-defined resource descriptors */
+
+typedef struct acpi_uuid
+{
+    UINT8                           Data[ACPI_UUID_LENGTH];
+} ACPI_UUID;
+
+typedef struct acpi_vendor_uuid
+{
+    UINT8                           Subtype;
+    UINT8                           Data[ACPI_UUID_LENGTH];
+
+} ACPI_VENDOR_UUID;
+
+/*
+ * Structures used to describe device resources
+ */
+typedef struct acpi_resource_irq
+{
+    UINT8                           DescriptorLength;
+    UINT8                           Triggering;
+    UINT8                           Polarity;
+    UINT8                           Sharable;
+    UINT8                           InterruptCount;
+    UINT8                           Interrupts[1];
+
+} ACPI_RESOURCE_IRQ;
+
+typedef struct ACPI_RESOURCE_DMA
+{
+    UINT8                           Type;
+    UINT8                           BusMaster;
+    UINT8                           Transfer;
+    UINT8                           ChannelCount;
+    UINT8                           Channels[1];
+
+} ACPI_RESOURCE_DMA;
+
+typedef struct acpi_resource_start_dependent
+{
+    UINT8                           DescriptorLength;
+    UINT8                           CompatibilityPriority;
+    UINT8                           PerformanceRobustness;
+
+} ACPI_RESOURCE_START_DEPENDENT;
+
+
+/*
+ * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
+ * needed because it has no fields
+ */
+
+
+typedef struct acpi_resource_io
+{
+    UINT8                           IoDecode;
+    UINT8                           Alignment;
+    UINT8                           AddressLength;
+    UINT16                          Minimum;
+    UINT16                          Maximum;
+
+} ACPI_RESOURCE_IO;
+
+typedef struct acpi_resource_fixed_io
+{
+    UINT16                          Address;
+    UINT8                           AddressLength;
+
+} ACPI_RESOURCE_FIXED_IO;
+
+typedef struct acpi_resource_vendor
+{
+    UINT16                          ByteLength;
+    UINT8                           ByteData[1];
+
+} ACPI_RESOURCE_VENDOR;
+
+/* Vendor resource with UUID info (introduced in ACPI 3.0) */
+
+typedef struct acpi_resource_vendor_typed
+{
+    UINT16                          ByteLength;
+    UINT8                           UuidSubtype;
+    UINT8                           Uuid[ACPI_UUID_LENGTH];
+    UINT8                           ByteData[1];
+
+} ACPI_RESOURCE_VENDOR_TYPED;
+
+typedef struct acpi_resource_end_tag
+{
+    UINT8                           Checksum;
+
+} ACPI_RESOURCE_END_TAG;
+
+typedef struct acpi_resource_memory24
+{
+    UINT8                           WriteProtect;
+    UINT16                          Minimum;
+    UINT16                          Maximum;
+    UINT16                          Alignment;
+    UINT16                          AddressLength;
+
+} ACPI_RESOURCE_MEMORY24;
+
+typedef struct acpi_resource_memory32
+{
+    UINT8                           WriteProtect;
+    UINT32                          Minimum;
+    UINT32                          Maximum;
+    UINT32                          Alignment;
+    UINT32                          AddressLength;
+
+} ACPI_RESOURCE_MEMORY32;
+
+typedef struct acpi_resource_fixed_memory32
+{
+    UINT8                           WriteProtect;
+    UINT32                          Address;
+    UINT32                          AddressLength;
+
+} ACPI_RESOURCE_FIXED_MEMORY32;
+
+typedef struct acpi_memory_attribute
+{
+    UINT8                           WriteProtect;
+    UINT8                           Caching;
+    UINT8                           RangeType;
+    UINT8                           Translation;
+
+} ACPI_MEMORY_ATTRIBUTE;
+
+typedef struct acpi_io_attribute
+{
+    UINT8                           RangeType;
+    UINT8                           Translation;
+    UINT8                           TranslationType;
+    UINT8                           Reserved1;
+
+} ACPI_IO_ATTRIBUTE;
+
+typedef union acpi_resource_attribute
+{
+    ACPI_MEMORY_ATTRIBUTE           Mem;
+    ACPI_IO_ATTRIBUTE               Io;
+
+    /* Used for the *WordSpace macros */
+
+    UINT8                           TypeSpecific;
+
+} ACPI_RESOURCE_ATTRIBUTE;
+
+typedef struct acpi_resource_source
+{
+    UINT8                           Index;
+    UINT16                          StringLength;
+    char                            *StringPtr;
+
+} ACPI_RESOURCE_SOURCE;
+
+/* Fields common to all address descriptors, 16/32/64 bit */
+
+#define ACPI_RESOURCE_ADDRESS_COMMON \
+    UINT8                           ResourceType; \
+    UINT8                           ProducerConsumer; \
+    UINT8                           Decode; \
+    UINT8                           MinAddressFixed; \
+    UINT8                           MaxAddressFixed; \
+    ACPI_RESOURCE_ATTRIBUTE         Info;
+
+typedef struct acpi_resource_address
+{
+    ACPI_RESOURCE_ADDRESS_COMMON
+
+} ACPI_RESOURCE_ADDRESS;
+
+typedef struct acpi_resource_address16
+{
+    ACPI_RESOURCE_ADDRESS_COMMON
+    UINT16                          Granularity;
+    UINT16                          Minimum;
+    UINT16                          Maximum;
+    UINT16                          TranslationOffset;
+    UINT16                          AddressLength;
+    ACPI_RESOURCE_SOURCE            ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS16;
+
+typedef struct acpi_resource_address32
+{
+    ACPI_RESOURCE_ADDRESS_COMMON
+    UINT32                          Granularity;
+    UINT32                          Minimum;
+    UINT32                          Maximum;
+    UINT32                          TranslationOffset;
+    UINT32                          AddressLength;
+    ACPI_RESOURCE_SOURCE            ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS32;
+
+typedef struct acpi_resource_address64
+{
+    ACPI_RESOURCE_ADDRESS_COMMON
+    UINT64                          Granularity;
+    UINT64                          Minimum;
+    UINT64                          Maximum;
+    UINT64                          TranslationOffset;
+    UINT64                          AddressLength;
+    ACPI_RESOURCE_SOURCE            ResourceSource;
+
+} ACPI_RESOURCE_ADDRESS64;
+
+typedef struct acpi_resource_extended_address64
+{
+    ACPI_RESOURCE_ADDRESS_COMMON
+    UINT8                           RevisionID;
+    UINT64                          Granularity;
+    UINT64                          Minimum;
+    UINT64                          Maximum;
+    UINT64                          TranslationOffset;
+    UINT64                          AddressLength;
+    UINT64                          TypeSpecific;
+
+} ACPI_RESOURCE_EXTENDED_ADDRESS64;
+
+typedef struct acpi_resource_extended_irq
+{
+    UINT8                           ProducerConsumer;
+    UINT8                           Triggering;
+    UINT8                           Polarity;
+    UINT8                           Sharable;
+    UINT8                           InterruptCount;
+    ACPI_RESOURCE_SOURCE            ResourceSource;
+    UINT32                          Interrupts[1];
+
+} ACPI_RESOURCE_EXTENDED_IRQ;
+
+typedef struct acpi_resource_generic_register
+{
+    UINT8                           SpaceId;
+    UINT8                           BitWidth;
+    UINT8                           BitOffset;
+    UINT8                           AccessSize;
+    UINT64                          Address;
+
+} ACPI_RESOURCE_GENERIC_REGISTER;
+
+
+/* ACPI_RESOURCE_TYPEs */
+
+#define ACPI_RESOURCE_TYPE_IRQ                  0
+#define ACPI_RESOURCE_TYPE_DMA                  1
+#define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
+#define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
+#define ACPI_RESOURCE_TYPE_IO                   4
+#define ACPI_RESOURCE_TYPE_FIXED_IO             5
+#define ACPI_RESOURCE_TYPE_VENDOR               6
+#define ACPI_RESOURCE_TYPE_END_TAG              7
+#define ACPI_RESOURCE_TYPE_MEMORY24             8
+#define ACPI_RESOURCE_TYPE_MEMORY32             9
+#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
+#define ACPI_RESOURCE_TYPE_ADDRESS16            11
+#define ACPI_RESOURCE_TYPE_ADDRESS32            12
+#define ACPI_RESOURCE_TYPE_ADDRESS64            13
+#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14  /* ACPI 3.0 */
+#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
+#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
+#define ACPI_RESOURCE_TYPE_MAX                  16
+
+/* Master union for resource descriptors */
+
+typedef union acpi_resource_data
+{
+    ACPI_RESOURCE_IRQ                       Irq;
+    ACPI_RESOURCE_DMA                       Dma;
+    ACPI_RESOURCE_START_DEPENDENT           StartDpf;
+    ACPI_RESOURCE_IO                        Io;
+    ACPI_RESOURCE_FIXED_IO                  FixedIo;
+    ACPI_RESOURCE_VENDOR                    Vendor;
+    ACPI_RESOURCE_VENDOR_TYPED              VendorTyped;
+    ACPI_RESOURCE_END_TAG                   EndTag;
+    ACPI_RESOURCE_MEMORY24                  Memory24;
+    ACPI_RESOURCE_MEMORY32                  Memory32;
+    ACPI_RESOURCE_FIXED_MEMORY32            FixedMemory32;
+    ACPI_RESOURCE_ADDRESS16                 Address16;
+    ACPI_RESOURCE_ADDRESS32                 Address32;
+    ACPI_RESOURCE_ADDRESS64                 Address64;
+    ACPI_RESOURCE_EXTENDED_ADDRESS64        ExtAddress64;
+    ACPI_RESOURCE_EXTENDED_IRQ              ExtendedIrq;
+    ACPI_RESOURCE_GENERIC_REGISTER          GenericReg;
+
+    /* Common fields */
+
+    ACPI_RESOURCE_ADDRESS                   Address;        /* Common 16/32/64 address fields */
+
+} ACPI_RESOURCE_DATA;
+
+
+/* Common resource header */
+
+typedef struct acpi_resource
+{
+    UINT32                          Type;
+    UINT32                          Length;
+    ACPI_RESOURCE_DATA              Data;
+
+} ACPI_RESOURCE;
+
+/* restore default alignment */
+
+#pragma pack()
+
+
+#define ACPI_RS_SIZE_NO_DATA                8       /* Id + Length fields */
+#define ACPI_RS_SIZE_MIN                    (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
+#define ACPI_RS_SIZE(Type)                  (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
+
+#define ACPI_NEXT_RESOURCE(Res)             (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
+
+
+typedef struct acpi_pci_routing_table
+{
+    UINT32                          Length;
+    UINT32                          Pin;
+    ACPI_INTEGER                    Address;        /* here for 64-bit alignment */
+    UINT32                          SourceIndex;
+    char                            Source[4];      /* pad to 64 bits so sizeof() works in all cases */
+
+} ACPI_PCI_ROUTING_TABLE;
+
+#endif /* __ACRESTYP_H__ */
+
--- a/usr/src/uts/intel/sys/acpi/acstruct.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acstruct.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acstruct.h - Internal structs
- *       $Revision: 1.50 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/actables.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/actables.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: actables.h - ACPI table management
- *       $Revision: 1.65 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -127,8 +126,7 @@
  */
 void
 AcpiTbParseFadt (
-    UINT32                  TableIndex,
-    UINT8                   Flags);
+    UINT32                  TableIndex);
 
 void
 AcpiTbCreateLocalFadt (
@@ -179,7 +177,7 @@
 AcpiTbTerminate (
     void);
 
-void
+ACPI_STATUS
 AcpiTbDeleteNamespaceByOwner (
     UINT32                  TableIndex);
 
@@ -209,6 +207,10 @@
 /*
  * tbutils - table manager utilities
  */
+ACPI_STATUS
+AcpiTbInitializeFacs (
+    void);
+
 BOOLEAN
 AcpiTbTablesLoaded (
     void);
@@ -231,13 +233,11 @@
 void
 AcpiTbInstallTable (
     ACPI_PHYSICAL_ADDRESS   Address,
-    UINT8                   Flags,
     char                    *Signature,
     UINT32                  TableIndex);
 
 ACPI_STATUS
 AcpiTbParseRootTable (
-    ACPI_PHYSICAL_ADDRESS   RsdpAddress,
-    UINT8                   Flags);
+    ACPI_PHYSICAL_ADDRESS   RsdpAddress);
 
 #endif /* __ACTABLES_H__ */
--- a/usr/src/uts/intel/sys/acpi/actbl.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/actbl.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: actbl.h - Basic ACPI Table Definitions
- *       $Revision: 1.85 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -306,12 +305,12 @@
     UINT16                  C3Latency;          /* Worst case HW latency to enter/exit C3 state */
     UINT16                  FlushSize;          /* Processor's memory cache line width, in bytes */
     UINT16                  FlushStride;        /* Number of flush strides that need to be read */
-    UINT8                   DutyOffset;         /* Processor duty cycle index in processor's P_CNT reg*/
-    UINT8                   DutyWidth;          /* Processor duty cycle value bit width in P_CNT register.*/
+    UINT8                   DutyOffset;         /* Processor duty cycle index in processor's P_CNT reg */
+    UINT8                   DutyWidth;          /* Processor duty cycle value bit width in P_CNT register */
     UINT8                   DayAlarm;           /* Index to day-of-month alarm in RTC CMOS RAM */
     UINT8                   MonthAlarm;         /* Index to month-of-year alarm in RTC CMOS RAM */
     UINT8                   Century;            /* Index to century in RTC CMOS RAM */
-    UINT16                  BootFlags;          /* IA-PC Boot Architecture Flags. See Table 5-10 for description */
+    UINT16                  BootFlags;          /* IA-PC Boot Architecture Flags (see below for individual flags) */
     UINT8                   Reserved;           /* Reserved, must be zero */
     UINT32                  Flags;              /* Miscellaneous flag bits (see below for individual flags) */
     ACPI_GENERIC_ADDRESS    ResetRegister;      /* 64-bit address of the Reset register */
@@ -331,33 +330,40 @@
 } ACPI_TABLE_FADT;
 
 
+/* FADT Boot Architecture Flags (BootFlags) */
+
+#define ACPI_FADT_LEGACY_DEVICES    (1)         /* 00: [V2] System has LPC or ISA bus devices */
+#define ACPI_FADT_8042              (1<<1)      /* 01: [V3] System has an 8042 controller on port 60/64 */
+#define ACPI_FADT_NO_VGA            (1<<2)      /* 02: [V4] It is not safe to probe for VGA hardware */
+#define ACPI_FADT_NO_MSI            (1<<3)      /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
+#define ACPI_FADT_NO_ASPM           (1<<4)      /* 04: [V4] PCIe ASPM control must not be enabled */
+
 /* FADT flags */
 
-#define ACPI_FADT_WBINVD            (1)         /* 00: The wbinvd instruction works properly */
-#define ACPI_FADT_WBINVD_FLUSH      (1<<1)      /* 01: The wbinvd flushes but does not invalidate */
-#define ACPI_FADT_C1_SUPPORTED      (1<<2)      /* 02: All processors support C1 state */
-#define ACPI_FADT_C2_MP_SUPPORTED   (1<<3)      /* 03: C2 state works on MP system */
-#define ACPI_FADT_POWER_BUTTON      (1<<4)      /* 04: Power button is handled as a generic feature */
-#define ACPI_FADT_SLEEP_BUTTON      (1<<5)      /* 05: Sleep button is handled as a generic feature, or  not present */
-#define ACPI_FADT_FIXED_RTC         (1<<6)      /* 06: RTC wakeup stat not in fixed register space */
-#define ACPI_FADT_S4_RTC_WAKE       (1<<7)      /* 07: RTC wakeup stat not possible from S4 */
-#define ACPI_FADT_32BIT_TIMER       (1<<8)      /* 08: tmr_val is 32 bits 0=24-bits */
-#define ACPI_FADT_DOCKING_SUPPORTED (1<<9)      /* 09: Docking supported */
-#define ACPI_FADT_RESET_REGISTER    (1<<10)     /* 10: System reset via the FADT RESET_REG supported */
-#define ACPI_FADT_SEALED_CASE       (1<<11)     /* 11: No internal expansion capabilities and case is sealed */
-#define ACPI_FADT_HEADLESS          (1<<12)     /* 12: No local video capabilities or local input devices */
-#define ACPI_FADT_SLEEP_TYPE        (1<<13)     /* 13: Must execute native instruction after writing  SLP_TYPx register */
-#define ACPI_FADT_PCI_EXPRESS_WAKE  (1<<14)     /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
-#define ACPI_FADT_PLATFORM_CLOCK    (1<<15)     /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
-#define ACPI_FADT_S4_RTC_VALID      (1<<16)     /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
-#define ACPI_FADT_REMOTE_POWER_ON   (1<<17)     /* 17: System is compatible with remote power on (ACPI 3.0) */
-#define ACPI_FADT_APIC_CLUSTER      (1<<18)     /* 18: All local APICs must use cluster model (ACPI 3.0) */
-#define ACPI_FADT_APIC_PHYSICAL     (1<<19)     /* 19: All local xAPICs must use physical dest mode (ACPI 3.0) */
+#define ACPI_FADT_WBINVD            (1)         /* 00: [V1] The wbinvd instruction works properly */
+#define ACPI_FADT_WBINVD_FLUSH      (1<<1)      /* 01: [V1] wbinvd flushes but does not invalidate caches */
+#define ACPI_FADT_C1_SUPPORTED      (1<<2)      /* 02: [V1] All processors support C1 state */
+#define ACPI_FADT_C2_MP_SUPPORTED   (1<<3)      /* 03: [V1] C2 state works on MP system */
+#define ACPI_FADT_POWER_BUTTON      (1<<4)      /* 04: [V1] Power button is handled as a control method device */
+#define ACPI_FADT_SLEEP_BUTTON      (1<<5)      /* 05: [V1] Sleep button is handled as a control method device */
+#define ACPI_FADT_FIXED_RTC         (1<<6)      /* 06: [V1] RTC wakeup status not in fixed register space */
+#define ACPI_FADT_S4_RTC_WAKE       (1<<7)      /* 07: [V1] RTC alarm can wake system from S4 */
+#define ACPI_FADT_32BIT_TIMER       (1<<8)      /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
+#define ACPI_FADT_DOCKING_SUPPORTED (1<<9)      /* 09: [V1] Docking supported */
+#define ACPI_FADT_RESET_REGISTER    (1<<10)     /* 10: [V2] System reset via the FADT RESET_REG supported */
+#define ACPI_FADT_SEALED_CASE       (1<<11)     /* 11: [V3] No internal expansion capabilities and case is sealed */
+#define ACPI_FADT_HEADLESS          (1<<12)     /* 12: [V3] No local video capabilities or local input devices */
+#define ACPI_FADT_SLEEP_TYPE        (1<<13)     /* 13: [V3] Must execute native instruction after writing  SLP_TYPx register */
+#define ACPI_FADT_PCI_EXPRESS_WAKE  (1<<14)     /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+#define ACPI_FADT_PLATFORM_CLOCK    (1<<15)     /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */
+#define ACPI_FADT_S4_RTC_VALID      (1<<16)     /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+#define ACPI_FADT_REMOTE_POWER_ON   (1<<17)     /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
+#define ACPI_FADT_APIC_CLUSTER      (1<<18)     /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
+#define ACPI_FADT_APIC_PHYSICAL     (1<<19)     /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */
 
 
-/*
- * FADT Prefered Power Management Profiles
- */
+/* FADT Prefered Power Management Profiles */
+
 enum AcpiPreferedPmProfiles
 {
     PM_UNSPECIFIED          = 0,
@@ -370,19 +376,42 @@
 };
 
 
-/* FADT Boot Arch Flags */
-
-#define BAF_LEGACY_DEVICES              0x0001
-#define BAF_8042_KEYBOARD_CONTROLLER    0x0002
-
-#define FADT2_REVISION_ID               3
-#define FADT2_MINUS_REVISION_ID         2
-
-
 /* Reset to default packing */
 
 #pragma pack()
 
+
+typedef union acpi_name_union
+{
+    UINT32                          Integer;
+    char                            Ascii[4];
+
+} ACPI_NAME_UNION;
+
+/*
+ * Internal ACPI Table Descriptor. One per ACPI table
+ */
+typedef struct acpi_table_desc
+{
+    ACPI_PHYSICAL_ADDRESS           Address;
+    ACPI_TABLE_HEADER               *Pointer;
+    UINT32                          Length;     /* Length fixed at 32 bits */
+    ACPI_NAME_UNION                 Signature;
+    ACPI_OWNER_ID                   OwnerId;
+    UINT8                           Flags;
+
+} ACPI_TABLE_DESC;
+
+/* Flags for above */
+
+#define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
+#define ACPI_TABLE_ORIGIN_MAPPED        (1)
+#define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
+#define ACPI_TABLE_ORIGIN_OVERRIDE      (4)
+#define ACPI_TABLE_ORIGIN_MASK          (7)
+#define ACPI_TABLE_IS_LOADED            (8)
+
+
 /*
  * Get the remaining ACPI tables
  */
--- a/usr/src/uts/intel/sys/acpi/actbl1.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/actbl1.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: actbl1.h - Additional ACPI table definitions
- *       $Revision: 1.51 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -803,7 +802,7 @@
     UINT32                  UncorrectableErrorMask;
     UINT32                  UncorrectableErrorSeverity;
     UINT32                  CorrectableErrorMask;
-    UINT32                  AdvancedErrorCababilities;
+    UINT32                  AdvancedErrorCapabilities;
 
 } ACPI_HEST_AER_COMMON;
 
@@ -1263,15 +1262,15 @@
 
 #define ACPI_MADT_CPEI_OVERRIDE     (1)
 
-/* 9: Processor Local X2_APIC (07/2008) */
+/* 9: Processor Local X2APIC (07/2008) */
 
 typedef struct acpi_madt_local_x2apic
 {
     ACPI_SUBTABLE_HEADER    Header;
     UINT16                  Reserved;           /* Reserved - must be zero */
-    UINT32                  LocalApicId;        /* Processor X2_APIC ID  */
+    UINT32                  LocalApicId;        /* Processor x2APIC ID  */
     UINT32                  LapicFlags;
-    UINT32                  Uid;                /* Extended X2_APIC processor ID */
+    UINT32                  Uid;                /* ACPI processor UID */
 
 } ACPI_MADT_LOCAL_X2APIC;
 
@@ -1281,9 +1280,9 @@
 {
     ACPI_SUBTABLE_HEADER    Header;
     UINT16                  IntiFlags;
-    UINT32                  Uid;                /* Processor X2_APIC ID */
+    UINT32                  Uid;                /* ACPI processor UID */
     UINT8                   Lint;               /* LINTn to which NMI is connected */
-    UINT8                   Reserved[3];
+    UINT8                   Reserved[3];        /* Reserved - must be zero */
 
 } ACPI_MADT_LOCAL_X2APIC_NMI;
 
--- a/usr/src/uts/intel/sys/acpi/actbl2.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/actbl2.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- *       $Revision: 1.52 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/actypes.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/actypes.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: actypes.h - Common data types for the entire ACPI subsystem
- *       $Revision: 1.323 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -224,14 +223,12 @@
 
 
 typedef INT64                           ACPI_NATIVE_INT;
-
 typedef UINT64                          ACPI_SIZE;
 typedef UINT64                          ACPI_IO_ADDRESS;
 typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
 
 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
-
 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
 
 /*
@@ -265,7 +262,6 @@
 
 
 typedef INT32                           ACPI_NATIVE_INT;
-
 typedef UINT32                          ACPI_SIZE;
 typedef UINT32                          ACPI_IO_ADDRESS;
 typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
@@ -283,27 +279,19 @@
 
 /*******************************************************************************
  *
- * OS-dependent and compiler-dependent types
+ * OS-dependent types
  *
  * If the defaults below are not appropriate for the host system, they can
- * be defined in the compiler-specific or OS-specific header, and this will
- * take precedence.
+ * be defined in the OS-specific header, and this will take precedence.
  *
  ******************************************************************************/
 
-
 /* Value returned by AcpiOsGetThreadId */
 
 #ifndef ACPI_THREAD_ID
 #define ACPI_THREAD_ID                  ACPI_SIZE
 #endif
 
-/* Object returned from AcpiOsCreateLock */
-
-#ifndef ACPI_SPINLOCK
-#define ACPI_SPINLOCK                   void *
-#endif
-
 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
 
 #ifndef ACPI_CPU_FLAGS
@@ -313,8 +301,51 @@
 /* Object returned from AcpiOsCreateCache */
 
 #ifndef ACPI_CACHE_T
+#ifdef ACPI_USE_LOCAL_CACHE
 #define ACPI_CACHE_T                    ACPI_MEMORY_LIST
+#else
+#define ACPI_CACHE_T                    void *
 #endif
+#endif
+
+/*
+ * Synchronization objects - Mutexes, Semaphores, and SpinLocks
+ */
+#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
+/*
+ * These macros are used if the host OS does not support a mutex object.
+ * Map the OSL Mutex interfaces to binary semaphores.
+ */
+#define ACPI_MUTEX                      ACPI_SEMAPHORE
+#define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
+#define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
+#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
+#define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
+#endif
+
+/* Configurable types for synchronization objects */
+
+#ifndef ACPI_SPINLOCK
+#define ACPI_SPINLOCK                   void *
+#endif
+
+#ifndef ACPI_SEMAPHORE
+#define ACPI_SEMAPHORE                  void *
+#endif
+
+#ifndef ACPI_MUTEX
+#define ACPI_MUTEX                      void *
+#endif
+
+
+/*******************************************************************************
+ *
+ * Compiler-dependent types
+ *
+ * If the defaults below are not appropriate for the host compiler, they can
+ * be defined in the compiler-specific header, and this will take precedence.
+ *
+ ******************************************************************************/
 
 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
 
@@ -349,6 +380,44 @@
 #endif
 
 
+/******************************************************************************
+ *
+ * ACPI Specification constants (Do not change unless the specification changes)
+ *
+ *****************************************************************************/
+
+/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
+
+#define ACPI_MAX_GPE_BLOCKS             2
+
+/* Default ACPI register widths */
+
+#define ACPI_GPE_REGISTER_WIDTH         8
+#define ACPI_PM1_REGISTER_WIDTH         16
+#define ACPI_PM2_REGISTER_WIDTH         8
+#define ACPI_PM_TIMER_WIDTH             32
+
+/* Names within the namespace are 4 bytes long */
+
+#define ACPI_NAME_SIZE                  4
+#define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
+#define ACPI_PATH_SEPARATOR             '.'
+
+/* Sizes for ACPI table headers */
+
+#define ACPI_OEM_ID_SIZE                6
+#define ACPI_OEM_TABLE_ID_SIZE          8
+
+/* ACPI/PNP hardware IDs */
+
+#define PCI_ROOT_HID_STRING             "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
+
+/* PM Timer ticks per second (HZ) */
+
+#define PM_TIMER_FREQUENCY  3579545
+
+
 /*******************************************************************************
  *
  * Independent types
@@ -373,13 +442,20 @@
 
 
 /*
- * Mescellaneous types
+ * Miscellaneous types
  */
 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
 
+
+/* Owner IDs are used to track namespace nodes for selective deletion */
+
+typedef UINT8                           ACPI_OWNER_ID;
+#define ACPI_OWNER_ID_MAX               0xFF
+
+
 typedef struct uint64_struct
 {
     UINT32                          Lo;
@@ -402,14 +478,8 @@
 } UINT32_STRUCT;
 
 
-/* Synchronization objects */
-
-#define ACPI_MUTEX                      void *
-#define ACPI_SEMAPHORE                  void *
-
-
 /*
- * Acpi integer width. In ACPI version 1, integers are 32 bits.  In ACPI
+ * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
  * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
  * type only, not other integers used in the implementation of the ACPI CA
  * subsystem.
@@ -418,12 +488,6 @@
 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
 #define ACPI_INTEGER_BIT_SIZE           64
 #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
-
-
-#if ACPI_MACHINE_WIDTH == 64
-#define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 64-bit divide */
-#endif
-
 #define ACPI_MAX64_DECIMAL_DIGITS       20
 #define ACPI_MAX32_DECIMAL_DIGITS       10
 #define ACPI_MAX16_DECIMAL_DIGITS        5
@@ -433,8 +497,62 @@
  * Constants with special meanings
  */
 #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
+#define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
+#define ACPI_DO_NOT_WAIT                0
 
 
+/*******************************************************************************
+ *
+ * Commonly used macros
+ *
+ ******************************************************************************/
+
+/* Data manipulation */
+
+#define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
+#define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
+#define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
+#define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
+#define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
+#define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
+
+#define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
+#define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
+#define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
+#define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
+
+/* Size calculation */
+
+#define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
+
+/* Pointer manipulation */
+
+#define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
+#define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
+#define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
+#define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
+
+/* Pointer/Integer type conversions */
+
+#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
+#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
+#define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
+#define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
+#define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
+
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
+#else
+#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
+#endif
+
+
+/*******************************************************************************
+ *
+ * Miscellaneous constants
+ *
+ ******************************************************************************/
+
 /*
  * Initialization sequence
  */
@@ -506,9 +624,9 @@
 #define ACPI_NOTIFY_MAX                 0x0B
 
 /*
- * Types associated with ACPI names and objects.  The first group of
+ * Types associated with ACPI names and objects. The first group of
  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
- * of the ACPI ObjectType() operator (See the ACPI Spec).  Therefore,
+ * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
  * only add to the first group if the spec changes.
  *
  * NOTE: Types must be kept in sync with the global AcpiNsProperties
@@ -704,8 +822,15 @@
 
 /*
  * BitRegister IDs
- * These are bitfields defined within the full ACPI registers
+ *
+ * These values are intended to be used by the hardware interfaces
+ * and are mapped to individual bitfields defined within the ACPI
+ * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c
+ * for this mapping.
  */
+
+/* PM1 Status register */
+
 #define ACPI_BITREG_TIMER_STATUS                0x00
 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
@@ -715,25 +840,39 @@
 #define ACPI_BITREG_WAKE_STATUS                 0x06
 #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
 
+/* PM1 Enable register */
+
 #define ACPI_BITREG_TIMER_ENABLE                0x08
 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
-#define ACPI_BITREG_WAKE_ENABLE                 0x0D
-#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0E
+#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
+
+/* PM1 Control register */
+
+#define ACPI_BITREG_SCI_ENABLE                  0x0E
+#define ACPI_BITREG_BUS_MASTER_RLD              0x0F
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
+#define ACPI_BITREG_SLEEP_TYPE                  0x11
+#define ACPI_BITREG_SLEEP_ENABLE                0x12
+
+/* PM2 Control register */
 
-#define ACPI_BITREG_SCI_ENABLE                  0x0F
-#define ACPI_BITREG_BUS_MASTER_RLD              0x10
-#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x11
-#define ACPI_BITREG_SLEEP_TYPE_A                0x12
-#define ACPI_BITREG_SLEEP_TYPE_B                0x13
-#define ACPI_BITREG_SLEEP_ENABLE                0x14
+#define ACPI_BITREG_ARB_DISABLE                 0x13
+
+#define ACPI_BITREG_MAX                         0x13
+#define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
+
 
-#define ACPI_BITREG_ARB_DISABLE                 0x15
+/* Status register values. A 1 clears a status bit. 0 = no effect */
+
+#define ACPI_CLEAR_STATUS                       1
 
-#define ACPI_BITREG_MAX                         0x15
-#define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
+/* Enable and Control register values */
+
+#define ACPI_ENABLE_EVENT                       1
+#define ACPI_DISABLE_EVENT                      0
 
 
 /*
@@ -834,6 +973,18 @@
 
 
 /*
+ * Predefined Namespace items
+ */
+typedef struct acpi_predefined_names
+{
+    char                            *Name;
+    UINT8                           Type;
+    char                            *Val;
+
+} ACPI_PREDEFINED_NAMES;
+
+
+/*
  * Structure and flags for AcpiGetSystemInfo
  */
 #define ACPI_SYS_MODE_UNKNOWN           0x0000
@@ -859,7 +1010,7 @@
 
 
 /*
- * System statistecs returned by AcpiGetStatistics()
+ * System statistics returned by AcpiGetStatistics()
  */
 typedef struct acpi_statistics
 {
@@ -923,7 +1074,7 @@
     UINT32                          AmlOffset,
     void                            *Context);
 
-/* Table Event handler (Load, LoadTable etc) and types */
+/* Table Event handler (Load, LoadTable, etc.) and types */
 
 typedef
 ACPI_STATUS (*ACPI_TABLE_HANDLER) (
@@ -949,7 +1100,6 @@
 
 #define ACPI_DEFAULT_HANDLER            NULL
 
-
 typedef
 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
     ACPI_HANDLE                     RegionHandle,
@@ -974,6 +1124,12 @@
 #define ACPI_INTERRUPT_HANDLED          0x01
 
 
+/* Length of _HID, _UID, _CID, and UUID values */
+
+#define ACPI_DEVICE_ID_LENGTH           0x09
+#define ACPI_MAX_CID_LENGTH             48
+#define ACPI_UUID_LENGTH                16
+
 /* Common string version of device HIDs and UIDs */
 
 typedef struct acpi_device_id
@@ -1072,424 +1228,31 @@
 
 
 /*
- * Definitions for Resource Attributes
- */
-typedef UINT16                          ACPI_RS_LENGTH;    /* Resource Length field is fixed at 16 bits */
-typedef UINT32                          ACPI_RSDESC_SIZE;  /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
-
-/*
- *  Memory Attributes
- */
-#define ACPI_READ_ONLY_MEMORY           (UINT8) 0x00
-#define ACPI_READ_WRITE_MEMORY          (UINT8) 0x01
-
-#define ACPI_NON_CACHEABLE_MEMORY       (UINT8) 0x00
-#define ACPI_CACHABLE_MEMORY            (UINT8) 0x01
-#define ACPI_WRITE_COMBINING_MEMORY     (UINT8) 0x02
-#define ACPI_PREFETCHABLE_MEMORY        (UINT8) 0x03
-
-/*
- *  IO Attributes
- *  The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
- *  The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
+ * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
  */
-#define ACPI_NON_ISA_ONLY_RANGES        (UINT8) 0x01
-#define ACPI_ISA_ONLY_RANGES            (UINT8) 0x02
-#define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
-
-/* Type of translation - 1=Sparse, 0=Dense */
-
-#define ACPI_SPARSE_TRANSLATION         (UINT8) 0x01
-
-/*
- *  IO Port Descriptor Decode
- */
-#define ACPI_DECODE_10                  (UINT8) 0x00    /* 10-bit IO address decode */
-#define ACPI_DECODE_16                  (UINT8) 0x01    /* 16-bit IO address decode */
-
-/*
- *  IRQ Attributes
- */
-#define ACPI_LEVEL_SENSITIVE            (UINT8) 0x00
-#define ACPI_EDGE_SENSITIVE             (UINT8) 0x01
-
-#define ACPI_ACTIVE_HIGH                (UINT8) 0x00
-#define ACPI_ACTIVE_LOW                 (UINT8) 0x01
+typedef struct acpi_memory_list
+{
+    char                            *ListName;
+    void                            *ListHead;
+    UINT16                          ObjectSize;
+    UINT16                          MaxDepth;
+    UINT16                          CurrentDepth;
+    UINT16                          LinkOffset;
 
-#define ACPI_EXCLUSIVE                  (UINT8) 0x00
-#define ACPI_SHARED                     (UINT8) 0x01
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
-/*
- *  DMA Attributes
- */
-#define ACPI_COMPATIBILITY              (UINT8) 0x00
-#define ACPI_TYPE_A                     (UINT8) 0x01
-#define ACPI_TYPE_B                     (UINT8) 0x02
-#define ACPI_TYPE_F                     (UINT8) 0x03
-
-#define ACPI_NOT_BUS_MASTER             (UINT8) 0x00
-#define ACPI_BUS_MASTER                 (UINT8) 0x01
-
-#define ACPI_TRANSFER_8                 (UINT8) 0x00
-#define ACPI_TRANSFER_8_16              (UINT8) 0x01
-#define ACPI_TRANSFER_16                (UINT8) 0x02
+    /* Statistics for debug memory tracking only */
 
-/*
- * Start Dependent Functions Priority definitions
- */
-#define ACPI_GOOD_CONFIGURATION         (UINT8) 0x00
-#define ACPI_ACCEPTABLE_CONFIGURATION   (UINT8) 0x01
-#define ACPI_SUB_OPTIMAL_CONFIGURATION  (UINT8) 0x02
-
-/*
- *  16, 32 and 64-bit Address Descriptor resource types
- */
-#define ACPI_MEMORY_RANGE               (UINT8) 0x00
-#define ACPI_IO_RANGE                   (UINT8) 0x01
-#define ACPI_BUS_NUMBER_RANGE           (UINT8) 0x02
-
-#define ACPI_ADDRESS_NOT_FIXED          (UINT8) 0x00
-#define ACPI_ADDRESS_FIXED              (UINT8) 0x01
-
-#define ACPI_POS_DECODE                 (UINT8) 0x00
-#define ACPI_SUB_DECODE                 (UINT8) 0x01
-
-#define ACPI_PRODUCER                   (UINT8) 0x00
-#define ACPI_CONSUMER                   (UINT8) 0x01
-
-
-/*
- * If possible, pack the following structures to byte alignment
- */
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#pragma pack(1)
+    UINT32                          TotalAllocated;
+    UINT32                          TotalFreed;
+    UINT32                          MaxOccupied;
+    UINT32                          TotalSize;
+    UINT32                          CurrentTotalSize;
+    UINT32                          Requests;
+    UINT32                          Hits;
 #endif
 
-/* UUID data structures for use in vendor-defined resource descriptors */
-
-typedef struct acpi_uuid
-{
-    UINT8                           Data[ACPI_UUID_LENGTH];
-} ACPI_UUID;
-
-typedef struct acpi_vendor_uuid
-{
-    UINT8                           Subtype;
-    UINT8                           Data[ACPI_UUID_LENGTH];
-
-} ACPI_VENDOR_UUID;
-
-/*
- *  Structures used to describe device resources
- */
-typedef struct acpi_resource_irq
-{
-    UINT8                           DescriptorLength;
-    UINT8                           Triggering;
-    UINT8                           Polarity;
-    UINT8                           Sharable;
-    UINT8                           InterruptCount;
-    UINT8                           Interrupts[1];
-
-} ACPI_RESOURCE_IRQ;
-
-typedef struct ACPI_RESOURCE_DMA
-{
-    UINT8                           Type;
-    UINT8                           BusMaster;
-    UINT8                           Transfer;
-    UINT8                           ChannelCount;
-    UINT8                           Channels[1];
-
-} ACPI_RESOURCE_DMA;
-
-typedef struct acpi_resource_start_dependent
-{
-    UINT8                           DescriptorLength;
-    UINT8                           CompatibilityPriority;
-    UINT8                           PerformanceRobustness;
-
-} ACPI_RESOURCE_START_DEPENDENT;
-
-
-/*
- * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
- * needed because it has no fields
- */
-
-
-typedef struct acpi_resource_io
-{
-    UINT8                           IoDecode;
-    UINT8                           Alignment;
-    UINT8                           AddressLength;
-    UINT16                          Minimum;
-    UINT16                          Maximum;
-
-} ACPI_RESOURCE_IO;
-
-typedef struct acpi_resource_fixed_io
-{
-    UINT16                          Address;
-    UINT8                           AddressLength;
-
-} ACPI_RESOURCE_FIXED_IO;
-
-typedef struct acpi_resource_vendor
-{
-    UINT16                          ByteLength;
-    UINT8                           ByteData[1];
-
-} ACPI_RESOURCE_VENDOR;
-
-/* Vendor resource with UUID info (introduced in ACPI 3.0) */
-
-typedef struct acpi_resource_vendor_typed
-{
-    UINT16                          ByteLength;
-    UINT8                           UuidSubtype;
-    UINT8                           Uuid[ACPI_UUID_LENGTH];
-    UINT8                           ByteData[1];
-
-} ACPI_RESOURCE_VENDOR_TYPED;
-
-typedef struct acpi_resource_end_tag
-{
-    UINT8                           Checksum;
-
-} ACPI_RESOURCE_END_TAG;
-
-typedef struct acpi_resource_memory24
-{
-    UINT8                           WriteProtect;
-    UINT16                          Minimum;
-    UINT16                          Maximum;
-    UINT16                          Alignment;
-    UINT16                          AddressLength;
-
-} ACPI_RESOURCE_MEMORY24;
-
-typedef struct acpi_resource_memory32
-{
-    UINT8                           WriteProtect;
-    UINT32                          Minimum;
-    UINT32                          Maximum;
-    UINT32                          Alignment;
-    UINT32                          AddressLength;
-
-} ACPI_RESOURCE_MEMORY32;
-
-typedef struct acpi_resource_fixed_memory32
-{
-    UINT8                           WriteProtect;
-    UINT32                          Address;
-    UINT32                          AddressLength;
-
-} ACPI_RESOURCE_FIXED_MEMORY32;
-
-typedef struct acpi_memory_attribute
-{
-    UINT8                           WriteProtect;
-    UINT8                           Caching;
-    UINT8                           RangeType;
-    UINT8                           Translation;
-
-} ACPI_MEMORY_ATTRIBUTE;
-
-typedef struct acpi_io_attribute
-{
-    UINT8                           RangeType;
-    UINT8                           Translation;
-    UINT8                           TranslationType;
-    UINT8                           Reserved1;
-
-} ACPI_IO_ATTRIBUTE;
-
-typedef union acpi_resource_attribute
-{
-    ACPI_MEMORY_ATTRIBUTE           Mem;
-    ACPI_IO_ATTRIBUTE               Io;
-
-    /* Used for the *WordSpace macros */
-
-    UINT8                           TypeSpecific;
-
-} ACPI_RESOURCE_ATTRIBUTE;
-
-typedef struct acpi_resource_source
-{
-    UINT8                           Index;
-    UINT16                          StringLength;
-    char                            *StringPtr;
-
-} ACPI_RESOURCE_SOURCE;
-
-/* Fields common to all address descriptors, 16/32/64 bit */
-
-#define ACPI_RESOURCE_ADDRESS_COMMON \
-    UINT8                           ResourceType; \
-    UINT8                           ProducerConsumer; \
-    UINT8                           Decode; \
-    UINT8                           MinAddressFixed; \
-    UINT8                           MaxAddressFixed; \
-    ACPI_RESOURCE_ATTRIBUTE         Info;
-
-typedef struct acpi_resource_address
-{
-    ACPI_RESOURCE_ADDRESS_COMMON
-
-} ACPI_RESOURCE_ADDRESS;
-
-typedef struct acpi_resource_address16
-{
-    ACPI_RESOURCE_ADDRESS_COMMON
-    UINT16                          Granularity;
-    UINT16                          Minimum;
-    UINT16                          Maximum;
-    UINT16                          TranslationOffset;
-    UINT16                          AddressLength;
-    ACPI_RESOURCE_SOURCE            ResourceSource;
-
-} ACPI_RESOURCE_ADDRESS16;
-
-typedef struct acpi_resource_address32
-{
-    ACPI_RESOURCE_ADDRESS_COMMON
-    UINT32                          Granularity;
-    UINT32                          Minimum;
-    UINT32                          Maximum;
-    UINT32                          TranslationOffset;
-    UINT32                          AddressLength;
-    ACPI_RESOURCE_SOURCE            ResourceSource;
-
-} ACPI_RESOURCE_ADDRESS32;
-
-typedef struct acpi_resource_address64
-{
-    ACPI_RESOURCE_ADDRESS_COMMON
-    UINT64                          Granularity;
-    UINT64                          Minimum;
-    UINT64                          Maximum;
-    UINT64                          TranslationOffset;
-    UINT64                          AddressLength;
-    ACPI_RESOURCE_SOURCE            ResourceSource;
-
-} ACPI_RESOURCE_ADDRESS64;
-
-typedef struct acpi_resource_extended_address64
-{
-    ACPI_RESOURCE_ADDRESS_COMMON
-    UINT8                           RevisionID;
-    UINT64                          Granularity;
-    UINT64                          Minimum;
-    UINT64                          Maximum;
-    UINT64                          TranslationOffset;
-    UINT64                          AddressLength;
-    UINT64                          TypeSpecific;
-
-} ACPI_RESOURCE_EXTENDED_ADDRESS64;
-
-typedef struct acpi_resource_extended_irq
-{
-    UINT8                           ProducerConsumer;
-    UINT8                           Triggering;
-    UINT8                           Polarity;
-    UINT8                           Sharable;
-    UINT8                           InterruptCount;
-    ACPI_RESOURCE_SOURCE            ResourceSource;
-    UINT32                          Interrupts[1];
-
-} ACPI_RESOURCE_EXTENDED_IRQ;
-
-typedef struct acpi_resource_generic_register
-{
-    UINT8                           SpaceId;
-    UINT8                           BitWidth;
-    UINT8                           BitOffset;
-    UINT8                           AccessSize;
-    UINT64                          Address;
-
-} ACPI_RESOURCE_GENERIC_REGISTER;
-
-
-/* ACPI_RESOURCE_TYPEs */
-
-#define ACPI_RESOURCE_TYPE_IRQ                  0
-#define ACPI_RESOURCE_TYPE_DMA                  1
-#define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
-#define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
-#define ACPI_RESOURCE_TYPE_IO                   4
-#define ACPI_RESOURCE_TYPE_FIXED_IO             5
-#define ACPI_RESOURCE_TYPE_VENDOR               6
-#define ACPI_RESOURCE_TYPE_END_TAG              7
-#define ACPI_RESOURCE_TYPE_MEMORY24             8
-#define ACPI_RESOURCE_TYPE_MEMORY32             9
-#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
-#define ACPI_RESOURCE_TYPE_ADDRESS16            11
-#define ACPI_RESOURCE_TYPE_ADDRESS32            12
-#define ACPI_RESOURCE_TYPE_ADDRESS64            13
-#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14  /* ACPI 3.0 */
-#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
-#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
-#define ACPI_RESOURCE_TYPE_MAX                  16
-
-
-typedef union acpi_resource_data
-{
-    ACPI_RESOURCE_IRQ                       Irq;
-    ACPI_RESOURCE_DMA                       Dma;
-    ACPI_RESOURCE_START_DEPENDENT           StartDpf;
-    ACPI_RESOURCE_IO                        Io;
-    ACPI_RESOURCE_FIXED_IO                  FixedIo;
-    ACPI_RESOURCE_VENDOR                    Vendor;
-    ACPI_RESOURCE_VENDOR_TYPED              VendorTyped;
-    ACPI_RESOURCE_END_TAG                   EndTag;
-    ACPI_RESOURCE_MEMORY24                  Memory24;
-    ACPI_RESOURCE_MEMORY32                  Memory32;
-    ACPI_RESOURCE_FIXED_MEMORY32            FixedMemory32;
-    ACPI_RESOURCE_ADDRESS16                 Address16;
-    ACPI_RESOURCE_ADDRESS32                 Address32;
-    ACPI_RESOURCE_ADDRESS64                 Address64;
-    ACPI_RESOURCE_EXTENDED_ADDRESS64        ExtAddress64;
-    ACPI_RESOURCE_EXTENDED_IRQ              ExtendedIrq;
-    ACPI_RESOURCE_GENERIC_REGISTER          GenericReg;
-
-    /* Common fields */
-
-    ACPI_RESOURCE_ADDRESS                   Address;        /* Common 16/32/64 address fields */
-
-} ACPI_RESOURCE_DATA;
-
-
-typedef struct acpi_resource
-{
-    UINT32                          Type;
-    UINT32                          Length;
-    ACPI_RESOURCE_DATA              Data;
-
-} ACPI_RESOURCE;
-
-/* restore default alignment */
-
-#pragma pack()
-
-
-#define ACPI_RS_SIZE_NO_DATA                8       /* Id + Length fields */
-#define ACPI_RS_SIZE_MIN                    (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
-#define ACPI_RS_SIZE(Type)                  (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
-
-#define ACPI_NEXT_RESOURCE(Res)             (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
-
-
-typedef struct acpi_pci_routing_table
-{
-    UINT32                          Length;
-    UINT32                          Pin;
-    ACPI_INTEGER                    Address;        /* here for 64-bit alignment */
-    UINT32                          SourceIndex;
-    char                            Source[4];      /* pad to 64 bits so sizeof() works in all cases */
-
-} ACPI_PCI_ROUTING_TABLE;
+} ACPI_MEMORY_LIST;
 
 
 #endif /* __ACTYPES_H__ */
--- a/usr/src/uts/intel/sys/acpi/acutils.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/acutils.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- *       $Revision: 1.204 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -356,7 +355,9 @@
 #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
 
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
+
+#define ACPI_IS_ASCII(c)  ((c) < 0x80)
 
 
 /*
@@ -507,58 +508,6 @@
     char                    *ModuleName,
     UINT32                  LineNumber);
 
-/* Error and message reporting interfaces */
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtDebugPrint (
-    UINT32                  RequestedDebugLevel,
-    UINT32                  LineNumber,
-    const char              *FunctionName,
-    const char              *ModuleName,
-    UINT32                  ComponentId,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(6);
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtDebugPrintRaw (
-    UINT32                  RequestedDebugLevel,
-    UINT32                  LineNumber,
-    const char              *FunctionName,
-    const char              *ModuleName,
-    UINT32                  ComponentId,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(6);
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtError (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(3);
-
-void  ACPI_INTERNAL_VAR_XFACE
-AcpiUtException (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
-    ACPI_STATUS             Status,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(4);
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtWarning (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(3);
-
-void ACPI_INTERNAL_VAR_XFACE
-AcpiUtInfo (
-    const char              *ModuleName,
-    UINT32                  LineNumber,
-    const char              *Format,
-    ...) ACPI_PRINTF_LIKE(3);
-
-
 /*
  * utdelete - Object deletion and reference counts
  */
@@ -628,6 +577,33 @@
     ACPI_NAMESPACE_NODE     *DeviceNode,
     UINT8                   *Highest);
 
+/*
+ * utlock - reader/writer locks
+ */
+ACPI_STATUS
+AcpiUtCreateRwLock (
+    ACPI_RW_LOCK            *Lock);
+
+void
+AcpiUtDeleteRwLock (
+    ACPI_RW_LOCK            *Lock);
+
+ACPI_STATUS
+AcpiUtAcquireReadLock (
+    ACPI_RW_LOCK            *Lock);
+
+ACPI_STATUS
+AcpiUtReleaseReadLock (
+    ACPI_RW_LOCK            *Lock);
+
+ACPI_STATUS
+AcpiUtAcquireWriteLock (
+    ACPI_RW_LOCK            *Lock);
+
+void
+AcpiUtReleaseWriteLock (
+    ACPI_RW_LOCK            *Lock);
+
 
 /*
  * utobject - internal object create/delete/cache routines
--- a/usr/src/uts/intel/sys/acpi/amlcode.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/amlcode.h	Fri Jun 26 17:26:34 2009 -0700
@@ -3,7 +3,6 @@
  * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
  *                   Declarations and definitions contained herein are derived
  *                   directly from the ACPI specification.
- *       $Revision: 1.87 $
  *
  *****************************************************************************/
 
@@ -11,7 +10,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -583,7 +582,7 @@
 
 #define AML_METHOD_ARG_COUNT        0x07
 #define AML_METHOD_SERIALIZED       0x08
-#define AML_METHOD_SYNCH_LEVEL      0xF0
+#define AML_METHOD_SYNC_LEVEL       0xF0
 
 /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
 
--- a/usr/src/uts/intel/sys/acpi/amlresrc.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/amlresrc.h	Fri Jun 26 17:26:34 2009 -0700
@@ -2,7 +2,6 @@
 /******************************************************************************
  *
  * Module Name: amlresrc.h - AML resource descriptors
- *              $Revision: 1.41 $
  *
  *****************************************************************************/
 
@@ -10,7 +9,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/uts/intel/sys/acpi/platform/accygwin.h	Fri Jun 26 17:26:34 2009 -0700
@@ -0,0 +1,163 @@
+/******************************************************************************
+ *
+ * Name: accygwin.h - OS specific defines, etc. for cygwin environment
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights.  You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code.  No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision.  In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change.  Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee.  Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution.  In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government.  In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#ifndef __ACCYGWIN_H__
+#define __ACCYGWIN_H__
+
+/*
+ * ACPICA configuration
+ */
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_DO_WHILE_0
+#define ACPI_THREAD_ID              pthread_t
+#define ACPI_FLUSH_CPU_CACHE()
+/*
+ * This is needed since sem_timedwait does not appear to work properly
+ * on cygwin (always hangs forever).
+ */
+#define ACPI_USE_ALTERNATE_TIMEOUT
+
+
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#if defined(__ia64__) || defined(__x86_64__)
+#define ACPI_MACHINE_WIDTH          64
+#define COMPILER_DEPENDENT_INT64    long
+#define COMPILER_DEPENDENT_UINT64   unsigned long
+#else
+#define ACPI_MACHINE_WIDTH          32
+#define COMPILER_DEPENDENT_INT64    long long
+#define COMPILER_DEPENDENT_UINT64   unsigned long long
+#define ACPI_USE_NATIVE_DIVIDE
+#endif
+
+#ifndef __cdecl
+#define __cdecl
+#endif
+
+#ifdef _ANSI
+#define inline
+#endif
+
+
+/* Cygwin uses GCC */
+
+#include "acgcc.h"
+
+#endif /* __ACCYGWIN_H__ */
--- a/usr/src/uts/intel/sys/acpi/platform/acefi.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acefi.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acefi.h - OS specific defines, etc.
- *       $Revision: 1.19 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/platform/acenv.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acenv.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
- * Name: acenv.h - Generation environment specific items
- *       $Revision: 1.133 $
+ * Name: acenv.h - Host and compiler configuration
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,54 +116,64 @@
 #ifndef __ACENV_H__
 #define __ACENV_H__
 
-
 /*
- * Configuration for ACPI tools and utilities
+ * Environment configuration. The purpose of this file is to interface ACPICA
+ * to the local environment. This includes compiler-specific, OS-specific,
+ * and machine-specific configuration.
  */
 
-#ifdef ACPI_LIBRARY
-/*
- * Note: The non-debug version of the AcpiLibrary does not contain any
- * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
- */
-#define ACPI_USE_LOCAL_CACHE
-#endif
+/* Types for ACPI_MUTEX_TYPE */
+
+#define ACPI_BINARY_SEMAPHORE       0
+#define ACPI_OSL_MUTEX              1
+
+/* Types for DEBUGGER_THREADING */
+
+#define DEBUGGER_SINGLE_THREADED    0
+#define DEBUGGER_MULTI_THREADED     1
+
+
+/******************************************************************************
+ *
+ * Configuration for ACPI tools and utilities
+ *
+ *****************************************************************************/
+
+/* iASL configuration */
 
 #ifdef ACPI_ASL_COMPILER
-#define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
+#define ACPI_DEBUG_OUTPUT
 #define ACPI_CONSTANT_EVAL_ONLY
 #define ACPI_LARGE_NAMESPACE_NODE
 #define ACPI_DATA_TABLE_DISASSEMBLY
 #endif
 
+/* AcpiExec configuration */
+
 #ifdef ACPI_EXEC_APP
-#undef DEBUGGER_THREADING
-#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
+#define ACPI_APPLICATION
 #define ACPI_FULL_DEBUG
-#define ACPI_APPLICATION
-#define ACPI_DEBUGGER
 #define ACPI_MUTEX_DEBUG
 #define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 
-#ifdef ACPI_DASM_APP
-#ifndef MSDOS
-#define ACPI_DEBUG_OUTPUT
+/* Linkable ACPICA library */
+
+#ifdef ACPI_LIBRARY
+#define ACPI_USE_LOCAL_CACHE
 #endif
-#define ACPI_APPLICATION
-#define ACPI_DISASSEMBLER
-#define ACPI_NO_METHOD_EXECUTION
-#define ACPI_LARGE_NAMESPACE_NODE
-#define ACPI_DATA_TABLE_DISASSEMBLY
-#endif
+
+/* Common for all ACPICA applications */
 
 #ifdef ACPI_APPLICATION
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_LOCAL_CACHE
 #endif
 
+/* Common debug support */
+
 #ifdef ACPI_FULL_DEBUG
 #define ACPI_DEBUGGER
 #define ACPI_DEBUG_OUTPUT
@@ -172,50 +181,35 @@
 #endif
 
 
-/*
- * Environment configuration.  The purpose of this file is to interface to the
- * local generation environment.
- *
- * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
- *      Otherwise, local versions of string/memory functions will be used.
- * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
- *      the standard header files may be used.
- *
- * The ACPI subsystem only uses low level C library functions that do not call
- * operating system services and may therefore be inlined in the code.
- *
- * It may be necessary to tailor these include files to the target
- * generation environment.
- *
- *
- * Functions and constants used from each header:
+/*! [Begin] no source code translation */
+
+/******************************************************************************
  *
- * string.h:    memcpy
- *              memset
- *              strcat
- *              strcmp
- *              strcpy
- *              strlen
- *              strncmp
- *              strncat
- *              strncpy
+ * Host configuration files. The compiler configuration files are included
+ * by the host files.
  *
- * stdlib.h:    strtoul
- *
- * stdarg.h:    va_list
- *              va_arg
- *              va_start
- *              va_end
- *
- */
-
-/*! [Begin] no source code translation */
+ *****************************************************************************/
 
 #if defined(_LINUX) || defined(__linux__)
 #include "aclinux.h"
 
-#elif defined(_AED_EFI)
-#include "acefi.h"
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include "acfreebsd.h"
+
+#elif defined(__NetBSD__)
+#include "acnetbsd.h"
+
+#elif defined(__sun)
+#include "acsolaris.h"
+
+#elif defined(MODESTO)
+#include "acmodesto.h"
+
+#elif defined(NETWARE)
+#include "acnetware.h"
+
+#elif defined(_CYGWIN)
+#include "accygwin.h"
 
 #elif defined(WIN32)
 #include "acwin.h"
@@ -223,41 +217,88 @@
 #elif defined(WIN64)
 #include "acwin64.h"
 
-#elif defined(MSDOS)        /* Must appear after WIN32 and WIN64 check */
-#include "acdos16.h"
-
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#include "acfreebsd.h"
-
-#elif defined(__NetBSD__)
-#include "acnetbsd.h"
-
-#elif defined(MODESTO)
-#include "acmodesto.h"
-
-#elif defined(NETWARE)
-#include "acnetware.h"
-
-#elif defined(__sun)
-#include "acsolaris.h"
+#elif defined(_WRS_LIB_BUILD)
+#include "acvxworks.h"
 
 #elif defined(__OS2__)
 #include "acos2.h"
 
+#elif defined(_AED_EFI)
+#include "acefi.h"
+
 #else
 
-/* All other environments */
-
-#define ACPI_USE_STANDARD_HEADERS
+/* Unknown environment */
 
-#define COMPILER_DEPENDENT_INT64   long long
-#define COMPILER_DEPENDENT_UINT64  unsigned long long
-
+#error Unknown target environment
 #endif
 
 /*! [End] no source code translation !*/
 
 
+/******************************************************************************
+ *
+ * Setup defaults for the required symbols that were not defined in one of
+ * the host/compiler files above.
+ *
+ *****************************************************************************/
+
+/* 64-bit data types */
+
+#ifndef COMPILER_DEPENDENT_INT64
+#define COMPILER_DEPENDENT_INT64   long long
+#endif
+
+#ifndef COMPILER_DEPENDENT_UINT64
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+#endif
+
+/* Type of mutex supported by host. Default is binary semaphores. */
+
+#ifndef ACPI_MUTEX_TYPE
+#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
+#endif
+
+/* Global Lock acquire/release */
+
+#ifndef ACPI_ACQUIRE_GLOBAL_LOCK
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = 1
+#endif
+
+#ifndef ACPI_RELEASE_GLOBAL_LOCK
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) Acq = 0
+#endif
+
+/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
+
+#ifndef ACPI_FLUSH_CPU_CACHE
+#define ACPI_FLUSH_CPU_CACHE()
+#endif
+
+/*
+ * Configurable calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#ifndef ACPI_SYSTEM_XFACE
+#define ACPI_SYSTEM_XFACE
+#endif
+
+#ifndef ACPI_EXTERNAL_XFACE
+#define ACPI_EXTERNAL_XFACE
+#endif
+
+#ifndef ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#endif
+
+#ifndef ACPI_INTERNAL_VAR_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+#endif
+
 /*
  * Debugger threading model
  * Use single threaded if the entire subsystem is contained in an application
@@ -266,9 +307,6 @@
  * By default the model is single threaded if ACPI_APPLICATION is set,
  * multi-threaded if ACPI_APPLICATION is not set.
  */
-#define DEBUGGER_SINGLE_THREADED    0
-#define DEBUGGER_MULTI_THREADED     1
-
 #ifndef DEBUGGER_THREADING
 #ifdef ACPI_APPLICATION
 #define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
@@ -285,17 +323,26 @@
  *
  *****************************************************************************/
 
-#define ACPI_IS_ASCII(c)  ((c) < 0x80)
-
+/*
+ * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
+ *      Otherwise, local versions of string/memory functions will be used.
+ * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
+ *      the standard header files may be used.
+ *
+ * The ACPICA subsystem only uses low level C library functions that do not call
+ * operating system services and may therefore be inlined in the code.
+ *
+ * It may be necessary to tailor these include files to the target
+ * generation environment.
+ */
 #ifdef ACPI_USE_SYSTEM_CLIBRARY
-/*
- * Use the standard C library headers.
- * We want to keep these to a minimum.
- */
+
+/* Use the standard C library headers. We want to keep these to a minimum */
+
 #ifdef ACPI_USE_STANDARD_HEADERS
-/*
- * Use the standard headers from the standard locations
- */
+
+/* Use the standard headers from the standard locations */
+
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -303,9 +350,8 @@
 
 #endif /* ACPI_USE_STANDARD_HEADERS */
 
-/*
- * We will be linking to the standard Clib functions
- */
+/* We will be linking to the standard Clib functions */
+
 #define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
 #define ACPI_STRCHR(s1,c)       strchr((s1), (c))
 #define ACPI_STRLEN(s)          (ACPI_SIZE) strlen((s))
@@ -319,7 +365,6 @@
 #define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (ACPI_SIZE)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (ACPI_SIZE)(n))
-
 #define ACPI_TOUPPER(i)         toupper((int) (i))
 #define ACPI_TOLOWER(i)         tolower((int) (i))
 #define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
@@ -337,13 +382,12 @@
  *
  *****************************************************************************/
 
- /*
- * Use local definitions of C library macros and functions
- * NOTE: The function implementations may not be as efficient
- * as an inline or assembly code implementation provided by a
- * native C library.
+/*
+ * Use local definitions of C library macros and functions. These function
+ * implementations may not be as efficient as an inline or assembly code
+ * implementation provided by a native C library, but they are functionally
+ * equivalent.
  */
-
 #ifndef va_arg
 
 #ifndef _VALIST
@@ -351,15 +395,13 @@
 typedef char *va_list;
 #endif /* _VALIST */
 
-/*
- * Storage alignment properties
- */
+/* Storage alignment properties */
+
 #define  _AUPBND                (sizeof (ACPI_NATIVE_INT) - 1)
 #define  _ADNBND                (sizeof (ACPI_NATIVE_INT) - 1)
 
-/*
- * Variable argument list macro definitions
- */
+/* Variable argument list macro definitions */
+
 #define _Bnd(X, bnd)            (((sizeof (X)) + (bnd)) & (~(bnd)))
 #define va_arg(ap, T)           (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
 #define va_end(ap)              (void) 0
@@ -367,6 +409,7 @@
 
 #endif /* va_arg */
 
+/* Use the local (ACPICA) definitions of the clib functions */
 
 #define ACPI_STRSTR(s1,s2)      AcpiUtStrstr ((s1), (s2))
 #define ACPI_STRCHR(s1,c)       AcpiUtStrchr ((s1), (c))
@@ -386,62 +429,4 @@
 
 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
 
-
-/******************************************************************************
- *
- * Assembly code macros
- *
- *****************************************************************************/
-
-/*
- * Handle platform- and compiler-specific assembly language differences.
- * These should already have been defined by the platform includes above.
- *
- * Notes:
- * 1) Interrupt 3 is used to break into a debugger
- * 2) Interrupts are turned off during ACPI register setup
- */
-
-/* Unrecognized compiler, use defaults */
-
-#ifndef ACPI_ASM_MACROS
-
-/*
- * Calling conventions:
- *
- * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
- * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
- * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
- * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
- */
-#define ACPI_SYSTEM_XFACE
-#define ACPI_EXTERNAL_XFACE
-#define ACPI_INTERNAL_XFACE
-#define ACPI_INTERNAL_VAR_XFACE
-
-#define ACPI_ASM_MACROS
-#define BREAKPOINT3
-#define ACPI_DISABLE_IRQS()
-#define ACPI_ENABLE_IRQS()
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)
-
-#endif /* ACPI_ASM_MACROS */
-
-
-#ifdef ACPI_APPLICATION
-
-/* Don't want software interrupts within a ring3 application */
-
-#undef BREAKPOINT3
-#define BREAKPOINT3
-#endif
-
-
-/******************************************************************************
- *
- * Compiler-specific information is contained in the compiler-specific
- * headers.
- *
- *****************************************************************************/
 #endif /* __ACENV_H__ */
--- a/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acfreebsd.h - OS specific defines, etc.
- *       $Revision: 1.27 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -115,7 +114,7 @@
  *****************************************************************************/
 
 #ifndef __ACFREEBSD_H__
-#define __ACFREEBSD_H__
+#define	__ACFREEBSD_H__
 
 
 /* FreeBSD uses GCC */
@@ -124,77 +123,58 @@
 #include <sys/types.h>
 #include <machine/acpica_machdep.h>
 
-#define ACPI_UINTPTR_T                  uintptr_t
-#define ACPI_USE_LOCAL_CACHE
-#define __cdecl
+#define	ACPI_UINTPTR_T		uintptr_t
+
+#define	ACPI_USE_LOCAL_CACHE
+#define	ACPI_USE_SYSTEM_CLIBRARY
+
+#define	__cdecl
 
 #ifdef _KERNEL
-#include "opt_acpi.h"
-#endif
 
-#ifdef ACPI_DEBUG
-#define ACPI_DEBUG_OUTPUT   /* for backward compatibility */
-#define ACPI_DISASSEMBLER
-#endif
-
-#ifdef _KERNEL
 #include <sys/ctype.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/libkern.h>
 #include <machine/stdarg.h>
 
-#ifdef DEBUGGER_THREADING
-#undef DEBUGGER_THREADING
-#endif /* DEBUGGER_THREADING */
+#include "opt_acpi.h"
+
+#define	ACPI_THREAD_ID		lwpid_t
 
-#define DEBUGGER_THREADING 0    /* integrated with DDB */
+#ifdef ACPI_DEBUG
+#define	ACPI_DEBUG_OUTPUT	/* for backward compatibility */
+#define	ACPI_DISASSEMBLER
+#endif
 
 #ifdef ACPI_DEBUG_OUTPUT
 #include "opt_ddb.h"
 #ifdef DDB
-#define ACPI_DEBUGGER
+#define	ACPI_DEBUGGER
 #endif /* DDB */
 #endif /* ACPI_DEBUG_OUTPUT */
 
-#else /* _KERNEL */
+#ifdef DEBUGGER_THREADING
+#undef DEBUGGER_THREADING
+#endif /* DEBUGGER_THREADING */
 
-/* Not building kernel code, so use libc */
-#define ACPI_USE_STANDARD_HEADERS
-#define ACPI_FLUSH_CPU_CACHE()
+#define	DEBUGGER_THREADING	0	/* integrated with DDB */
+
+#else /* _KERNEL */
 
 #if __STDC_HOSTED__
 #include <ctype.h>
 #endif
 
-#define __cli()
-#define __sti()
+#define	ACPI_THREAD_ID		pthread_t
+
+/* Not building kernel code, so use libc */
+#define	ACPI_USE_STANDARD_HEADERS
+#define	ACPI_FLUSH_CPU_CACHE()
+
+#define	__cli()
+#define	__sti()
 
 #endif /* _KERNEL */
 
-/* Always use FreeBSD code over our local versions */
-#define ACPI_USE_SYSTEM_CLIBRARY
-
-#if defined(_KERNEL) && (__FreeBSD_version < 700020)
-/* Or strstr (used in debugging mode, also move to libkern) */
-static __inline char *
-strstr (char *s, char *find)
-{
-    char c, sc;
-    size_t len;
-
-    if ((c = *find++) != 0) {
-        len = strlen (find);
-        do {
-            do {
-                if ((sc = *s++) == 0)
-                    return (NULL);
-            } while (sc != c);
-        } while (strncmp (s, find, len) != 0);
-        s--;
-    }
-    return ((char *) s);
-}
-#endif /* _KERNEL */
-
 #endif /* __ACFREEBSD_H__ */
--- a/usr/src/uts/intel/sys/acpi/platform/acgcc.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acgcc.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acgcc.h - GCC specific defines, etc.
- *       $Revision: 1.33 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -135,5 +134,4 @@
  */
 #define ACPI_UNUSED_VAR __attribute__ ((unused))
 
-
 #endif /* __ACGCC_H__ */
--- a/usr/src/uts/intel/sys/acpi/platform/acintel.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acintel.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acintel.h - VC specific defines, etc.
- *       $Revision: 1.19 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/platform/aclinux.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/aclinux.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
- * Name: aclinux.h - OS specific defines, etc.
- *       $Revision: 1.44 $
+ * Name: aclinux.h - OS specific defines, etc. for Linux
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -117,28 +116,39 @@
 #ifndef __ACLINUX_H__
 #define __ACLINUX_H__
 
+/* Common (in-kernel/user-space) ACPICA configuration */
+
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
+#define ACPI_MUTEX_TYPE             ACPI_BINARY_SEMAPHORE
+
 
 #ifdef __KERNEL__
 
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/ctype.h>
+#include <linux/sched.h>
 #include <asm/system.h>
 #include <asm/atomic.h>
 #include <asm/div64.h>
 #include <asm/acpi.h>
+#include <linux/slab.h>
+#include <linux/spinlock_types.h>
+#include <asm/current.h>
 
-/* Host-dependent types and defines */
+/* Host-dependent types and defines for in-kernel ACPICA */
 
 #define ACPI_MACHINE_WIDTH          BITS_PER_LONG
-#define ACPI_CACHE_T                kmem_cache_t
-#define ACPI_SPINLOCK               spinlock_t
-#define ACPI_EXPORT_SYMBOL(Symbol)  EXPORT_SYMBOL(Symbol);
+#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
 #define strtoul                     simple_strtoul
 
+#define ACPI_CACHE_T                struct kmem_cache
+#define ACPI_SPINLOCK               spinlock_t *
+#define ACPI_CPU_FLAGS              unsigned long
+#define ACPI_THREAD_ID              struct task_struct *
+
 #else /* !__KERNEL__ */
 
 #include <stdarg.h>
@@ -147,6 +157,11 @@
 #include <ctype.h>
 #include <unistd.h>
 
+/* Host-dependent types and defines for user-space ACPICA */
+
+#define ACPI_FLUSH_CPU_CACHE()
+#define ACPI_THREAD_ID              pthread_t
+
 #if defined(__ia64__) || defined(__x86_64__)
 #define ACPI_MACHINE_WIDTH          64
 #define COMPILER_DEPENDENT_INT64    long
@@ -162,11 +177,57 @@
 #define __cdecl
 #endif
 
-#define ACPI_FLUSH_CPU_CACHE()
 #endif /* __KERNEL__ */
 
 /* Linux uses GCC */
 
 #include "acgcc.h"
 
+
+#ifdef __KERNEL__
+/*
+ * Overrides for in-kernel ACPICA
+ */
+static inline acpi_thread_id acpi_os_get_thread_id(void)
+{
+    return current;
+}
+
+/*
+ * The irqs_disabled() check is for resume from RAM.
+ * Interrupts are off during resume, just like they are for boot.
+ * However, boot has  (system_state != SYSTEM_RUNNING)
+ * to quiet __might_sleep() in kmalloc() and resume does not.
+ */
+#include <acpi/actypes.h>
+static inline void *acpi_os_allocate(acpi_size size)
+{
+    return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void *acpi_os_allocate_zeroed(acpi_size size)
+{
+    return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+    return kmem_cache_zalloc(cache,
+        irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+}
+
+#define ACPI_ALLOCATE(a)        acpi_os_allocate(a)
+#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
+#define ACPI_FREE(a)            kfree(a)
+
+/* Used within ACPICA to show where it is safe to preempt execution */
+
+#define ACPI_PREEMPTION_POINT() \
+    do { \
+        if (!irqs_disabled()) \
+            cond_resched(); \
+    } while (0)
+
+#endif /* __KERNEL__ */
+
 #endif /* __ACLINUX_H__ */
--- a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acmsvc.h - VC specific defines, etc.
- *       $Revision: 1.28 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
--- a/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acnetbsd.h - OS specific defines, etc.
- *       $Revision: 1.10 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -142,8 +141,6 @@
 
 #define ACPI_USE_NATIVE_DIVIDE
 
-#define ACPI_ASM_MACROS         /* tell acenv.h */
-
 #define ACPI_SYSTEM_XFACE
 #define ACPI_EXTERNAL_XFACE
 #define ACPI_INTERNAL_XFACE
--- a/usr/src/uts/intel/sys/acpi/platform/acos2.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acos2.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acos2.h - OS/2 specific defines, etc.
- *       $Revision: 1.0 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -142,11 +141,6 @@
 #define ACPI_USE_STANDARD_HEADERS
 #include <io.h>
 
-#define ACPI_ASM_MACROS
-
-#define BREAKPOINT3            __interrupt(3)
-#define ACPI_DISABLE_IRQS()    __disable()
-#define ACPI_ENABLE_IRQS()     __enable()
 #define ACPI_FLUSH_CPU_CACHE() Wbinvd()
 void Wbinvd(void);
 
--- a/usr/src/uts/intel/sys/acpi/platform/acsolaris.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acsolaris.h	Fri Jun 26 17:26:34 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -34,6 +34,7 @@
 #include <sys/sunddi.h>
 #include <sys/varargs.h>
 #include <sys/cpu.h>
+#include <sys/thread.h>
 
 #define	strtoul simple_strtoul
 
@@ -50,7 +51,7 @@
 #define	COMPILER_DEPENDENT_INT64	int64_t
 #define	COMPILER_DEPENDENT_UINT64	uint64_t
 
-#define	ACPI_THREAD_ID		kt_did_t
+#define	ACPI_THREAD_ID		kthread_t *
 
 #define	ACPI_PRINTF_LIKE_FUNC
 #define	ACPI_UNUSED_VAR
--- a/usr/src/uts/intel/sys/acpi/platform/acwin.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acwin.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acwin.h - OS specific defines, etc.
- *       $Revision: 1.30 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -127,7 +126,6 @@
 
 #define ACPI_MACHINE_WIDTH      32
 
-#define isascii                 __isascii
 #define inline                  __inline
 
 #define ACPI_USE_STANDARD_HEADERS
@@ -156,16 +154,9 @@
 
 /*! [Begin] no source code translation  */
 
-#define ACPI_ASM_MACROS
 #ifdef ACPI_APPLICATION
-#define BREAKPOINT3
-#define ACPI_DISABLE_IRQS()
-#define ACPI_ENABLE_IRQS()
 #define ACPI_FLUSH_CPU_CACHE()
 #else
-#define BREAKPOINT3             __asm {int 3}
-#define ACPI_DISABLE_IRQS()     __asm {cli}
-#define ACPI_ENABLE_IRQS()      __asm {sti}
 #define ACPI_FLUSH_CPU_CACHE()  __asm {WBINVD}
 #endif
 
--- a/usr/src/uts/intel/sys/acpi/platform/acwin64.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpi/platform/acwin64.h	Fri Jun 26 17:26:34 2009 -0700
@@ -1,7 +1,6 @@
 /******************************************************************************
  *
  * Name: acwin.h - OS specific defines, etc.
- *       $Revision: 1.17 $
  *
  *****************************************************************************/
 
@@ -9,7 +8,7 @@
  *
  * 1. Copyright Notice
  *
- * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
  * All rights reserved.
  *
  * 2. License
@@ -136,14 +135,8 @@
 
 /*! [Begin] no source code translation  */
 
-#define ACPI_ASM_MACROS
-#define causeinterrupt(level)
-#define BREAKPOINT3
-#define ACPI_DISABLE_IRQS()
-#define ACPI_ENABLE_IRQS()
 #define ACPI_FLUSH_CPU_CACHE()
 
-
 /*
  * For Acpi applications, we don't want to try to access the global lock
  */
--- a/usr/src/uts/intel/sys/acpica.h	Fri Jun 26 12:06:35 2009 -0700
+++ b/usr/src/uts/intel/sys/acpica.h	Fri Jun 26 17:26:34 2009 -0700
@@ -135,6 +135,34 @@
 #define	ACPI_DEVCFG_CONTAINER	0x4
 
 /*
+ * master_ops.c
+ */
+typedef struct device_id {
+	struct device_id *next;
+	char 	*id;
+} device_id_t;
+
+typedef struct property {
+	struct property *next;
+	char *name;
+	char *value;
+} property_t;
+
+typedef struct master_rec {
+	struct master_rec *next;
+	device_id_t	*device_ids;
+	char		*name;
+	char		*description;
+	property_t	*properties;
+} master_rec_t;
+
+extern const master_rec_t *master_file_lookup(device_id_t *);
+extern device_id_t *mf_alloc_device_id(void);
+extern void mf_free_device_id(device_id_t *);
+extern void process_master_file(void);
+extern void free_master_data(void);
+
+/*
  * Function prototypes
  */
 extern ACPI_STATUS acpica_get_sci(int *, iflag_t *);