summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyers <none@none>2005-08-15 16:04:38 -0700
committermyers <none@none>2005-08-15 16:04:38 -0700
commit450d696485d078017a0c7d3eef7384ee79c9f467 (patch)
treed7afd72fa1371a1b36e447cabbcb8e4e92ce236f
parentbbc88f3a6c6d8e21cb05884590e32f7fb7b52e05 (diff)
downloadillumos-joyent-450d696485d078017a0c7d3eef7384ee79c9f467.tar.gz
6277768 psm: 1394 port not functional on HP ze4100
6283818 acpica: multiple calls to AcpiTerminate() from acpica_init() when ACPI is disabled cause panic 6284164 acpica: AcpiOsInstallInterruptHandler needs to use revised SCI number 6286008 acpica: update to Intel 20050708 code drop 6294226 pcplusmp: SCI IRQ is gratuitously unshareable 6300079 acpica: WLAN button on Acer Ferrari 3400 is broken after running down the battery
-rw-r--r--usr/src/uts/i86pc/Makefile.files3
-rw-r--r--usr/src/uts/i86pc/acpica/Makefile2
-rw-r--r--usr/src/uts/i86pc/io/acpica/acpica.c1
-rw-r--r--usr/src/uts/i86pc/io/acpica/acpica_ec.c252
-rw-r--r--usr/src/uts/i86pc/io/acpica/changes.txt360
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c299
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbexec.c35
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c7
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbinput.c23
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbstats.c135
-rw-r--r--usr/src/uts/i86pc/io/acpica/debugger/dbutils.c10
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evgpe.c7
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evgpeblk.c65
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evmisc.c6
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evrgnini.c12
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evxface.c12
-rw-r--r--usr/src/uts/i86pc/io/acpica/events/evxfevnt.c8
-rw-r--r--usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c22
-rw-r--r--usr/src/uts/i86pc/io/acpica/hardware/hwregs.c22
-rw-r--r--usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c14
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c8
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c43
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c18
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c5
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c17
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c70
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c40
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c32
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c4
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c206
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c8
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c4
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c11
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c33
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c69
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c22
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c8
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c6
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c4
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c926
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c34
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c793
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c37
-rw-r--r--usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c10
-rw-r--r--usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c6
-rw-r--r--usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c13
-rw-r--r--usr/src/uts/i86pc/io/acpica/namespace/nsdump.c76
-rw-r--r--usr/src/uts/i86pc/io/acpica/namespace/nsparse.c6
-rw-r--r--usr/src/uts/i86pc/io/acpica/osl.c41
-rw-r--r--usr/src/uts/i86pc/io/acpica/resources/rsdump.c6
-rw-r--r--usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c10
-rw-r--r--usr/src/uts/i86pc/io/acpica/tables/tbinstal.c15
-rw-r--r--usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c64
-rw-r--r--usr/src/uts/i86pc/io/acpica/tables/tbxface.c5
-rw-r--r--usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c130
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utalloc.c314
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utcache.c418
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utcopy.c51
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utdebug.c175
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utdelete.c110
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utglobal.c110
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utinit.c4
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utmisc.c805
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utmutex.c474
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utobject.c34
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utstate.c459
-rw-r--r--usr/src/uts/i86pc/io/acpica/utilities/utxface.c25
-rw-r--r--usr/src/uts/i86pc/io/pcplusmp/apic.c82
-rw-r--r--usr/src/uts/i86pc/io/pcplusmp/apic.h1
-rw-r--r--usr/src/uts/i86pc/io/psm/psm_common.c46
-rw-r--r--usr/src/uts/i86pc/io/psm/uppc.c21
-rw-r--r--usr/src/uts/i86pc/sys/psm_common.h3
-rw-r--r--usr/src/uts/intel/sys/acpi/acconfig.h11
-rw-r--r--usr/src/uts/intel/sys/acpi/acdebug.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/acdisasm.h5
-rw-r--r--usr/src/uts/intel/sys/acpi/acdispat.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/acevents.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/acexcep.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/acglobal.h31
-rw-r--r--usr/src/uts/intel/sys/acpi/achware.h8
-rw-r--r--usr/src/uts/intel/sys/acpi/aclocal.h86
-rw-r--r--usr/src/uts/intel/sys/acpi/acmacros.h104
-rw-r--r--usr/src/uts/intel/sys/acpi/acnamesp.h6
-rw-r--r--usr/src/uts/intel/sys/acpi/acobject.h4
-rw-r--r--usr/src/uts/intel/sys/acpi/acopcode.h4
-rw-r--r--usr/src/uts/intel/sys/acpi/acoutput.h4
-rw-r--r--usr/src/uts/intel/sys/acpi/acparser.h28
-rw-r--r--usr/src/uts/intel/sys/acpi/acpiosxf.h33
-rw-r--r--usr/src/uts/intel/sys/acpi/acpixf.h2
-rw-r--r--usr/src/uts/intel/sys/acpi/acstruct.h14
-rw-r--r--usr/src/uts/intel/sys/acpi/actables.h6
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl.h60
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl1.h55
-rw-r--r--usr/src/uts/intel/sys/acpi/actbl2.h113
-rw-r--r--usr/src/uts/intel/sys/acpi/actypes.h17
-rw-r--r--usr/src/uts/intel/sys/acpi/acutils.h122
-rw-r--r--usr/src/uts/intel/sys/acpi/amlcode.h6
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acdos16.h4
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acenv.h21
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acgcc.h10
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acintel.h4
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/aclinux.h7
-rw-r--r--usr/src/uts/intel/sys/acpi/platform/acmsvc.h4
103 files changed, 4852 insertions, 3156 deletions
diff --git a/usr/src/uts/i86pc/Makefile.files b/usr/src/uts/i86pc/Makefile.files
index 0f7b694093..dad578abdf 100644
--- a/usr/src/uts/i86pc/Makefile.files
+++ b/usr/src/uts/i86pc/Makefile.files
@@ -172,7 +172,8 @@ ACPICA_OBJS += dbcmds.o dbdisply.o \
utalloc.o utclib.o utcopy.o utdebug.o utdelete.o \
uteval.o utglobal.o utinit.o utmath.o utmisc.o \
utobject.o utxface.o acpica.o acpi_enum.o master_ops.o \
- osl.o osl_ml.o acpica_ec.o
+ osl.o osl_ml.o acpica_ec.o utcache.o utmutex.o utstate.o \
+ psloop.o
#
# Build up defines and paths.
diff --git a/usr/src/uts/i86pc/acpica/Makefile b/usr/src/uts/i86pc/acpica/Makefile
index 03990eea36..0a4933dce4 100644
--- a/usr/src/uts/i86pc/acpica/Makefile
+++ b/usr/src/uts/i86pc/acpica/Makefile
@@ -50,7 +50,7 @@ LDFLAGS += -dy -Nmisc/pci_autoconfig
#
# lint pass one non-enforcement
#
-CFLAGS += $(CCVERBOSE) -DPWRDMN
+CFLAGS += $(CCVERBOSE) -DPWRDMN -DACPI_USE_LOCAL_CACHE
LINTFLAGS += -errchk=%none
LINTFLAGS += -errhdr=%none
diff --git a/usr/src/uts/i86pc/io/acpica/acpica.c b/usr/src/uts/i86pc/io/acpica/acpica.c
index ffb2cd3553..d2e478522e 100644
--- a/usr/src/uts/i86pc/io/acpica/acpica.c
+++ b/usr/src/uts/i86pc/io/acpica/acpica.c
@@ -383,7 +383,6 @@ error:
if (acpica_init_state != ACPICA_INITIALIZED) {
cmn_err(CE_NOTE, "!failed to initialize"
" ACPI services");
- (void) AcpiTerminate(); /* in case of error */
}
} else
status = AE_OK;
diff --git a/usr/src/uts/i86pc/io/acpica/acpica_ec.c b/usr/src/uts/i86pc/io/acpica/acpica_ec.c
index 2cc2d1e7ab..07a419064f 100644
--- a/usr/src/uts/i86pc/io/acpica/acpica_ec.c
+++ b/usr/src/uts/i86pc/io/acpica/acpica_ec.c
@@ -43,6 +43,12 @@
#include <sys/acpica.h>
/*
+ * Internal prototypes
+ */
+static int ec_wait_ibf_clear(int sc_addr);
+static int ec_wait_obf_set(int sc_addr);
+
+/*
* EC status bits
*/
#define EC_IBF (0x02)
@@ -68,6 +74,7 @@ struct ec_softstate {
uint16_t ec_base; /* base of EC I/O port - data */
uint16_t ec_sc; /* EC status/command */
ACPI_HANDLE ec_obj; /* handle to ACPI object for EC */
+ kmutex_t ec_mutex; /* serialize access to EC */
} ec;
/* I/O port range descriptor */
@@ -96,8 +103,11 @@ ec_setup(ACPI_HANDLE reg, UINT32 func, void *context, void **ret)
static int
ec_rd(int addr)
{
- int cnt;
- uint8_t sc = inb(ec.ec_sc);
+ int cnt, rv;
+ uint8_t sc;
+
+ mutex_enter(&ec.ec_mutex);
+ sc = inb(ec.ec_sc);
#ifdef DEBUG
if (sc & EC_IBF) {
@@ -110,48 +120,40 @@ ec_rd(int addr)
#endif
outb(ec.ec_sc, EC_RD); /* output a read command */
- cnt = 0;
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_rd:1: timed-out waiting "
- "for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_rd:1: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
outb(ec.ec_base, addr); /* output addr */
- cnt = 0;
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_rd:2: timed-out waiting"
- " for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_rd:2: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
-
- cnt = 0;
- while (!(inb(ec.ec_sc) & EC_OBF)) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_rd:1: timed-out waiting"
- " for OBF to set");
- return (-1);
- }
+ if (ec_wait_obf_set(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_rd:1: timed-out waiting "
+ "for OBF to set");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
- return (inb(ec.ec_base));
+ rv = inb(ec.ec_base);
+ mutex_exit(&ec.ec_mutex);
+ return (rv);
}
static int
ec_wr(int addr, uint8_t *val)
{
int cnt;
- uint8_t sc = inb(ec.ec_sc);
+ uint8_t sc;
+
+ mutex_enter(&ec.ec_mutex);
+ sc = inb(ec.ec_sc);
#ifdef DEBUG
if (sc & EC_IBF) {
@@ -164,86 +166,82 @@ ec_wr(int addr, uint8_t *val)
#endif
outb(ec.ec_sc, EC_WR); /* output a write command */
- cnt = 0;
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_wr:1: timed-out waiting "
- "for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_wr:1: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
outb(ec.ec_base, addr); /* output addr */
- cnt = 0;
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_wr:2: timed-out waiting"
- " for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_wr:2: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
outb(ec.ec_base, *val); /* write data */
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_wr:3: timed-out waiting"
- " for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_wr:3: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
+ mutex_exit(&ec.ec_mutex);
return (0);
}
static int
ec_query(void)
{
- int cnt;
- uint8_t sc = inb(ec.ec_sc);
-
- if (!(sc & EC_SCI) || (sc & EC_IBF) || (sc & EC_OBF)) {
- return (-1);
- }
+ int cnt, rv;
+ uint8_t sc;
+ mutex_enter(&ec.ec_mutex);
outb(ec.ec_sc, EC_QR); /* output a query command */
- cnt = 0;
- while (inb(ec.ec_sc) & EC_IBF) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_query:1: timed-out waiting "
- "for IBF to clear");
- return (-1);
- }
+ if (ec_wait_ibf_clear(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_query:1: timed-out waiting "
+ "for IBF to clear");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
- cnt = 0;
- while (!(inb(ec.ec_sc) & EC_OBF)) {
- cnt += 1;
- drv_usecwait(10);
- if (cnt > 10000) {
- cmn_err(CE_NOTE, "!ec_query:1: timed-out waiting"
- " for OBF to set");
- return (-1);
- }
+ if (ec_wait_obf_set(ec.ec_sc) < 0) {
+ cmn_err(CE_NOTE, "!ec_query:1: timed-out waiting "
+ "for OBF to set");
+ mutex_exit(&ec.ec_mutex);
+ return (-1);
}
- return (inb(ec.ec_base));
+ rv = inb(ec.ec_base);
+ mutex_exit(&ec.ec_mutex);
+ return (rv);
}
static ACPI_STATUS
ec_handler(UINT32 func, ACPI_PHYSICAL_ADDRESS addr, UINT32 width,
ACPI_INTEGER *val, void *context, void *regcontext)
{
- _NOTE(ARGUNUSED(width, context, regcontext))
+ _NOTE(ARGUNUSED(context, regcontext))
int tmp;
+ /*
+ * Add safety checks for BIOSes not strictly compliant
+ * with ACPI spec
+ */
+ if ((width % 8) != 0) {
+ cmn_err(CE_NOTE, "!ec_handler: width %d not multiple of 8",
+ width);
+ return (AE_ERROR);
+ }
+
+ if (width > 8) {
+ cmn_err(CE_NOTE, "!ec_handler: width %d greater than 8", width);
+ return (AE_ERROR);
+ }
+
switch (func) {
case ACPI_READ:
tmp = ec_rd(addr);
@@ -269,8 +267,12 @@ ec_gpe_callback(void *ctx)
_NOTE(ARGUNUSED(ctx))
char query_str[5];
- int query = ec_query();
+ int query;
+ if (!(inb(ec.ec_sc) & EC_SCI))
+ return;
+
+ query = ec_query();
if (query >= 0) {
(void) snprintf(query_str, 5, "_Q%02X", (uint8_t)query);
(void) AcpiEvaluateObject(ec.ec_obj, query_str, NULL, NULL);
@@ -287,6 +289,47 @@ ec_gpe_handler(void *ctx)
return (0);
}
+/*
+ * Busy-wait for IBF to clear
+ * return < 0 for time out, 0 for no error
+ */
+static int
+ec_wait_ibf_clear(int sc_addr)
+{
+ int cnt;
+
+ cnt = 0;
+ while (inb(sc_addr) & EC_IBF) {
+ cnt += 1;
+ drv_usecwait(10);
+ if (cnt > 10000) {
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+/*
+ * Busy-wait for OBF to set
+ * return < 0 for time out, 0 for no error
+ */
+static int
+ec_wait_obf_set(int sc_addr)
+{
+ int cnt;
+
+ cnt = 0;
+ while (!(inb(sc_addr) & EC_OBF)) {
+ cnt += 1;
+ drv_usecwait(10);
+ if (cnt > 10000) {
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+
/*
* Called from AcpiWalkDevices() when an EC device is found
@@ -348,14 +391,22 @@ acpica_install_ec(ACPI_HANDLE obj, UINT32 nest, void *context, void **rv)
* Increment ahead to next struct.
*/
i += 7;
-#if 0
- cmn_err(CE_NOTE, "acpica_install_ec: ec_base = %x ec_sc = %x",
- ec.ec_base, ec.ec_sc);
-#endif
}
AcpiOsFree(crs.Pointer);
/*
+ * Drain the EC data register if something is left over from
+ * legacy mode
+ */
+ if (inb(ec.ec_sc) & EC_OBF) {
+#ifndef DEBUG
+ inb(ec.ec_base); /* read and discard value */
+#else
+ cmn_err(CE_NOTE, "!EC had something: 0x%x\n", inb(ec.ec_base));
+#endif
+ }
+
+ /*
* Get GPE
*/
buf.Length = ACPI_ALLOCATE_BUFFER;
@@ -377,24 +428,33 @@ acpica_install_ec(ACPI_HANDLE obj, UINT32 nest, void *context, void **rv)
AcpiOsFree(buf.Pointer);
/*
- * Enable EC GPE
+ * Initialize EC mutex here
*/
+ mutex_init(&ec.ec_mutex, NULL, MUTEX_DRIVER, NULL);
+ if (AcpiInstallAddressSpaceHandler(obj,
+ ACPI_ADR_SPACE_EC, &ec_handler, &ec_setup, NULL) != AE_OK) {
+ cmn_err(CE_WARN, "!acpica: failed to add EC handler\n");
+ mutex_destroy(&ec.ec_mutex);
+ return (AE_ERROR);
+ }
+
+ /*
+ * Enable EC GPE
+ */
if ((status = AcpiInstallGpeHandler(NULL, gpe, ACPI_GPE_EDGE_TRIGGERED,
ec_gpe_handler, NULL)) != AE_OK) {
cmn_err(CE_WARN, "!acpica: failed to install gpe handler status"
" = %d", status);
+ /*
+ * don't return an error here - GPE won't work but the EC
+ * handler may be OK
+ */
}
status = AcpiSetGpeType(NULL, gpe, ACPI_GPE_TYPE_RUNTIME);
status = AcpiEnableGpe(NULL, gpe, ACPI_NOT_ISR);
- if (AcpiInstallAddressSpaceHandler(obj,
- ACPI_ADR_SPACE_EC, &ec_handler, &ec_setup, NULL) != AE_OK) {
- cmn_err(CE_WARN, "!acpica: failed to add EC handler\n");
- /* should remove GPE handler here */
- }
-
return (AE_OK);
}
diff --git a/usr/src/uts/i86pc/io/acpica/changes.txt b/usr/src/uts/i86pc/io/acpica/changes.txt
index 111708f26c..9b14b07b5c 100644
--- a/usr/src/uts/i86pc/io/acpica/changes.txt
+++ b/usr/src/uts/i86pc/io/acpica/changes.txt
@@ -1,4 +1,364 @@
----------------------------------------
+08 July 2005. Summary of changes for version 20050708:
+
+1) ACPI CA Core Subsystem:
+
+The use of the CPU stack in the debug version of the subsystem
+has been considerably reduced. Previously, a debug structure was
+declared in every function that used the debug macros. This
+structure has been removed in favor of declaring the individual
+elements as parameters to the debug functions. This reduces the
+cumulative stack use during nested execution of ACPI function
+calls at the cost of a small increase in the code size of the
+debug version of the subsystem. With assistance from Alexey
+Starikovskiy and Len Brown.
+
+Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-
+dependent headers to define a macro that will return the current
+function name at runtime (such as __FUNCTION__ or _func_, etc.)
+The function name is used by the debug trace output. If
+ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent
+header, the function name is saved on the CPU stack (one pointer
+per function.) This mechanism is used because apparently there
+exists no standard ANSI-C defined macro that that returns the
+function name.
+
+Redesigned and reimplemented the "Owner ID" mechanism used to
+track namespace objects created/deleted by ACPI tables and
+control method execution. A bitmap is now used to allocate and
+free the IDs, thus solving the wraparound problem present in the
+previous implementation. The size of the namespace node
+descriptor was reduced by 2 bytes as a result (Alexey
+Starikovskiy).
+
+Removed the UINT32_BIT and UINT16_BIT types that were used for
+the bitfield flag definitions within the headers for the
+predefined ACPI tables. These have been replaced by UINT8_BIT in
+order to increase the code portability of the subsystem. If the
+use of UINT8 remains a problem, we may be forced to eliminate
+bitfields entirely because of a lack of portability.
+
+Enhanced the performance of the AcpiUtUpdateObjectReference
+procedure. This is a frequently used function and this
+improvement increases the performance of the entire subsystem
+(Alexey Starikovskiy).
+
+Fixed several possible memory leaks and the inverse - premature
+object deletion (Alexey Starikovskiy).
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total
+ Debug Version: 165.2K Code, 69.6K Data, 234.8K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total
+ Debug Version: 170.0K Code, 69.7K Data, 239.7K Total
+
+----------------------------------------
+24 June 2005. Summary of changes for version 20050624:
+
+1) ACPI CA Core Subsystem:
+
+Modified the new OSL cache interfaces to use ACPI_CACHE_T as the
+type for the host-defined cache object. This allows the OSL
+implementation to define and type this object in any manner
+desired, simplifying the OSL implementation. For example,
+ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be
+defined in the OS-specific header file for other operating
+systems as required.
+
+Changed the interface to AcpiOsAcquireObject to directly return
+the requested object as the function return (instead of
+ACPI_STATUS.) This change was made for performance reasons, since
+this is the purpose of the interface in the first place.
+AcpiOsAcquireObject is now similar to the AcpiOsAllocate
+interface.
+
+Implemented a new AML debugger command named Businfo. This
+command displays information about all devices that have an
+associate _PRT object. The _ADR, _HID, _UID, and _CID are
+displayed for these devices.
+
+Modified the initialization sequence in AcpiInitializeSubsystem
+to call the OSL interface AcpiOslInitialize first, before any
+local initialization. This change was required because the global
+initialization now calls OSL interfaces.
+
+Enhanced the Dump command to display the entire contents of
+Package objects (including all sub-objects and their values.)
+
+Restructured the code base to split some files because of size
+and/or because the code logically belonged in a separate file.
+New files are listed below. All makefiles and project files
+included in the ACPI CA release have been updated.
+ utilities/utcache.c /* Local cache interfaces */
+ utilities/utmutex.c /* Local mutex support */
+ utilities/utstate.c /* State object support */
+ interpreter/parser/psloop.c /* Main AML parse loop */
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total
+ Debug Version: 164.0K Code, 69.1K Data, 233.1K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total
+ Debug Version: 165.2K Code, 69.6K Data, 234.8K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a regression introduced in version 20050513 where the use
+of a Package object within a Case() statement caused a compile
+time exception. The original behavior has been restored (a
+Match() operator is emitted.)
+
+----------------------------------------
+17 June 2005. Summary of changes for version 20050617:
+
+1) ACPI CA Core Subsystem:
+
+Moved the object cache operations into the OS interface layer
+(OSL) to allow the host OS to handle these operations if desired
+(for example, the Linux OSL will invoke the slab allocator). This
+support is optional; the compile time define ACPI_USE_LOCAL_CACHE
+may be used to utilize the original cache code in the ACPI CA
+core. The new OSL interfaces are shown below. See utalloc.c for
+an example implementation, and acpiosxf.h for the exact interface
+definitions. With assistance from Alexey Starikovskiy.
+ AcpiOsCreateCache
+ AcpiOsDeleteCache
+ AcpiOsPurgeCache
+ AcpiOsAcquireObject
+ AcpiOsReleaseObject
+
+Modified the interfaces to AcpiOsAcquireLock and
+AcpiOsReleaseLock to return and restore a flags parameter. This
+fits better with many OS lock models. Note: the current execution
+state (interrupt handler or not) is no longer passed to these
+interfaces. If necessary, the OSL must determine this state by
+itself, a simple and fast operation. With assistance from Alexey
+Starikovskiy.
+
+Fixed a problem in the ACPI table handling where a valid XSDT was
+assumed present if the revision of the RSDP was 2 or greater.
+According to the ACPI specification, the XSDT is optional in all
+cases, and the table manager therefore now checks for both an
+RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is
+used. Some ACPI 2.0 compliant BIOSs contain only the RSDT.
+
+Fixed an interpreter problem with the Mid() operator in the case
+of an input string where the resulting output string is of zero
+length. It now correctly returns a valid, null terminated string
+object instead of a string object with a null pointer.
+
+Fixed a problem with the control method argument handling to
+allow a store to an Arg object that already contains an object of
+type Device. The Device object is now correctly overwritten.
+Previously, an error was returned.
+
+Enhanced the debugger Find command to emit object values in
+addition to the found object pathnames. The output format is the
+same as the dump namespace command.
+
+Enhanced the debugger Set command. It now has the ability to set
+the value of any Named integer object in the namespace
+(Previously, only method locals and args could be set.)
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total
+ Debug Version: 164.0K Code, 69.3K Data, 233.3K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total
+ Debug Version: 164.0K Code, 69.1K Data, 233.1K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a regression in the disassembler where if/else/while
+constructs were output incorrectly. This problem was introduced
+in the previous release (20050526). This problem also affected
+the single-step disassembly in the debugger.
+
+Fixed a problem where compiling the reserved _OSI method would
+randomly (but rarely) produce compile errors.
+
+Enhanced the disassembler to emit compilable code in the face of
+incorrect AML resource descriptors. If the optional
+ResourceSourceIndex is present, but the ResourceSource is not, do
+not emit the ResourceSourceIndex in the disassembly. Otherwise,
+the resulting code cannot be compiled without errors.
+
+----------------------------------------
+26 May 2005. Summary of changes for version 20050526:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support to execute Type 1 and Type 2 AML opcodes
+appearing at the module level (not within a control method.)
+These opcodes are executed exactly once at the time the table is
+loaded. This type of code was legal up until the release of ACPI
+2.0B (2002) and is now supported within ACPI CA in order to
+provide backwards compatibility with earlier BIOS
+implementations. This eliminates the "Encountered executable code
+at module level" warning that was previously generated upon
+detection of such code.
+
+Fixed a problem in the interpreter where an AE_NOT_FOUND
+exception could inadvertently be generated during the lookup of
+namespace objects in the second pass parse of ACPI tables and
+control methods. It appears that this problem could occur during
+the resolution of forward references to namespace objects.
+
+Added the ACPI_MUTEX_DEBUG #ifdef to the AcpiUtReleaseMutex
+function, corresponding to the same #ifdef in the
+AcpiUtAcquireMutex function. This allows the deadlock detection
+debug code to be compiled out in the normal case, improving mutex
+performance (and overall subsystem performance) considerably.
+
+Implemented a handful of miscellaneous fixes for possible memory
+leaks on error conditions and error handling control paths. These
+fixes were suggested by FreeBSD and the Coverity Prevent source
+code analysis tool.
+
+Added a check for a null RSDT pointer in AcpiGetFirmwareTable
+(tbxfroot.c) to prevent a fault in this error case.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+ Current Release:
+ Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total
+ Debug Version: 164.0K Code, 69.3K Data, 233.3K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Implemented support to allow Type 1 and Type 2 ASL operators to
+appear at the module level (not within a control method.) These
+operators will be executed once at the time the table is loaded.
+This type of code was legal up until the release of ACPI 2.0B
+(2002) and is now supported by the iASL compiler in order to
+provide backwards compatibility with earlier BIOS ASL code.
+
+The ACPI integer width (specified via the table revision ID or
+the -r override, 32 or 64 bits) is now used internally during
+compile-time constant folding to ensure that constants are
+truncated to 32 bits if necessary. Previously, the revision ID
+value was only emitted in the AML table header.
+
+An error message is now generated for the Mutex and Method
+operators if the SyncLevel parameter is outside the legal range
+of 0 through 15.
+
+Fixed a problem with the Method operator ParameterTypes list
+handling (ACPI 3.0). Previously, more than 2 types or 2 arguments
+generated a syntax error. The actual underlying implementation
+of method argument typechecking is still under development,
+however.
+
+----------------------------------------
+13 May 2005. Summary of changes for version 20050513:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support for PCI Express root bridges -- added support
+for device PNP0A08 in the root bridge search within
+AcpiEvPciConfigRegionSetup.
+
+The interpreter now automatically truncates incoming 64-bit
+constants to 32 bits if currently executing out of a 32-bit ACPI
+table (Revision < 2). This also affects the iASL compiler
+constant folding. (Note: as per below, the iASL compiler no
+longer allows 64-bit constants within 32-bit tables.)
+
+Fixed a problem where string and buffer objects with "static"
+pointers (pointers to initialization data within an ACPI table)
+were not handled consistently. The internal object copy operation
+now always copies the data to a newly allocated buffer,
+regardless of whether the source object is static or not.
+
+Fixed a problem with the FromBCD operator where an implicit
+result conversion was improperly performed while storing the
+result to the target operand. Since this is an "explicit
+conversion" operator, the implicit conversion should never be
+performed on the output.
+
+Fixed a problem with the CopyObject operator where a copy to an
+existing named object did not always completely overwrite the
+existing object stored at name. Specifically, a buffer-to-buffer
+copy did not delete the existing buffer.
+
+Replaced "InterruptLevel" with "InterruptNumber" in all GPE
+interfaces and structs for consistency.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+ Current Release: (Same sizes)
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+
+
+2) iASL Compiler/Disassembler:
+
+The compiler now emits a warning if an attempt is made to
+generate a 64-bit integer constant from within a 32-bit ACPI
+table (Revision < 2). The integer is truncated to 32 bits.
+
+Fixed a problem with large package objects: if the static length
+of the package is greater than 255, the "variable length package"
+opcode is emitted. Previously, this caused an error. This
+requires an update to the ACPI spec, since it currently
+(incorrectly) states that packages larger than 255 elements are
+not allowed.
+
+The disassembler now correctly handles variable length packages
+and packages larger than 255 elements.
+
+----------------------------------------
08 April 2005. Summary of changes for version 20050408:
1) ACPI CA Core Subsystem:
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c b/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c
index a09d8c5b1f..4ba5758a42 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 121 $
+ * $Revision: 127 $
*
******************************************************************************/
@@ -162,6 +162,9 @@ AcpiDbWalkForSpecificObjects (
void *Context,
void **ReturnValue);
+static ACPI_NAMESPACE_NODE *
+AcpiDbConvertToNode (
+ char *InString);
/*
* Arguments for the Objects command
@@ -171,7 +174,7 @@ AcpiDbWalkForSpecificObjects (
static ARGUMENT_INFO AcpiDbObjectTypes [] =
{
{"ANY"},
- {"NUMBERS"},
+ {"INTEGERS"},
{"STRINGS"},
{"BUFFERS"},
{"PACKAGES"},
@@ -192,6 +195,64 @@ static ARGUMENT_INFO AcpiDbObjectTypes [] =
/*******************************************************************************
*
+ * FUNCTION: AcpiDbConvertToNode
+ *
+ * PARAMETERS: InString - String to convert
+ *
+ * RETURN: Pointer to a NS node
+ *
+ * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
+ * alpha strings.
+ *
+ ******************************************************************************/
+
+static ACPI_NAMESPACE_NODE *
+AcpiDbConvertToNode (
+ char *InString)
+{
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ if ((*InString >= 0x30) && (*InString <= 0x39))
+ {
+ /* Numeric argument, convert */
+
+ Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
+ if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
+ {
+ AcpiOsPrintf ("Address %p is invalid in this address space\n",
+ Node);
+ return (NULL);
+ }
+
+ /* Make sure pointer is valid NS node */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
+ Node, AcpiUtGetDescriptorName (Node));
+ return (NULL);
+ }
+ }
+ else
+ {
+ /* Alpha argument */
+ /* The parameter is a name string that must be resolved to a
+ * Named obj
+ */
+ Node = AcpiDbLocalNsLookup (InString);
+ if (!Node)
+ {
+ Node = AcpiGbl_RootNode;
+ }
+ }
+
+ return (Node);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbSleep
*
* PARAMETERS: ObjectArg - Desired sleep state (0-5)
@@ -335,7 +396,7 @@ AcpiDbDisplayLocks (
for (i = 0; i < MAX_MUTEX; i++)
{
AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
- AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
+ AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
? "Locked" : "Unlocked");
}
}
@@ -574,7 +635,7 @@ AcpiDbDisassembleMethod (
ACPI_NAMESPACE_NODE *Method;
- Method = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ACPI_STRTOUL (Name, NULL, 16));
+ Method = AcpiDbConvertToNode (Name);
if (!Method)
{
return (AE_BAD_PARAMETER);
@@ -607,6 +668,7 @@ AcpiDbDisassembleMethod (
/* Parse the AML */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
AcpiDmDisassemble (NULL, Op, 0);
@@ -642,36 +704,10 @@ AcpiDbDumpNamespace (
if (StartArg)
{
- /* Check if numeric argument, must be a Node */
-
- if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39))
- {
- SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16));
- if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE)))
- {
- AcpiOsPrintf ("Address %p is invalid in this address space\n",
- SubtreeEntry);
- return;
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED)
- {
- AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
- SubtreeEntry, AcpiUtGetDescriptorName (SubtreeEntry));
- return;
- }
- }
- else
+ SubtreeEntry = AcpiDbConvertToNode (StartArg);
+ if (!SubtreeEntry)
{
- /* Alpha argument */
- /* The parameter is a name string that must be resolved to a
- * Named obj
- */
- SubtreeEntry = AcpiDbLocalNsLookup (StartArg);
- if (!SubtreeEntry)
- {
- SubtreeEntry = AcpiGbl_RootNode;
- }
+ return;
}
/* Now we can check for the depth argument */
@@ -683,13 +719,14 @@ AcpiDbDumpNamespace (
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry);
+ AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
+ &((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name, SubtreeEntry);
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
- ACPI_UINT32_MAX, SubtreeEntry);
+ ACPI_OWNER_ID_MAX, SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -714,10 +751,10 @@ AcpiDbDumpNamespaceByOwner (
{
ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
UINT32 MaxDepth = ACPI_UINT32_MAX;
- UINT16 OwnerId;
+ ACPI_OWNER_ID OwnerId;
- OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0);
+ OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
/* Now we can check for the depth argument */
@@ -763,7 +800,7 @@ AcpiDbSendNotify (
/* Translate name to an Named object */
- Node = AcpiDbLocalNsLookup (Name);
+ Node = AcpiDbConvertToNode (Name);
if (!Node)
{
return;
@@ -819,6 +856,7 @@ AcpiDbSetMethodData (
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
/* Validate TypeArg */
@@ -826,16 +864,31 @@ AcpiDbSetMethodData (
AcpiUtStrupr (TypeArg);
Type = TypeArg[0];
if ((Type != 'L') &&
- (Type != 'A'))
+ (Type != 'A') &&
+ (Type != 'N'))
{
AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
return;
}
+ Value = ACPI_STRTOUL (ValueArg, NULL, 16);
+
+ if (Type == 'N')
+ {
+ Node = AcpiDbConvertToNode (IndexArg);
+ if (Node->Type != ACPI_TYPE_INTEGER)
+ {
+ AcpiOsPrintf ("Can only set Integer nodes\n");
+ return;
+ }
+ ObjDesc = Node->Object;
+ ObjDesc->Integer.Value = Value;
+ return;
+ }
+
/* Get the index and value */
Index = ACPI_STRTOUL (IndexArg, NULL, 16);
- Value = ACPI_STRTOUL (ValueArg, NULL, 16);
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
if (!WalkState)
@@ -933,6 +986,7 @@ AcpiDbWalkForSpecificObjects (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
+ ACPI_WALK_INFO Info;
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle);
@@ -947,9 +1001,16 @@ AcpiDbWalkForSpecificObjects (
return (AE_OK);
}
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
ACPI_MEM_FREE (Buffer.Pointer);
+ return (AE_OK);
+#ifdef ACPI_OBSOLETE_CODE
/* Display short information about the object */
if (ObjDesc)
@@ -995,6 +1056,7 @@ AcpiDbWalkForSpecificObjects (
AcpiOsPrintf ("\n");
return (AE_OK);
+#endif
}
@@ -1069,6 +1131,7 @@ AcpiDbWalkAndMatchName (
char *RequestedName = (char *) Context;
UINT32 i;
ACPI_BUFFER Buffer;
+ ACPI_WALK_INFO Info;
/* Check for a name match */
@@ -1096,8 +1159,12 @@ AcpiDbWalkAndMatchName (
}
else
{
- AcpiOsPrintf ("%32s (%p) - %s\n", (char *) Buffer.Pointer, ObjHandle,
- AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type));
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
+ AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
ACPI_MEM_FREE (Buffer.Pointer);
}
@@ -1131,6 +1198,7 @@ AcpiDbFindNameInNamespace (
/* Walk the namespace from the root */
+ AcpiUtStrupr (NameArg);
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NameArg, NULL);
@@ -1226,7 +1294,7 @@ AcpiDbDisplayResources (
{
#if ACPI_MACHINE_WIDTH != 16
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
@@ -1236,7 +1304,11 @@ AcpiDbDisplayResources (
/* Convert string to object pointer */
- ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+ Node = AcpiDbConvertToNode (ObjectArg);
+ if (!Node)
+ {
+ return;
+ }
/* Prepare for a return object of arbitrary size */
@@ -1247,7 +1319,7 @@ AcpiDbDisplayResources (
AcpiOsPrintf ("Evaluating _PRT\n");
- Status = AcpiEvaluateObject (ObjDesc, METHOD_NAME__PRT, NULL, &ReturnObj);
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not obtain _PRT: %s\n",
@@ -1258,7 +1330,7 @@ AcpiDbDisplayResources (
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
+ Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
@@ -1278,7 +1350,7 @@ GetCrs:
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiEvaluateObject (ObjDesc, METHOD_NAME__CRS, NULL, &ReturnObj);
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not obtain _CRS: %s\n",
@@ -1289,7 +1361,7 @@ GetCrs:
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj);
+ Status = AcpiGetCurrentResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
@@ -1302,7 +1374,7 @@ GetCrs:
AcpiGbl_DbBuffer));
}
- Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj);
+ Status = AcpiSetCurrentResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
@@ -1319,7 +1391,7 @@ GetPrs:
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiEvaluateObject (ObjDesc, METHOD_NAME__PRS, NULL, &ReturnObj);
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not obtain _PRS: %s\n",
@@ -1330,7 +1402,7 @@ GetPrs:
ReturnObj.Pointer = AcpiGbl_DbBuffer;
ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj);
+ Status = AcpiGetPossibleResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
@@ -1473,4 +1545,129 @@ AcpiDbGenerateGpe (
(void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbBusWalk
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display info about device objects that have a corresponding
+ * _PRT method.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbBusWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+ ACPI_INTEGER ADR;
+ ACPI_DEVICE_ID Id;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NAMESPACE_NODE *TempNode;
+
+
+ /* Exit if there is no _PRT under this device */
+
+ Status = AcpiGetHandle (Node, METHOD_NAME__PRT, &TempNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Get the full path to this device object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ return (AE_OK);
+ }
+
+ /* Display the full path */
+
+ AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer);
+ ACPI_MEM_FREE (Buffer.Pointer);
+
+ /* _PRT info */
+
+ AcpiOsPrintf ("_PRT=%p", TempNode);
+
+ /* Get the _ADR value */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf (" No _ADR ");
+ }
+ else
+ {
+ AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR);
+ }
+
+ /* Get the _HID if present */
+
+ Status = AcpiUtExecute_HID (Node, &Id);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _HID=%s", Id.Value);
+ }
+ else
+ {
+ AcpiOsPrintf (" ");
+ }
+
+ /* Get the _UID if present */
+
+ Status = AcpiUtExecute_UID (Node, &Id);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _UID=%s", Id.Value);
+ }
+
+ /* Get the _CID if present */
+
+ Status = AcpiUtExecute_CID (Node, &Cid);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value);
+ ACPI_MEM_FREE (Cid);
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetBusInfo
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display info about system busses.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbGetBusInfo (
+ void)
+{
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbBusWalk, NULL, NULL);
+}
+
#endif /* ACPI_DEBUGGER */
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c b/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c
index 585fea8576..c2ae03b9f3 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 66 $
+ * $Revision: 69 $
*
******************************************************************************/
@@ -153,6 +153,12 @@ AcpiDbExecutionWalk (
void *Context,
void **ReturnValue);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static UINT32
+AcpiDbGetCacheInfo (
+ ACPI_MEMORY_LIST *Cache);
+#endif
+
/*******************************************************************************
*
@@ -276,6 +282,16 @@ AcpiDbExecuteSetup (
}
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static UINT32
+AcpiDbGetCacheInfo (
+ ACPI_MEMORY_LIST *Cache)
+{
+
+ return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth);
+}
+#endif
+
/*******************************************************************************
*
* FUNCTION: AcpiDbGetOutstandingAllocations
@@ -297,15 +313,11 @@ AcpiDbGetOutstandingAllocations (
UINT32 Outstanding = 0;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- UINT32 i;
-
- for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++)
- {
- Outstanding += (AcpiGbl_MemoryLists[i].TotalAllocated -
- AcpiGbl_MemoryLists[i].TotalFreed -
- AcpiGbl_MemoryLists[i].CacheDepth);
- }
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache);
#endif
return (Outstanding);
@@ -407,6 +419,7 @@ AcpiDbExecute (
}
else
{
+ AcpiUtStrupr (Name);
AcpiGbl_DbMethodInfo.Name = Name;
AcpiGbl_DbMethodInfo.Args = Args;
AcpiGbl_DbMethodInfo.Flags = Flags;
@@ -454,7 +467,7 @@ AcpiDbExecute (
AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer,
(UINT32) ReturnObj.Length);
- AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
}
else
{
@@ -520,7 +533,7 @@ AcpiDbMethodThread (
{
AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
- AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
}
#endif
}
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c b/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c
index 99b5e0f847..03b348ba18 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 81 $
+ * $Revision: 82 $
*
******************************************************************************/
@@ -135,6 +135,9 @@
FILE *AcpiGbl_DebugFile = NULL;
#endif
+
+#ifdef ACPI_DEBUGGER
+
/* Local prototypes */
static ACPI_STATUS
@@ -148,7 +151,6 @@ AeLocalLoadTable (
ACPI_TABLE_HEADER *TablePtr);
-#ifdef ACPI_DEBUGGER
/*******************************************************************************
*
* FUNCTION: AcpiDbCloseDebugFile
@@ -217,7 +219,6 @@ AcpiDbOpenDebugFile (
#ifdef ACPI_APPLICATION
-
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckTextModeCorruption
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c b/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c
index 711160ff24..9d638261a3 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 107 $
+ * $Revision: 109 $
*
******************************************************************************/
@@ -161,6 +161,7 @@ enum AcpiExDebuggerCommands
CMD_ARGS,
CMD_ARGUMENTS,
CMD_BREAKPOINT,
+ CMD_BUSINFO,
CMD_CALL,
CMD_CLOSE,
CMD_DEBUG,
@@ -220,6 +221,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"ARGS", 0},
{"ARGUMENTS", 0},
{"BREAKPOINT", 1},
+ {"BUSINFO", 0},
{"CALL", 0},
{"CLOSE", 0},
{"DEBUG", 1},
@@ -288,6 +290,8 @@ AcpiDbDisplayHelp (
char *HelpType)
{
+ AcpiUtStrupr (HelpType);
+
/* No parameter, just give the overview */
if (!HelpType)
@@ -342,20 +346,22 @@ AcpiDbDisplayHelp (
case 'N':
AcpiOsPrintf ("\nNamespace Access Commands\n\n");
+ AcpiOsPrintf ("Businfo Display system bus info\n");
AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n");
AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
- AcpiOsPrintf ("Find <Name> (? is wildcard) Find ACPI name(s) with wildcards\n");
+ AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
AcpiOsPrintf ("Gpes Display info on all GPEs\n");
AcpiOsPrintf ("Integrity Validate namespace integrity\n");
- AcpiOsPrintf ("Method Display list of loaded control methods\n");
- AcpiOsPrintf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
- AcpiOsPrintf ("Notify <NamePath> <Value> Send a notification\n");
+ AcpiOsPrintf ("Methods Display list of loaded control methods\n");
+ AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
+ 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 ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
- AcpiOsPrintf ("Resources xxx Get and display resources\n");
+ AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
+ AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
@@ -485,7 +491,6 @@ AcpiDbGetLine (
ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
- AcpiUtStrupr (AcpiGbl_DbParsedBuf);
This = AcpiGbl_DbParsedBuf;
for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
@@ -631,6 +636,10 @@ AcpiDbCommandDispatch (
AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
break;
+ case CMD_BUSINFO:
+ AcpiDbGetBusInfo ();
+ break;
+
case CMD_CALL:
AcpiDbSetMethodCallBreakpoint (Op);
Status = AE_OK;
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c b/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c
index 4f915e9f46..9bbd1aac2f 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 75 $
+ * $Revision: 78 $
*
******************************************************************************/
@@ -168,6 +168,74 @@ static ARGUMENT_INFO AcpiDbStatTypes [] =
/*******************************************************************************
*
+ * FUNCTION: AcpiDbListInfo
+ *
+ * PARAMETERS: List - Memory list/cache to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about the input memory list or cache.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbListInfo (
+ ACPI_MEMORY_LIST *List)
+{
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Outstanding;
+ UINT32 Temp;
+#endif
+
+ AcpiOsPrintf ("\n%s\n", List->ListName);
+
+ /* MaxDepth > 0 indicates a cache object */
+
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
+ List->CurrentDepth,
+ List->MaxDepth,
+ List->MaxDepth - List->CurrentDepth,
+ (List->CurrentDepth * List->ObjectSize));
+ }
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
+ List->Requests,
+ List->Hits,
+ List->Requests - List->Hits,
+ List->ObjectSize);
+ }
+
+ Outstanding = List->TotalAllocated -
+ List->TotalFreed -
+ List->CurrentDepth;
+
+ if (List->ObjectSize)
+ {
+ Temp = ACPI_ROUND_UP_TO_1K (Outstanding * List->ObjectSize);
+ }
+ else
+ {
+ Temp = ACPI_ROUND_UP_TO_1K (List->CurrentTotalSize);
+ }
+
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ Outstanding, Temp);
+#endif
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbEnumerateObject
*
* PARAMETERS: ObjDesc - Object to be counted
@@ -387,11 +455,7 @@ AcpiDbDisplayStatistics (
char *TypeArg)
{
UINT32 i;
- UINT32 Type;
- UINT32 Size;
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- UINT32 Outstanding;
-#endif
+ UINT32 Temp;
if (!AcpiGbl_DSDT)
@@ -406,15 +470,15 @@ AcpiDbDisplayStatistics (
}
AcpiUtStrupr (TypeArg);
- Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
- if (Type == (UINT32) -1)
+ Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
+ if (Temp == (UINT32) -1)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
- switch (Type)
+ switch (Temp)
{
case CMD_STAT_ALLOCATIONS:
@@ -459,46 +523,15 @@ AcpiDbDisplayStatistics (
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
- for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
- {
- AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
-
- if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
- {
- AcpiOsPrintf (
- " Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
- (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
-
- AcpiOsPrintf (
- " Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheRequests,
- AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].ObjectSize);
- }
-
- Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
- AcpiGbl_MemoryLists[i].TotalFreed -
- AcpiGbl_MemoryLists[i].CacheDepth;
-
- if (AcpiGbl_MemoryLists[i].ObjectSize)
- {
- Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
- }
- else
- {
- Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
- }
-
- AcpiOsPrintf (
- " Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
- AcpiGbl_MemoryLists[i].TotalAllocated,
- AcpiGbl_MemoryLists[i].TotalFreed,
- Outstanding, Size);
- }
+ AcpiDbListInfo (AcpiGbl_GlobalList);
+ AcpiDbListInfo (AcpiGbl_NsNodeList);
+
+#ifdef ACPI_USE_LOCAL_CACHE
+ AcpiDbListInfo (AcpiGbl_OperandCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
+ AcpiDbListInfo (AcpiGbl_StateCache);
+#endif
#endif
break;
@@ -563,12 +596,12 @@ AcpiDbDisplayStatistics (
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG_OUTPUT)
- Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
+ Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
- AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
+ AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
#endif
break;
diff --git a/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c b/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c
index 2b171bf4b2..ce8eae082f 100644
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c
+++ b/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 73 $
+ * $Revision: 74 $
*
******************************************************************************/
@@ -215,7 +215,7 @@ AcpiDbSetOutputDestination (
/*******************************************************************************
*
- * FUNCTION: AcpiDbDumpObject
+ * FUNCTION: AcpiDbDumpExternalObject
*
* PARAMETERS: ObjDesc - External ACPI object to dump
* Level - Nesting level.
@@ -227,7 +227,7 @@ AcpiDbSetOutputDestination (
******************************************************************************/
void
-AcpiDbDumpObject (
+AcpiDbDumpExternalObject (
ACPI_OBJECT *ObjDesc,
UINT32 Level)
{
@@ -294,7 +294,7 @@ AcpiDbDumpObject (
for (i = 0; i < ObjDesc->Package.Count; i++)
{
- AcpiDbDumpObject (&ObjDesc->Package.Elements[i], Level+1);
+ AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1);
}
break;
@@ -320,7 +320,7 @@ AcpiDbDumpObject (
default:
- AcpiOsPrintf ("[Unknown Type] %X \n", ObjDesc->Type);
+ AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type);
break;
}
}
diff --git a/usr/src/uts/i86pc/io/acpica/events/evgpe.c b/usr/src/uts/i86pc/io/acpica/events/evgpe.c
index d27ed77d6e..da17bb1ac7 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evgpe.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evgpe.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
- * $Revision: 49 $
+ * $Revision: 50 $
*
*****************************************************************************/
@@ -486,6 +486,7 @@ AcpiEvGpeDetect (
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 StatusReg;
UINT32 EnableReg;
+ UINT32 Flags;
ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_NATIVE_UINT i;
@@ -503,7 +504,7 @@ AcpiEvGpeDetect (
/* Examine all GPE blocks attached to this interrupt level */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
@@ -574,7 +575,7 @@ AcpiEvGpeDetect (
UnlockAndExit:
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
diff --git a/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c b/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c
index 7f3850354b..15c95eaabc 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
- * $Revision: 43 $
+ * $Revision: 45 $
*
*****************************************************************************/
@@ -139,7 +139,7 @@ AcpiEvMatchPrwAndGpe (
static ACPI_GPE_XRUPT_INFO *
AcpiEvGetGpeXruptBlock (
- UINT32 InterruptLevel);
+ UINT32 InterruptNumber);
static ACPI_STATUS
AcpiEvDeleteGpeXrupt (
@@ -148,7 +148,7 @@ AcpiEvDeleteGpeXrupt (
static ACPI_STATUS
AcpiEvInstallGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock,
- UINT32 InterruptLevel);
+ UINT32 InterruptNumber);
static ACPI_STATUS
AcpiEvCreateGpeInfoBlocks (
@@ -214,7 +214,6 @@ AcpiEvValidGpeEvent (
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
- * Flags - ACPI_NOT_ISR or ACPI_ISR
*
* RETURN: Status
*
@@ -224,18 +223,18 @@ AcpiEvValidGpeEvent (
ACPI_STATUS
AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- UINT32 Flags)
+ ACPI_GPE_CALLBACK GpeWalkCallback)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_STATUS Status = AE_OK;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("EvWalkGpeList");
- AcpiOsAcquireLock (AcpiGbl_GpeLock, Flags);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Walk the interrupt level descriptor list */
@@ -575,7 +574,7 @@ Cleanup:
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
- * PARAMETERS: InterruptLevel - Interrupt for a GPE block
+ * PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
@@ -588,11 +587,12 @@ Cleanup:
static ACPI_GPE_XRUPT_INFO *
AcpiEvGetGpeXruptBlock (
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
ACPI_GPE_XRUPT_INFO *GpeXrupt;
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
@@ -603,7 +603,7 @@ AcpiEvGetGpeXruptBlock (
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
while (NextGpeXrupt)
{
- if (NextGpeXrupt->InterruptLevel == InterruptLevel)
+ if (NextGpeXrupt->InterruptNumber == InterruptNumber)
{
return_PTR (NextGpeXrupt);
}
@@ -619,11 +619,11 @@ AcpiEvGetGpeXruptBlock (
return_PTR (NULL);
}
- GpeXrupt->InterruptLevel = InterruptLevel;
+ GpeXrupt->InterruptNumber = InterruptNumber;
/* Install new interrupt descriptor with spin lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (AcpiGbl_GpeXruptListHead)
{
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
@@ -639,19 +639,19 @@ AcpiEvGetGpeXruptBlock (
{
AcpiGbl_GpeXruptListHead = GpeXrupt;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Install new interrupt handler if not SCI_INT */
- if (InterruptLevel != AcpiGbl_FADT->SciInt)
+ if (InterruptNumber != AcpiGbl_FADT->SciInt)
{
- Status = AcpiOsInstallInterruptHandler (InterruptLevel,
+ Status = AcpiOsInstallInterruptHandler (InterruptNumber,
AcpiEvGpeXruptHandler, GpeXrupt);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not install GPE interrupt handler at level 0x%X\n",
- InterruptLevel));
+ InterruptNumber));
return_PTR (NULL);
}
}
@@ -678,6 +678,7 @@ AcpiEvDeleteGpeXrupt (
ACPI_GPE_XRUPT_INFO *GpeXrupt)
{
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
@@ -685,7 +686,7 @@ AcpiEvDeleteGpeXrupt (
/* We never want to remove the SCI interrupt handler */
- if (GpeXrupt->InterruptLevel == AcpiGbl_FADT->SciInt)
+ if (GpeXrupt->InterruptNumber == AcpiGbl_FADT->SciInt)
{
GpeXrupt->GpeBlockListHead = NULL;
return_ACPI_STATUS (AE_OK);
@@ -693,7 +694,7 @@ AcpiEvDeleteGpeXrupt (
/* Disable this interrupt */
- Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptLevel,
+ Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptNumber,
AcpiEvGpeXruptHandler);
if (ACPI_FAILURE (Status))
{
@@ -702,7 +703,7 @@ AcpiEvDeleteGpeXrupt (
/* Unlink the interrupt block with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeXrupt->Previous)
{
GpeXrupt->Previous->Next = GpeXrupt->Next;
@@ -712,7 +713,7 @@ AcpiEvDeleteGpeXrupt (
{
GpeXrupt->Next->Previous = GpeXrupt->Previous;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Free the block */
@@ -726,7 +727,7 @@ AcpiEvDeleteGpeXrupt (
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
- * InterruptLevel - Level to be associated with this GPE block
+ * InterruptNumber - Xrupt to be associated with this GPE block
*
* RETURN: Status
*
@@ -737,11 +738,12 @@ AcpiEvDeleteGpeXrupt (
static ACPI_STATUS
AcpiEvInstallGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock,
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_GPE_BLOCK_INFO *NextGpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
@@ -753,7 +755,7 @@ AcpiEvInstallGpeBlock (
return_ACPI_STATUS (Status);
}
- GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptLevel);
+ GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptNumber);
if (!GpeXruptBlock)
{
Status = AE_NO_MEMORY;
@@ -762,7 +764,7 @@ AcpiEvInstallGpeBlock (
/* Install the new block at the end of the list with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeXruptBlock->GpeBlockListHead)
{
NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
@@ -780,7 +782,7 @@ AcpiEvInstallGpeBlock (
}
GpeBlock->XruptBlock = GpeXruptBlock;
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@@ -805,6 +807,7 @@ AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
@@ -834,7 +837,7 @@ AcpiEvDeleteGpeBlock (
{
/* Remove the block on this interrupt with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeBlock->Previous)
{
GpeBlock->Previous->Next = GpeBlock->Next;
@@ -848,7 +851,7 @@ AcpiEvDeleteGpeBlock (
{
GpeBlock->Next->Previous = GpeBlock->Previous;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
}
/* Free the GpeBlock */
@@ -1012,7 +1015,7 @@ ErrorExit:
* GpeBlockAddress - Address and SpaceID
* RegisterCount - Number of GPE register pairs in the block
* GpeBlockBaseNumber - Starting GPE number for the block
- * InterruptLevel - H/W interrupt for the block
+ * InterruptNumber - H/W interrupt for the block
* ReturnGpeBlock - Where the new block descriptor is returned
*
* RETURN: Status
@@ -1027,7 +1030,7 @@ AcpiEvCreateGpeBlock (
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
UINT8 GpeBlockBaseNumber,
- UINT32 InterruptLevel,
+ UINT32 InterruptNumber,
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
@@ -1076,7 +1079,7 @@ AcpiEvCreateGpeBlock (
/* Install the new block in the global list(s) */
- Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptLevel);
+ Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
if (ACPI_FAILURE (Status))
{
ACPI_MEM_FREE (GpeBlock);
@@ -1147,7 +1150,7 @@ AcpiEvCreateGpeBlock (
((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
GpeDevice->Name.Ascii,
GpeBlock->RegisterCount,
- InterruptLevel));
+ InterruptNumber));
/* Enable all valid GPEs found above */
diff --git a/usr/src/uts/i86pc/io/acpica/events/evmisc.c b/usr/src/uts/i86pc/io/acpica/events/evmisc.c
index 0f8e32a26a..85ba646831 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evmisc.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evmisc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
- * $Revision: 83 $
+ * $Revision: 84 $
*
*****************************************************************************/
@@ -693,7 +693,7 @@ AcpiEvTerminate (
/* Disable all GPEs in all GPE blocks */
- Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, ACPI_NOT_ISR);
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
/* Remove SCI handler */
@@ -707,7 +707,7 @@ AcpiEvTerminate (
/* Deallocate all handler objects installed within GPE info structs */
- Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, ACPI_NOT_ISR);
+ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
/* Return to original mode if necessary */
diff --git a/usr/src/uts/i86pc/io/acpica/events/evrgnini.c b/usr/src/uts/i86pc/io/acpica/events/evrgnini.c
index f28cb12838..39aa4e4a4a 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evrgnini.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- * $Revision: 76 $
+ * $Revision: 78 $
*
*****************************************************************************/
@@ -304,10 +304,14 @@ AcpiEvPciConfigRegionSetup (
Status = AcpiUtExecute_HID (PciRootNode, &ObjectHID);
if (ACPI_SUCCESS (Status))
{
- /* Got a valid _HID, check if this is a PCI root */
-
+ /*
+ * Got a valid _HID string, check if this is a PCI root.
+ * New for ACPI 3.0: check for a PCI Express root also.
+ */
if (!(ACPI_STRNCMP (ObjectHID.Value, PCI_ROOT_HID_STRING,
- sizeof (PCI_ROOT_HID_STRING))))
+ sizeof (PCI_ROOT_HID_STRING)) ||
+ !(ACPI_STRNCMP (ObjectHID.Value, PCI_EXPRESS_ROOT_HID_STRING,
+ sizeof (PCI_EXPRESS_ROOT_HID_STRING)))))
{
/* Install a handler for this PCI root bridge */
diff --git a/usr/src/uts/i86pc/io/acpica/events/evxface.c b/usr/src/uts/i86pc/io/acpica/events/evxface.c
index e3ec8c1581..65863cc967 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evxface.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 149 $
+ * $Revision: 150 $
*
*****************************************************************************/
@@ -677,6 +677,7 @@ AcpiInstallGpeHandler (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
@@ -735,7 +736,7 @@ AcpiInstallGpeHandler (
/* Install the handler */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
GpeEventInfo->Dispatch.Handler = Handler;
/* Setup up dispatch flags to indicate handler (vs. method) */
@@ -743,7 +744,7 @@ AcpiInstallGpeHandler (
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
UnlockAndExit:
@@ -776,6 +777,7 @@ AcpiRemoveGpeHandler (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
+ UINT32 Flags;
ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
@@ -829,7 +831,7 @@ AcpiRemoveGpeHandler (
/* Remove the handler */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
Handler = GpeEventInfo->Dispatch.Handler;
/* Restore Method node (if any), set dispatch flags */
@@ -840,7 +842,7 @@ AcpiRemoveGpeHandler (
{
GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Now we can free the handler object */
diff --git a/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c b/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c
index 109051865d..ef06088758 100644
--- a/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c
+++ b/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 81 $
+ * $Revision: 82 $
*
*****************************************************************************/
@@ -739,7 +739,7 @@ UnlockAndExit:
* PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
* GpeBlockAddress - Address and SpaceID
* RegisterCount - Number of GPE register pairs in the block
- * InterruptLevel - H/W interrupt for the block
+ * InterruptNumber - H/W interrupt for the block
*
* RETURN: Status
*
@@ -752,7 +752,7 @@ AcpiInstallGpeBlock (
ACPI_HANDLE GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
@@ -788,7 +788,7 @@ AcpiInstallGpeBlock (
* is always zero
*/
Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
- 0, InterruptLevel, &GpeBlock);
+ 0, InterruptNumber, &GpeBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
diff --git a/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c b/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c
index 6af62f9447..cc8fe1f3b9 100644
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c
+++ b/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 69 $
+ * $Revision: 70 $
*
*****************************************************************************/
@@ -461,7 +461,7 @@ AcpiHwEnableWakeupGpeBlock (
*
* FUNCTION: AcpiHwDisableAllGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -471,7 +471,7 @@ AcpiHwEnableWakeupGpeBlock (
ACPI_STATUS
AcpiHwDisableAllGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
@@ -479,8 +479,8 @@ AcpiHwDisableAllGpes (
ACPI_FUNCTION_TRACE ("HwDisableAllGpes");
- Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, Flags);
- Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
return_ACPI_STATUS (Status);
}
@@ -489,7 +489,7 @@ AcpiHwDisableAllGpes (
*
* FUNCTION: AcpiHwEnableAllRuntimeGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -499,7 +499,7 @@ AcpiHwDisableAllGpes (
ACPI_STATUS
AcpiHwEnableAllRuntimeGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
@@ -507,7 +507,7 @@ AcpiHwEnableAllRuntimeGpes (
ACPI_FUNCTION_TRACE ("HwEnableAllRuntimeGpes");
- Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
return_ACPI_STATUS (Status);
}
@@ -516,7 +516,7 @@ AcpiHwEnableAllRuntimeGpes (
*
* FUNCTION: AcpiHwEnableAllWakeupGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -526,7 +526,7 @@ AcpiHwEnableAllRuntimeGpes (
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
@@ -534,7 +534,7 @@ AcpiHwEnableAllWakeupGpes (
ACPI_FUNCTION_TRACE ("HwEnableAllWakeupGpes");
- Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
return_ACPI_STATUS (Status);
}
diff --git a/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c b/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c
index 0d81518c9a..0cb2271fd8 100644
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c
+++ b/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 169 $
+ * $Revision: 171 $
*
******************************************************************************/
@@ -184,7 +184,7 @@ AcpiHwClearAcpiStatus (
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
- Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, ACPI_ISR);
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
UnlockAndExit:
if (Flags & ACPI_MTX_LOCK)
@@ -225,7 +225,7 @@ AcpiGetSleepTypeData (
/* Validate parameters */
-
+
if ((SleepState > ACPI_S_STATES_MAX) ||
!SleepTypeA || !SleepTypeB)
{
@@ -233,7 +233,7 @@ AcpiGetSleepTypeData (
}
/* Evaluate the namespace object containing the values for this state */
-
+
Info.Parameters = NULL;
Info.ReturnObject = NULL;
SleepStateName = (char *) AcpiGbl_SleepStateNames[SleepState];
@@ -265,9 +265,9 @@ AcpiGetSleepTypeData (
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
+ * 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).
@@ -281,9 +281,9 @@ AcpiGetSleepTypeData (
/* The first two elements must both be of type Integer */
- else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0])
+ else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0])
!= ACPI_TYPE_INTEGER) ||
- (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1])
+ (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1])
!= ACPI_TYPE_INTEGER))
{
ACPI_REPORT_ERROR ((
@@ -295,10 +295,10 @@ AcpiGetSleepTypeData (
else
{
/* Valid _Sx_ package size, type, and value */
-
- *SleepTypeA = (UINT8)
+
+ *SleepTypeA = (UINT8)
(Info.ReturnObject->Package.Elements[0])->Integer.Value;
- *SleepTypeB = (UINT8)
+ *SleepTypeB = (UINT8)
(Info.ReturnObject->Package.Elements[1])->Integer.Value;
}
diff --git a/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c b/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c
index a900c40137..4d0c58141d 100644
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c
+++ b/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 74 $
+ * $Revision: 75 $
*
*****************************************************************************/
@@ -369,14 +369,14 @@ AcpiEnterSleepState (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
- Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
+ Status = AcpiHwEnableAllWakeupGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -531,14 +531,14 @@ AcpiEnterSleepStateS4bios (
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
- Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
+ Status = AcpiHwEnableAllWakeupGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -671,14 +671,14 @@ AcpiLeaveSleepState (
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_NOT_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = TRUE;
- Status = AcpiHwEnableAllRuntimeGpes (ACPI_NOT_ISR);
+ Status = AcpiHwEnableAllRuntimeGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c
index 5d4fefe4e2..c62624b590 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
- * $Revision: 15 $
+ * $Revision: 16 $
*
*****************************************************************************/
@@ -173,7 +173,7 @@ AcpiDsInitOneObject (
* was just loaded
*/
if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
- Info->TableDesc->TableId)
+ Info->TableDesc->OwnerId)
{
return (AE_OK);
}
@@ -248,7 +248,7 @@ AcpiDsInitOneObject (
*/
AcpiNsDeleteNamespaceSubtree (ObjHandle);
AcpiNsDeleteNamespaceByOwner (
- ((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
+ ((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwnerId);
break;
@@ -318,7 +318,7 @@ AcpiDsInitializeObjects (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- TableDesc->Pointer->Signature, TableDesc->TableId, Info.ObjectCount,
+ TableDesc->Pointer->Signature, TableDesc->OwnerId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c
index 2eed02d9cf..ecc3b294c4 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 105 $
+ * $Revision: 107 $
*
*****************************************************************************/
@@ -151,7 +151,6 @@ AcpiDsParseMethod (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *Op;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OWNER_ID OwnerId;
ACPI_WALK_STATE *WalkState;
@@ -211,15 +210,20 @@ AcpiDsParseMethod (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
- OwnerId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
- ObjDesc->Method.OwningId = OwnerId;
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (
+ ObjDesc->Method.OwnerId, NULL, NULL, NULL);
if (!WalkState)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup2;
}
Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
@@ -228,7 +232,7 @@ AcpiDsParseMethod (
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
+ goto Cleanup2;
}
/*
@@ -243,13 +247,17 @@ AcpiDsParseMethod (
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Cleanup2;
}
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
AcpiUtGetNodeName (ObjHandle), ObjHandle, Op));
+Cleanup2:
+ (void) AcpiUtReleaseOwnerId (ObjDesc->Method.OwnerId);
+
+Cleanup:
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
}
@@ -349,7 +357,7 @@ AcpiDsCallControlMethod (
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *MethodNode;
- ACPI_WALK_STATE *NextWalkState;
+ ACPI_WALK_STATE *NextWalkState = NULL;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARAMETER_INFO Info;
UINT32 i;
@@ -375,22 +383,26 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
-
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
ThisWalkState->MethodNode);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
if (!(ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY))
{
/* 1) Parse: Create a new walk state for the preempting walk */
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
Op, ObjDesc, NULL);
if (!NextWalkState)
{
@@ -423,7 +435,7 @@ AcpiDsCallControlMethod (
/* 2) Execute: Create a new state for the preempting walk */
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
NULL, ObjDesc, Thread);
if (!NextWalkState)
{
@@ -478,6 +490,7 @@ AcpiDsCallControlMethod (
/* On error, we must delete the new walk state */
Cleanup:
+ (void) AcpiUtReleaseOwnerId (ObjDesc->Method.OwnerId);
if (NextWalkState && (NextWalkState->MethodDesc))
{
/* Decrement the thread count on the method parse tree */
@@ -694,7 +707,7 @@ AcpiDsTerminateControlMethod (
* Delete any namespace entries created anywhere else within
* the namespace
*/
- AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
+ AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwnerId);
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c
index e575edc9c1..c4ba0bbe54 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 84 $
+ * $Revision: 85 $
*
******************************************************************************/
@@ -735,23 +735,11 @@ AcpiDsStoreObjectToLocal (
if (Opcode == AML_ARG_OP)
{
/*
- * Make sure that the object is the correct type. This may be
- * overkill, butit is here because references were NS nodes in
- * the past. Now they are operand objects of type Reference.
- */
- if (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) != ACPI_DESC_TYPE_OPERAND)
- {
- ACPI_REPORT_ERROR ((
- "Invalid descriptor type while storing to method arg: [%s]\n",
- AcpiUtGetDescriptorName (CurrentObjDesc)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /*
* If we have a valid reference object that came from RefOf(),
* do the indirect store
*/
- if ((CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
+ (CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c
index b1e54a0cbb..54142893ff 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 123 $
+ * $Revision: 124 $
*
*****************************************************************************/
@@ -653,6 +653,9 @@ AcpiDsInitObjectFromOp (
case AML_TYPE_LITERAL:
ObjDesc->Integer.Value = Op->Common.Value.Integer;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ AcpiExTruncateFor32bitTable (ObjDesc);
+#endif
break;
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c
index 0cd11790f5..dfeb2db1b9 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 102 $
+ * $Revision: 103 $
*
*****************************************************************************/
@@ -195,7 +195,8 @@ AcpiDsExecuteArguments (
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
@@ -203,7 +204,7 @@ AcpiDsExecuteArguments (
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Mark this parse as a deferred opcode */
@@ -216,8 +217,7 @@ AcpiDsExecuteArguments (
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
{
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Get and init the Op created above */
@@ -240,7 +240,8 @@ AcpiDsExecuteArguments (
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
/* Execute the opcode and arguments */
@@ -250,13 +251,15 @@ AcpiDsExecuteArguments (
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Mark this execution as a deferred opcode */
WalkState->DeferredNode = Node;
Status = AcpiPsParseAml (WalkState);
+
+Cleanup:
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
}
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c
index 2080bdbec4..85de3f8e23 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 92 $
+ * $Revision: 96 $
*
*****************************************************************************/
@@ -124,7 +124,7 @@
#include "acnamesp.h"
#include "acevents.h"
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
#include "acdisasm.h"
#endif
@@ -222,16 +222,6 @@ AcpiDsLoad1BeginOp (
{
if (!(WalkState->OpInfo->Flags & AML_NAMED))
{
-#if 0
- if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
- (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
- {
- AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
- WalkState->OpInfo->Name);
- *OutOp = Op;
- return (AE_CTRL_SKIP);
- }
-#endif
*OutOp = Op;
return (AE_OK);
}
@@ -265,7 +255,7 @@ AcpiDsLoad1BeginOp (
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (Status == AE_NOT_FOUND)
{
/*
@@ -588,6 +578,16 @@ AcpiDsLoad2BeginOp (
if (Op)
{
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_CONDITIONAL_EXECUTING))
+ {
+ /* We are executing a while loop outside of a method */
+
+ Status = AcpiDsExecBeginOp (WalkState, OutOp);
+ return_ACPI_STATUS (Status);
+ }
+
/* We only care about Namespace opcodes here */
if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
@@ -597,15 +597,20 @@ AcpiDsLoad2BeginOp (
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
- ACPI_REPORT_WARNING ((
- "Encountered executable code at module level, [%s]\n",
- AcpiPsGetOpcodeName (WalkState->Opcode)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
+ WalkState->OpInfo->Flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ Status = AcpiDsExecBeginOp (WalkState, OutOp);
+ return_ACPI_STATUS (Status);
}
return_ACPI_STATUS (AE_OK);
}
/* Get the name we are going to enter or lookup in the namespace */
-
+
if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
{
/* For Namepath op, get the path string */
@@ -674,7 +679,7 @@ AcpiDsLoad2BeginOp (
WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (Status == AE_NOT_FOUND)
{
Status = AE_OK;
@@ -774,8 +779,10 @@ AcpiDsLoad2BeginOp (
break;
}
+ /* Add new entry into namespace */
+
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node));
break;
}
@@ -786,7 +793,6 @@ AcpiDsLoad2BeginOp (
return_ACPI_STATUS (Status);
}
-
if (!Op)
{
/* Create a new op */
@@ -803,10 +809,7 @@ AcpiDsLoad2BeginOp (
{
Op->Named.Name = Node->Name.Integer;
}
- if (OutOp)
- {
- *OutOp = Op;
- }
+ *OutOp = Op;
}
/*
@@ -853,10 +856,26 @@ AcpiDsLoad2EndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
WalkState->OpInfo->Name, Op, WalkState));
- /* Only interested in opcodes that have namespace objects */
+ /* Check if opcode had an associated namespace object */
if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
{
+#ifndef ACPI_NO_METHOD_EXECUTION
+ /* No namespace object. Executable opcode? */
+
+ if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
+ (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
+ WalkState->OpInfo->Flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ Status = AcpiDsExecEndOp (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+#endif
return_ACPI_STATUS (AE_OK);
}
@@ -866,7 +885,6 @@ AcpiDsLoad2EndOp (
"Ending scope Op=%p State=%p\n", Op, WalkState));
}
-
ObjectType = WalkState->OpInfo->ObjectType;
/*
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c
index b0dc63e2dc..5673293630 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 86 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -345,12 +345,12 @@ AcpiDsResultPopFromBottom (
if (!*Object)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X, Index=%X\n",
+ "Null operand! State=%p #Ops=%X Index=%X\n",
WalkState, State->Results.NumResults, (UINT32) Index));
return (AE_AML_NO_RETURN_VALUE);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
*Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
State, WalkState));
@@ -778,7 +778,7 @@ AcpiDsCreateWalkState (
ACPI_FUNCTION_TRACE ("DsCreateWalkState");
- WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
+ WalkState = ACPI_MEM_CALLOCATE (sizeof (ACPI_WALK_STATE));
if (!WalkState)
{
return_PTR (NULL);
@@ -803,7 +803,7 @@ AcpiDsCreateWalkState (
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
- AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
+ ACPI_MEM_FREE (WalkState);
return_PTR (NULL);
}
@@ -862,6 +862,7 @@ AcpiDsInitAmlWalk (
/* The NextOp of the NextWalk will be the beginning of the method */
WalkState->NextOp = NULL;
+ WalkState->PassNumber = (UINT8) PassNumber;
if (Info)
{
@@ -1018,38 +1019,11 @@ AcpiDsDeleteWalkState (
AcpiUtDeleteGenericState (State);
}
- AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
+ ACPI_MEM_FREE (WalkState);
return_VOID;
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/******************************************************************************
- *
- * FUNCTION: AcpiDsDeleteWalkStateCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiDsDeleteWalkStateCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
- return_VOID;
-}
-#endif
-
-
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c
index 78f2b7d4f5..53dcdd3ee0 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 83 $
+ * $Revision: 85 $
*
*****************************************************************************/
@@ -476,17 +476,23 @@ AcpiExLoadOp (
Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ return_ACPI_STATUS (Status);
}
TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
BufferDesc->Buffer.Pointer);
- /* Sanity check the table length */
+ /* All done with the BufferDesc, delete it */
+
+ BufferDesc->Buffer.Pointer = NULL;
+ AcpiUtRemoveReference (BufferDesc);
+
+ /* Sanity check the table length */
if (TablePtr->Length < sizeof (ACPI_TABLE_HEADER))
{
- return_ACPI_STATUS (AE_BAD_HEADER);
+ Status = AE_BAD_HEADER;
+ goto Cleanup;
}
break;
@@ -516,7 +522,9 @@ AcpiExLoadOp (
Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ /* On error, TablePtr was deallocated above */
+
+ return_ACPI_STATUS (Status);
}
/* Store the DdbHandle into the Target operand */
@@ -525,18 +533,14 @@ AcpiExLoadOp (
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
- }
- return_ACPI_STATUS (Status);
+ /* TablePtr was deallocated above */
+ return_ACPI_STATUS (Status);
+ }
Cleanup:
-
- if (BufferDesc)
- {
- AcpiUtRemoveReference (BufferDesc);
- }
- else
+ if (ACPI_FAILURE (Status))
{
ACPI_MEM_FREE (TablePtr);
}
@@ -589,7 +593,7 @@ AcpiExUnloadTable (
* Delete the entire namespace under this table Node
* (Offset contains the TableId)
*/
- AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
+ AcpiNsDeleteNamespaceByOwner (TableInfo->OwnerId);
/* Delete the table itself */
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c
index cc4f237e8a..5ca29ba3c7 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 66 $
+ * $Revision: 67 $
*
*****************************************************************************/
@@ -458,7 +458,7 @@ AcpiExConvertToAscii (
/* HexLength: 2 ascii hex chars per data byte */
- HexLength = ACPI_MUL_2 (DataWidth);
+ HexLength = (ACPI_NATIVE_UINT) ACPI_MUL_2 (DataWidth);
for (i = 0, j = (HexLength-1); i < HexLength; i++, j--)
{
/* Get one hex digit, most significant digits first */
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c
index c2dcc9fd62..61902d778f 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 182 $
+ * $Revision: 186 $
*
*****************************************************************************/
@@ -125,6 +125,11 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
+/*
+ * The following routines are used for debug output only
+ */
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
/* Local prototypes */
static void
@@ -147,11 +152,16 @@ AcpiExOutAddress (
char *Title,
ACPI_PHYSICAL_ADDRESS Value);
+static void
+AcpiExDumpReference (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+static void
+AcpiExDumpPackage (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Level,
+ UINT32 Index);
-/*
- * The following routines are used for debug output only
- */
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
@@ -193,7 +203,7 @@ AcpiExDumpOperand (
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", ObjDesc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
return;
}
@@ -563,7 +573,7 @@ AcpiExDumpOperands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "************* Stack dump from %s(%d), %s\n",
+ "************* Operand Stack dump from %s(%d), %s\n",
ModuleName, LineNumber, Note));
return;
}
@@ -603,7 +613,7 @@ AcpiExOutInteger (
char *Title,
UINT32 Value)
{
- AcpiOsPrintf ("%20s : %X\n", Title, Value);
+ AcpiOsPrintf ("%20s : %.2X\n", Title, Value);
}
static void
@@ -662,9 +672,156 @@ AcpiExDumpNode (
/*******************************************************************************
*
+ * FUNCTION: AcpiExDumpReference
+ *
+ * PARAMETERS: Object - Descriptor to dump
+ *
+ * DESCRIPTION: Dumps a reference object
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDumpReference (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_BUFFER RetBuf;
+ ACPI_STATUS Status;
+
+
+ if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
+ {
+ AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node);
+ RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not convert name to pathname\n");
+ }
+ else
+ {
+ AcpiOsPrintf ("%s\n", RetBuf.Pointer);
+ ACPI_MEM_FREE (RetBuf.Pointer);
+ }
+ }
+ else if (ObjDesc->Reference.Object)
+ {
+ AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDumpPackage
+ *
+ * PARAMETERS: Object - Descriptor to dump
+ * Level - Indentation Level
+ * Index - Package index for this object
+ *
+ * DESCRIPTION: Dumps the elements of the package
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDumpPackage (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Level,
+ UINT32 Index)
+{
+ UINT32 i;
+
+
+ /* Indentation and index output */
+
+ if (Level > 0)
+ {
+ for (i = 0; i < Level; i++)
+ {
+ AcpiOsPrintf (" ");
+ }
+
+ AcpiOsPrintf ("[%.2d] ", Index);
+ }
+
+ AcpiOsPrintf ("%p ", ObjDesc);
+
+ /* Null package elements are allowed */
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("[Null Object]\n");
+ return;
+ }
+
+ /* Packages may only contain a few object types */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("[String] Value: ");
+ for (i = 0; i < ObjDesc->String.Length; i++)
+ {
+ AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
+ if (ObjDesc->Buffer.Length)
+ {
+ AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n");
+ }
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiOsPrintf ("[Package] Contains %d Elements: \n",
+ ObjDesc->Package.Count);
+
+ for (i = 0; i < ObjDesc->Package.Count; i++)
+ {
+ AcpiExDumpPackage (ObjDesc->Package.Elements[i], Level+1, i);
+ }
+ break;
+
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ AcpiOsPrintf ("[Object Reference] ");
+ AcpiExDumpReference (ObjDesc);
+ break;
+
+
+ default:
+
+ AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiExDumpObjectDescriptor
*
- * PARAMETERS: *Object - Descriptor to dump
+ * PARAMETERS: Object - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the object descriptor given.
@@ -676,9 +833,6 @@ AcpiExDumpObjectDescriptor (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Flags)
{
- UINT32 i;
-
-
ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
@@ -751,25 +905,13 @@ AcpiExDumpObjectDescriptor (
case ACPI_TYPE_PACKAGE:
AcpiExOutInteger ("Flags", ObjDesc->Package.Flags);
- AcpiExOutInteger ("Count", ObjDesc->Package.Count);
- AcpiExOutPointer ("Elements", ObjDesc->Package.Elements);
+ AcpiExOutInteger ("Elements", ObjDesc->Package.Count);
+ AcpiExOutPointer ("Element List", ObjDesc->Package.Elements);
/* Dump the package contents */
- if (ObjDesc->Package.Count > 0)
- {
- AcpiOsPrintf ("\nPackage Contents:\n");
- for (i = 0; i < ObjDesc->Package.Count; i++)
- {
- AcpiOsPrintf ("[%.3d] %p", i, ObjDesc->Package.Elements[i]);
- if (ObjDesc->Package.Elements[i])
- {
- AcpiOsPrintf (" %s",
- AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[i]));
- }
- AcpiOsPrintf ("\n");
- }
- }
+ AcpiOsPrintf ("\nPackage Contents:\n");
+ AcpiExDumpPackage (ObjDesc, 0, 0);
break;
@@ -792,7 +934,7 @@ AcpiExDumpObjectDescriptor (
AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount);
AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency);
AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore);
- AcpiExOutInteger ("OwningId", ObjDesc->Method.OwningId);
+ AcpiExOutInteger ("OwnerId", ObjDesc->Method.OwnerId);
AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength);
AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart);
break;
@@ -897,11 +1039,7 @@ AcpiExDumpObjectDescriptor (
AcpiExOutPointer ("Node", ObjDesc->Reference.Node);
AcpiExOutPointer ("Where", ObjDesc->Reference.Where);
- if (ObjDesc->Reference.Object)
- {
- AcpiOsPrintf ("\nReferenced Object:\n");
- AcpiExDumpObjectDescriptor (ObjDesc->Reference.Object, Flags);
- }
+ AcpiExDumpReference (ObjDesc);
break;
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c
index c53f24a536..84a87a5c65 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 123 $
+ * $Revision: 124 $
*
*****************************************************************************/
@@ -163,6 +163,10 @@ AcpiExReadDataFromField (
{
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ if (!RetBufferDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
{
@@ -268,7 +272,7 @@ Exit:
{
AcpiUtRemoveReference (BufferDesc);
}
- else if (RetBufferDesc)
+ else
{
*RetBufferDesc = BufferDesc;
}
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c
index f176aab1eb..1435dc7ffa 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 130 $
+ * $Revision: 131 $
*
*****************************************************************************/
@@ -386,7 +386,7 @@ AcpiExDoConcatenate (
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
- ReturnDesc = AcpiUtCreateBufferObject (
+ ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
ACPI_MUL_2 (AcpiGbl_IntegerByteWidth));
if (!ReturnDesc)
{
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c
index cd51a5237a..f149a97a79 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 100 $
+ * $Revision: 102 $
*
*****************************************************************************/
@@ -542,6 +542,15 @@ AcpiExGetNameString (
Status = AE_AML_BAD_NAME;
}
+ if (ACPI_FAILURE (Status))
+ {
+ if (NameString)
+ {
+ ACPI_MEM_FREE (NameString);
+ }
+ return_ACPI_STATUS (Status);
+ }
+
*OutNameString = NameString;
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c
index a83de42cb7..506fcab5e3 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 167 $
+ * $Revision: 171 $
*
*****************************************************************************/
@@ -189,8 +189,9 @@ AcpiExOpcode_0A_0T_1R (
Status = AE_NO_MEMORY;
goto Cleanup;
}
-
+#if ACPI_MACHINE_WIDTH != 16
ReturnDesc->Integer.Value = AcpiOsGetTimer ();
+#endif
break;
default: /* Unknown opcode */
@@ -203,17 +204,18 @@ AcpiExOpcode_0A_0T_1R (
Cleanup:
- if (!WalkState->ResultObj)
- {
- WalkState->ResultObj = ReturnDesc;
- }
-
/* Delete return object on error */
- if (ACPI_FAILURE (Status))
+ if ((ACPI_FAILURE (Status)) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
}
+ else
+ {
+ /* Save the return value */
+
+ WalkState->ResultObj = ReturnDesc;
+ }
return_ACPI_STATUS (Status);
}
@@ -1022,6 +1024,7 @@ AcpiExOpcode_1A_0T_1R (
*/
ReturnDesc = AcpiNsGetAttachedObject (
(ACPI_NAMESPACE_NODE *) Operand[0]);
+ AcpiUtAddReference (ReturnDesc);
}
else
{
@@ -1075,21 +1078,11 @@ AcpiExOpcode_1A_0T_1R (
* add another reference to the referenced object, however.
*/
ReturnDesc = *(Operand[0]->Reference.Where);
- if (!ReturnDesc)
+ if (ReturnDesc)
{
- /*
- * We can't return a NULL dereferenced value. This is
- * an uninitialized package element and is thus a
- * severe error.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "NULL package element obj %p\n",
- Operand[0]));
- Status = AE_AML_UNINITIALIZED_ELEMENT;
- goto Cleanup;
+ AcpiUtAddReference (ReturnDesc);
}
- AcpiUtAddReference (ReturnDesc);
break;
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c
index 8c9b60b2bc..acf5a1ffa8 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 24 $
+ * $Revision: 27 $
*
*****************************************************************************/
@@ -237,7 +237,7 @@ AcpiExOpcode_3A_1T_1R (
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- char *Buffer;
+ char *Buffer = NULL;
ACPI_STATUS Status = AE_OK;
ACPI_INTEGER Index;
ACPI_SIZE Length;
@@ -272,19 +272,26 @@ AcpiExOpcode_3A_1T_1R (
* If the index is beyond the length of the String/Buffer, or if the
* requested length is zero, return a zero-length String/Buffer
*/
- if ((Index < Operand[0]->String.Length) &&
- (Length > 0))
+ if (Index >= Operand[0]->String.Length)
{
- /* Truncate request if larger than the actual String/Buffer */
+ Length = 0;
+ }
- if ((Index + Length) >
- Operand[0]->String.Length)
- {
- Length = (ACPI_SIZE) Operand[0]->String.Length -
- (ACPI_SIZE) Index;
- }
+ /* Truncate request if larger than the actual String/Buffer */
+
+ else if ((Index + Length) > Operand[0]->String.Length)
+ {
+ Length = (ACPI_SIZE) Operand[0]->String.Length -
+ (ACPI_SIZE) Index;
+ }
- /* Allocate a new buffer for the String/Buffer */
+ /* Strings always have a sub-pointer, not so for buffers */
+
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+ {
+ case ACPI_TYPE_STRING:
+
+ /* Always allocate a new buffer for the String */
Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
if (!Buffer)
@@ -292,17 +299,43 @@ AcpiExOpcode_3A_1T_1R (
Status = AE_NO_MEMORY;
goto Cleanup;
}
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ /* If the requested length is zero, don't allocate a buffer */
+ if (Length > 0)
+ {
+ /* Allocate a new buffer for the Buffer */
+
+ Buffer = ACPI_MEM_CALLOCATE (Length);
+ if (!Buffer)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+ }
+ break;
+
+ default: /* Should not happen */
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ if (Length > 0)
+ {
/* Copy the portion requested */
ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
Length);
+ }
- /* Set the length of the new String/Buffer */
+ /* Set the length of the new String/Buffer */
- ReturnDesc->String.Pointer = Buffer;
- ReturnDesc->String.Length = (UINT32) Length;
- }
+ ReturnDesc->String.Pointer = Buffer;
+ ReturnDesc->String.Length = (UINT32) Length;
/* Mark buffer initialized */
@@ -326,14 +359,14 @@ Cleanup:
/* Delete return object on error */
- if (ACPI_FAILURE (Status))
+ if (ACPI_FAILURE (Status) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
}
/* Set the return object and exit */
- if (!WalkState->ResultObj)
+ else
{
WalkState->ResultObj = ReturnDesc;
}
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c
index 55d0381598..c7b3e7aa12 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 82 $
+ * $Revision: 85 $
*
*****************************************************************************/
@@ -523,6 +523,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -547,6 +552,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -572,6 +582,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -619,6 +634,11 @@ AcpiExResolveOperands (
{
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
break;
default:
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c
index a6ebc9f5f6..44e455bbcf 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 194 $
+ * $Revision: 196 $
*
*****************************************************************************/
@@ -230,7 +230,7 @@ AcpiExDoDebugObject (
case ACPI_TYPE_BUFFER:
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(UINT32) SourceDesc->Buffer.Length));
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
(SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32);
@@ -677,7 +677,7 @@ AcpiExStoreObjectToNode (
/* If no implicit conversion, drop into the default case below */
- if (!ImplicitConversion)
+ if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP))
{
/* Force execution of default (no implicit conversion) */
@@ -741,7 +741,7 @@ AcpiExStoreObjectToNode (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+ "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node));
/* No conversions for all other types. Just attach the source object */
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c
index ec9f2c92d2..710b00b04d 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c
@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 63 $
+ * $Revision: 64 $
*
*****************************************************************************/
@@ -349,10 +349,6 @@ AcpiExStoreObjectToObject (
case ACPI_TYPE_BUFFER:
- /*
- * Note: There is different store behavior depending on the original
- * source type
- */
Status = AcpiExStoreBufferToBuffer (ActualSrcDesc, DestDesc);
break;
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c
index f6cec4f066..b8f13ceaf9 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 116 $
+ * $Revision: 117 $
*
*****************************************************************************/
@@ -454,7 +454,7 @@ AcpiExEisaIdToString (
*
* RETURN: None, string
*
- * DESCRIPTOIN: Convert a number to string representation. Assumes string
+ * DESCRIPTION: Convert a number to string representation. Assumes string
* buffer is large enough to hold the string.
*
******************************************************************************/
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c
new file mode 100644
index 0000000000..4999b55283
--- /dev/null
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c
@@ -0,0 +1,926 @@
+/******************************************************************************
+ *
+ * Module Name: psloop - Main AML parse loop
+ * $Revision: 3 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2005, 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.
+ *
+ *****************************************************************************/
+
+
+/*
+ * Parse the AML and build an operation tree as most interpreters,
+ * like Perl, do. Parsing is done by hand rather than with a YACC
+ * generated parser to tightly constrain stack and dynamic memory
+ * usage. At the same time, parsing is kept flexible and the code
+ * fairly compact by parsing based on a list of AML opcode
+ * templates in AmlOpInfo[]
+ */
+
+#include "acpi.h"
+#include "acparser.h"
+#include "acdispat.h"
+#include "amlcode.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_PARSER
+ ACPI_MODULE_NAME ("psloop")
+
+static UINT32 AcpiGbl_Depth = 0;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsParseLoop
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ * a tree of ops.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsParseLoop (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status2;
+ ACPI_PARSE_OBJECT *Op = NULL; /* current op */
+ ACPI_PARSE_OBJECT *Arg = NULL;
+ ACPI_PARSE_OBJECT *PreOp = NULL;
+ ACPI_PARSE_STATE *ParserState;
+ UINT8 *AmlOpStart = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
+
+ if (WalkState->DescendingCallback == NULL)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ ParserState = &WalkState->ParserState;
+ WalkState->ArgTypes = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+ if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
+ {
+ /* We are restarting a preempted control method */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ /*
+ * We must check if a predicate to an IF or WHILE statement
+ * was just completed
+ */
+ if ((ParserState->Scope->ParseScope.Op) &&
+ ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
+ (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
+ (WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_PREDICATE_EXECUTING))
+ {
+ /*
+ * A predicate was just completed, get the value of the
+ * predicate and branch based on that value
+ */
+ WalkState->Op = NULL;
+ Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
+ if (ACPI_FAILURE (Status) &&
+ ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
+ {
+ if (Status == AE_AML_NO_RETURN_VALUE)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invoked method did not return a value, %s\n",
+ AcpiFormatException (Status)));
+
+ }
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "GetPredicate Failed, %s\n",
+ AcpiFormatException (Status)));
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ }
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
+ }
+ else if (WalkState->PrevOp)
+ {
+ /* We were in the middle of an op */
+
+ Op = WalkState->PrevOp;
+ WalkState->ArgTypes = WalkState->PrevArgTypes;
+ }
+ }
+#endif
+
+ /* Iterative parsing loop, while there is more AML to process: */
+
+ while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
+ {
+ AmlOpStart = ParserState->Aml;
+ if (!Op)
+ {
+ /* Get the next opcode from the AML stream */
+
+ WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
+ ParserState->AmlStart);
+ WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
+
+ /*
+ * First cut to determine what we have found:
+ * 1) A valid AML opcode
+ * 2) A name string
+ * 3) An unknown/invalid opcode
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+ switch (WalkState->OpInfo->Class)
+ {
+ case AML_CLASS_ASCII:
+ case AML_CLASS_PREFIX:
+ /*
+ * Starts with a valid prefix or ASCII char, this is a name
+ * string. Convert the bare name string to a namepath.
+ */
+ WalkState->Opcode = AML_INT_NAMEPATH_OP;
+ WalkState->ArgTypes = ARGP_NAMESTRING;
+ break;
+
+ case AML_CLASS_UNKNOWN:
+
+ /* The opcode is unrecognized. Just skip unknown opcodes */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+ WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
+
+ ACPI_DUMP_BUFFER (ParserState->Aml, 128);
+
+ /* Assume one-byte bad opcode */
+
+ ParserState->Aml++;
+ continue;
+
+ default:
+
+ /* Found opcode info, this is a normal opcode */
+
+ ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
+ WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
+ break;
+ }
+
+ /* Create Op structure and append to parent's argument list */
+
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ /* Allocate a new PreOp if necessary */
+
+ if (!PreOp)
+ {
+ PreOp = AcpiPsAllocOp (WalkState->Opcode);
+ if (!PreOp)
+ {
+ Status = AE_NO_MEMORY;
+ goto CloseThisOp;
+ }
+ }
+
+ PreOp->Common.Value.Arg = NULL;
+ PreOp->Common.AmlOpcode = WalkState->Opcode;
+
+ /*
+ * Get and append arguments until we find the node that contains
+ * the name (the type ARGP_NAME).
+ */
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
+ (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
+ {
+ Status = AcpiPsGetNextArg (WalkState, ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ AcpiPsAppendArg (PreOp, Arg);
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
+
+ /*
+ * Make sure that we found a NAME and didn't run out of
+ * arguments
+ */
+ if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
+ {
+ Status = AE_AML_NO_OPERAND;
+ goto CloseThisOp;
+ }
+
+ /* We know that this arg is a name, move to next arg */
+
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ WalkState->Op = NULL;
+
+ Status = WalkState->DescendingCallback (WalkState, &Op);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "During name lookup/catalog, %s\n",
+ AcpiFormatException (Status)));
+ goto CloseThisOp;
+ }
+
+ if (!Op)
+ {
+ continue;
+ }
+
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
+ AcpiGbl_Depth++;
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Defer final parsing of an OperationRegion body,
+ * because we don't have enough info in the first pass
+ * to parse it correctly (i.e., there may be method
+ * calls within the TermArg elements of the body.)
+ *
+ * However, we must continue parsing because
+ * the opregion is not a standalone package --
+ * we don't know where the end is at this point.
+ *
+ * (Length is unknown until parse of the body complete)
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = 0;
+ }
+ }
+ else
+ {
+ /* Not a named opcode, just allocate Op and append to parent */
+
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ Status = AE_NO_MEMORY;
+ goto CloseThisOp;
+ }
+
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration
+ * BodyLength is unknown until we parse the body
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = 0;
+ }
+
+ AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
+
+ if ((WalkState->DescendingCallback != NULL))
+ {
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ WalkState->Op = Op;
+
+ Status = WalkState->DescendingCallback (WalkState, &Op);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+ }
+ }
+
+ Op->Common.AmlOffset = WalkState->AmlOffset;
+
+ if (WalkState->OpInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
+ (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
+ Op, ParserState->Aml, Op->Common.AmlOffset));
+ }
+ }
+
+
+ /*
+ * Start ArgCount at zero because we don't know if there are
+ * any args yet
+ */
+ WalkState->ArgCount = 0;
+
+ /* Are there any arguments that must be processed? */
+
+ if (WalkState->ArgTypes)
+ {
+ /* Get arguments */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+ case AML_QWORD_OP: /* AML_QWORDATA_ARG */
+ case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
+
+ /* Fill in constant or string argument directly */
+
+ AcpiPsGetNextSimpleArg (ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
+ break;
+
+ case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
+
+ Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ WalkState->ArgTypes = 0;
+ break;
+
+ default:
+ /*
+ * Op is not a constant or string, append each argument
+ * to the Op
+ */
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
+ !WalkState->ArgCount)
+ {
+ WalkState->AmlOffset = (UINT32)
+ ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart);
+
+ Status = AcpiPsGetNextArg (WalkState, ParserState,
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
+ &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+
+ if (Arg)
+ {
+ Arg->Common.AmlOffset = WalkState->AmlOffset;
+ AcpiPsAppendArg (Op, Arg);
+ }
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
+
+
+ /* Special processing for certain opcodes */
+
+ /* TBD (remove): Temporary mechanism to disable this code if needed */
+
+#ifndef ACPI_NO_MODULE_LEVEL_CODE
+
+ if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) &&
+ ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))
+ {
+ /*
+ * We want to skip If/Else/While constructs during Pass1
+ * because we want to actually conditionally execute the
+ * code during Pass2.
+ *
+ * Except for disassembly, where we always want to
+ * walk the If/Else/While packages
+ */
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_IF_OP:
+ case AML_ELSE_OP:
+ case AML_WHILE_OP:
+
+ /* Skip body of if/else/while in pass 1 */
+
+ ParserState->Aml = ParserState->PkgEnd;
+ WalkState->ArgCount = 0;
+ break;
+
+ default:
+ break;
+ }
+ }
+#endif
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_METHOD_OP:
+
+ /*
+ * Skip parsing of control method
+ * because we don't have enough info in the first pass
+ * to parse it correctly.
+ *
+ * Save the length and address of the body
+ */
+ Op->Named.Data = ParserState->Aml;
+ Op->Named.Length = (UINT32) (ParserState->PkgEnd -
+ ParserState->Aml);
+
+ /* Skip body of method */
+
+ ParserState->Aml = ParserState->PkgEnd;
+ WalkState->ArgCount = 0;
+ break;
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ if ((Op->Common.Parent) &&
+ (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
+ {
+ /*
+ * Skip parsing of Buffers and Packages
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = (UINT32) (ParserState->PkgEnd -
+ AmlOpStart);
+
+ /* Skip body */
+
+ ParserState->Aml = ParserState->PkgEnd;
+ WalkState->ArgCount = 0;
+ }
+ break;
+
+ case AML_WHILE_OP:
+
+ if (WalkState->ControlState)
+ {
+ WalkState->ControlState->Control.PackageEnd =
+ ParserState->PkgEnd;
+ }
+ break;
+
+ default:
+
+ /* No action for all other opcodes */
+ break;
+ }
+ break;
+ }
+ }
+
+ /* Check for arguments that need to be processed */
+
+ if (WalkState->ArgCount)
+ {
+ /*
+ * There are arguments (complex ones), push Op and
+ * prepare for argument
+ */
+ Status = AcpiPsPushScope (ParserState, Op,
+ WalkState->ArgTypes, WalkState->ArgCount);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CloseThisOp;
+ }
+ Op = NULL;
+ continue;
+ }
+
+ /*
+ * All arguments have been processed -- Op is complete,
+ * prepare for next
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ if (AcpiGbl_Depth)
+ {
+ AcpiGbl_Depth--;
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ *
+ * Completed parsing an OpRegion declaration, we now
+ * know the length.
+ */
+ Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ }
+ }
+
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration (1 for
+ * Opcode)
+ *
+ * BodyLength is unknown until we parse the body
+ */
+ Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ }
+
+ /* This op complete, notify the dispatcher */
+
+ if (WalkState->AscendingCallback != NULL)
+ {
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+ }
+
+
+CloseThisOp:
+ /*
+ * Finished one argument of the containing scope
+ */
+ ParserState->Scope->ParseScope.ArgCount--;
+
+ /* Finished with PreOp */
+
+ if (PreOp)
+ {
+ AcpiPsFreeOp (PreOp);
+ PreOp = NULL;
+ }
+
+ /* Close this Op (will result in parse subtree deletion) */
+
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ Op = NULL;
+
+ switch (Status)
+ {
+ case AE_OK:
+ break;
+
+
+ case AE_CTRL_TRANSFER:
+
+ /* We are about to transfer to a called method. */
+
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+
+
+ case AE_CTRL_END:
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ if (Op)
+ {
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ Op = NULL;
+ }
+ Status = AE_OK;
+ break;
+
+
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
+
+ /* Pop off scopes until we find the While */
+
+ while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
+
+ /* Close this iteration of the While loop */
+
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ Op = NULL;
+
+ Status = AE_OK;
+ break;
+
+
+ case AE_CTRL_TERMINATE:
+
+ Status = AE_OK;
+
+ /* Clean up */
+ do
+ {
+ if (Op)
+ {
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+
+
+ default: /* All other non-AE_OK status */
+
+ do
+ {
+ if (Op)
+ {
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+#if 0
+ if (Op == NULL)
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
+#endif
+ WalkState->PrevOp = Op;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+ }
+
+ /* This scope complete? */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
+ }
+ else
+ {
+ Op = NULL;
+ }
+
+ } /* while ParserState->Aml */
+
+
+ /*
+ * Complete the last Op (if not completed), and clear the scope stack.
+ * It is easily possible to end an AML "package" with an unbounded number
+ * of open scopes (such as when several ASL blocks are closed with
+ * sequential closing braces). We want to terminate each one cleanly.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
+ do
+ {
+ if (Op)
+ {
+ if (WalkState->AscendingCallback != NULL)
+ {
+ WalkState->Op = Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ goto CloseThisOp;
+ }
+
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ Status = AE_OK;
+
+ /* Clean up */
+ do
+ {
+ if (Op)
+ {
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+ }
+
+ else if (ACPI_FAILURE (Status))
+ {
+ /* First error is most important */
+
+ (void) AcpiPsCompleteThisOp (WalkState, Op);
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
+ }
+
+ AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
+ &WalkState->ArgCount);
+
+ } while (Op);
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c
index dddaba7b40..8ef8a6d7a0 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 91 $
+ * $Revision: 93 $
*
*****************************************************************************/
@@ -384,7 +384,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
+/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@@ -501,35 +501,25 @@ AcpiPsGetOpcodeInfo (
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
- switch ((UINT8) (Opcode >> 8))
+ if (!(Opcode & 0xFF00))
{
- case 0:
-
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
+ }
- case AML_EXTOP:
-
- /* Extended (16-bit, prefix+opcode) opcode */
-
- if (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE)
- {
- return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
- }
-
- /* Else fall through to error case below */
- /*lint -fallthrough */
-
- default:
+ if (((Opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
+ (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE))
+ {
+ /* Valid extended (16-bit) opcode */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown AML opcode [%4.4X]\n", Opcode));
- break;
+ return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
}
+ /* Unknown AML opcode */
- /* Default is "unknown opcode" */
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Unknown AML opcode [%4.4X]\n", Opcode));
return (&AcpiGbl_AmlOpInfo [_UNK]);
}
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c
index f5424b6a53..1d1b1c622e 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 152 $
+ * $Revision: 157 $
*
*****************************************************************************/
@@ -135,26 +135,6 @@
ACPI_MODULE_NAME ("psparse")
-static UINT32 AcpiGbl_Depth = 0;
-
-/* Local prototypes */
-
-static void
-AcpiPsCompleteThisOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
-
-static ACPI_STATUS
-AcpiPsNextParseState (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_STATUS CallbackStatus);
-
-static ACPI_STATUS
-AcpiPsParseLoop (
- ACPI_WALK_STATE *WalkState);
-
-
/*******************************************************************************
*
* FUNCTION: AcpiPsGetOpcodeSize
@@ -208,9 +188,9 @@ AcpiPsPeekOpcode (
Aml = ParserState->Aml;
Opcode = (UINT16) ACPI_GET8 (Aml);
- if (Opcode == AML_EXTOP)
+ if (Opcode == AML_EXTENDED_OP_PREFIX)
{
- /* Extended opcode */
+ /* Extended opcode, get the second opcode byte */
Aml++;
Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
@@ -227,13 +207,13 @@ AcpiPsPeekOpcode (
* PARAMETERS: WalkState - Current State
* Op - Op to complete
*
- * RETURN: None.
+ * RETURN: Status
*
* DESCRIPTION: Perform any cleanup at the completion of an Op.
*
******************************************************************************/
-static void
+ACPI_STATUS
AcpiPsCompleteThisOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
@@ -251,7 +231,7 @@ AcpiPsCompleteThisOp (
if (!Op)
{
- return_VOID;
+ return_ACPI_STATUS (AE_OK); /* OK for now */
}
/* Delete this op and the subtree below it if asked to */
@@ -259,18 +239,26 @@ AcpiPsCompleteThisOp (
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
(WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))
{
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
}
/* Make sure that we only delete this subtree */
if (Op->Common.Parent)
{
+ Prev = Op->Common.Parent->Common.Value.Arg;
+ if (!Prev)
+ {
+ /* Nothing more to do */
+
+ goto Cleanup;
+ }
+
/*
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
*/
- ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
+ ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
switch (ParentInfo->Class)
{
@@ -286,7 +274,7 @@ AcpiPsCompleteThisOp (
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
break;
@@ -305,13 +293,11 @@ AcpiPsCompleteThisOp (
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
}
-
- if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->DescendingCallback != AcpiDsExecBeginOp))
-
+ else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
{
if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
@@ -320,7 +306,7 @@ AcpiPsCompleteThisOp (
ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
ReplacementOp->Named.Data = Op->Named.Data;
@@ -330,16 +316,16 @@ AcpiPsCompleteThisOp (
break;
default:
+
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
}
/* We must unlink this op from the parent tree */
- Prev = Op->Common.Parent->Common.Value.Arg;
if (Prev == Op)
{
/* This op is the first in the list */
@@ -392,7 +378,15 @@ Cleanup:
/* Now we can actually delete the subtree rooted at Op */
AcpiPsDeleteParseTree (Op);
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
+
+
+AllocateError:
+
+ /* Always delete the subtree, even on error */
+
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -411,7 +405,7 @@ Cleanup:
*
******************************************************************************/
-static ACPI_STATUS
+ACPI_STATUS
AcpiPsNextParseState (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
@@ -523,727 +517,6 @@ AcpiPsNextParseState (
/*******************************************************************************
*
- * FUNCTION: AcpiPsParseLoop
- *
- * PARAMETERS: WalkState - Current state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- * a tree of ops.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiPsParseLoop (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_PARSE_OBJECT *Op = NULL; /* current op */
- ACPI_PARSE_OBJECT *Arg = NULL;
- ACPI_PARSE_OBJECT *PreOp = NULL;
- ACPI_PARSE_STATE *ParserState;
- UINT8 *AmlOpStart = NULL;
-
-
- ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
-
- if (WalkState->DescendingCallback == NULL)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- ParserState = &WalkState->ParserState;
- WalkState->ArgTypes = 0;
-
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
-
- if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
- {
- /* We are restarting a preempted control method */
-
- if (AcpiPsHasCompletedScope (ParserState))
- {
- /*
- * We must check if a predicate to an IF or WHILE statement
- * was just completed
- */
- if ((ParserState->Scope->ParseScope.Op) &&
- ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
- (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
- (WalkState->ControlState) &&
- (WalkState->ControlState->Common.State ==
- ACPI_CONTROL_PREDICATE_EXECUTING))
- {
- /*
- * A predicate was just completed, get the value of the
- * predicate and branch based on that value
- */
- WalkState->Op = NULL;
- Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
- if (ACPI_FAILURE (Status) &&
- ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
- {
- if (Status == AE_AML_NO_RETURN_VALUE)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invoked method did not return a value, %s\n",
- AcpiFormatException (Status)));
-
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "GetPredicate Failed, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- }
-
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else if (WalkState->PrevOp)
- {
- /* We were in the middle of an op */
-
- Op = WalkState->PrevOp;
- WalkState->ArgTypes = WalkState->PrevArgTypes;
- }
- }
-#endif
-
- /* Iterative parsing loop, while there is more AML to process: */
-
- while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
- {
- AmlOpStart = ParserState->Aml;
- if (!Op)
- {
- /* Get the next opcode from the AML stream */
-
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
- WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
-
- /*
- * First cut to determine what we have found:
- * 1) A valid AML opcode
- * 2) A name string
- * 3) An unknown/invalid opcode
- */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- switch (WalkState->OpInfo->Class)
- {
- case AML_CLASS_ASCII:
- case AML_CLASS_PREFIX:
- /*
- * Starts with a valid prefix or ASCII char, this is a name
- * string. Convert the bare name string to a namepath.
- */
- WalkState->Opcode = AML_INT_NAMEPATH_OP;
- WalkState->ArgTypes = ARGP_NAMESTRING;
- break;
-
- case AML_CLASS_UNKNOWN:
-
- /* The opcode is unrecognized. Just skip unknown opcodes */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
- WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
-
- ACPI_DUMP_BUFFER (ParserState->Aml, 128);
-
- /* Assume one-byte bad opcode */
-
- ParserState->Aml++;
- continue;
-
- default:
-
- /* Found opcode info, this is a normal opcode */
-
- ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
- WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
- break;
- }
-
- /* Create Op structure and append to parent's argument list */
-
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- /* Allocate a new PreOp if necessary */
-
- if (!PreOp)
- {
- PreOp = AcpiPsAllocOp (WalkState->Opcode);
- if (!PreOp)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
- }
-
- PreOp->Common.Value.Arg = NULL;
- PreOp->Common.AmlOpcode = WalkState->Opcode;
-
- /*
- * Get and append arguments until we find the node that contains
- * the name (the type ARGP_NAME).
- */
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
- {
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- AcpiPsAppendArg (PreOp, Arg);
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
-
- /*
- * Make sure that we found a NAME and didn't run out of
- * arguments
- */
- if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
- {
- Status = AE_AML_NO_OPERAND;
- goto CloseThisOp;
- }
-
- /* We know that this arg is a name, move to next arg */
-
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
-
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = NULL;
-
- Status = WalkState->DescendingCallback (WalkState, &Op);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "During name lookup/catalog, %s\n",
- AcpiFormatException (Status)));
- goto CloseThisOp;
- }
-
- if (!Op)
- {
- continue;
- }
-
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
- AcpiGbl_Depth++;
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Defer final parsing of an OperationRegion body,
- * because we don't have enough info in the first pass
- * to parse it correctly (i.e., there may be method
- * calls within the TermArg elements of the body.)
- *
- * However, we must continue parsing because
- * the opregion is not a standalone package --
- * we don't know where the end is at this point.
- *
- * (Length is unknown until parse of the body complete)
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
- }
- else
- {
- /* Not a named opcode, just allocate Op and append to parent */
-
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- Op = AcpiPsAllocOp (WalkState->Opcode);
- if (!Op)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
-
- if (WalkState->OpInfo->Flags & AML_CREATE)
- {
- /*
- * Backup to beginning of CreateXXXfield declaration
- * BodyLength is unknown until we parse the body
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
-
- AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
-
- if ((WalkState->DescendingCallback != NULL))
- {
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = Op;
-
- Status = WalkState->DescendingCallback (WalkState, &Op);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
- }
- }
-
- Op->Common.AmlOffset = WalkState->AmlOffset;
-
- if (WalkState->OpInfo)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
- (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
- Op, ParserState->Aml, Op->Common.AmlOffset));
- }
- }
-
-
- /*
- * Start ArgCount at zero because we don't know if there are
- * any args yet
- */
- WalkState->ArgCount = 0;
-
- /* Are there any arguments that must be processed? */
-
- if (WalkState->ArgTypes)
- {
- /* Get arguments */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
- case AML_WORD_OP: /* AML_WORDDATA_ARG */
- case AML_DWORD_OP: /* AML_DWORDATA_ARG */
- case AML_QWORD_OP: /* AML_QWORDATA_ARG */
- case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
-
- /* Fill in constant or string argument directly */
-
- AcpiPsGetNextSimpleArg (ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
- break;
-
- case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
-
- Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- WalkState->ArgTypes = 0;
- break;
-
- default:
-
- /*
- * Op is not a constant or string, append each argument
- * to the Op
- */
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- !WalkState->ArgCount)
- {
- WalkState->AmlOffset = (UINT32)
- ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart);
-
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
- &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- if (Arg)
- {
- Arg->Common.AmlOffset = WalkState->AmlOffset;
- AcpiPsAppendArg (Op, Arg);
- }
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
-
- /* Special processing for certain opcodes */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_METHOD_OP:
-
- /*
- * Skip parsing of control method
- * because we don't have enough info in the first pass
- * to parse it correctly.
- *
- * Save the length and address of the body
- */
- Op->Named.Data = ParserState->Aml;
- Op->Named.Length = (UINT32) (ParserState->PkgEnd -
- ParserState->Aml);
-
- /* Skip body of method */
-
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- break;
-
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- if ((Op->Common.Parent) &&
- (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->DescendingCallback != AcpiDsExecBeginOp))
- {
- /*
- * Skip parsing of Buffers and Packages
- * because we don't have enough info in the first pass
- * to parse them correctly.
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = (UINT32) (ParserState->PkgEnd -
- AmlOpStart);
-
- /* Skip body */
-
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- }
- break;
-
- case AML_WHILE_OP:
-
- if (WalkState->ControlState)
- {
- WalkState->ControlState->Control.PackageEnd =
- ParserState->PkgEnd;
- }
- break;
-
- default:
-
- /* No action for all other opcodes */
- break;
- }
- break;
- }
- }
-
- /* Check for arguments that need to be processed */
-
- if (WalkState->ArgCount)
- {
- /*
- * There are arguments (complex ones), push Op and
- * prepare for argument
- */
- Status = AcpiPsPushScope (ParserState, Op,
- WalkState->ArgTypes, WalkState->ArgCount);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
- Op = NULL;
- continue;
- }
-
- /*
- * All arguments have been processed -- Op is complete,
- * prepare for next
- */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- if (AcpiGbl_Depth)
- {
- AcpiGbl_Depth--;
- }
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an OpRegion declaration, we now
- * know the length.
- */
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
- }
- }
-
- if (WalkState->OpInfo->Flags & AML_CREATE)
- {
- /*
- * Backup to beginning of CreateXXXfield declaration (1 for
- * Opcode)
- *
- * BodyLength is unknown until we parse the body
- */
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
- }
-
- /* This op complete, notify the dispatcher */
-
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
- }
-
-
-CloseThisOp:
- /*
- * Finished one argument of the containing scope
- */
- ParserState->Scope->ParseScope.ArgCount--;
-
- /* Close this Op (will result in parse subtree deletion) */
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
- if (PreOp)
- {
- AcpiPsFreeOp (PreOp);
- PreOp = NULL;
- }
-
- switch (Status)
- {
- case AE_OK:
- break;
-
-
- case AE_CTRL_TRANSFER:
-
- /* We are about to transfer to a called method. */
-
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
-
-
- case AE_CTRL_END:
-
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- if (Op)
- {
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
- }
- Status = AE_OK;
- break;
-
-
- case AE_CTRL_BREAK:
- case AE_CTRL_CONTINUE:
-
- /* Pop off scopes until we find the While */
-
- while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- }
-
- /* Close this iteration of the While loop */
-
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
-
- Status = AE_OK;
- break;
-
-
- case AE_CTRL_TERMINATE:
-
- Status = AE_OK;
-
- /* Clean up */
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
-
-
- default: /* All other non-AE_OK status */
-
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
-
- /*
- * TBD: Cleanup parse ops on error
- */
-#if 0
- if (Op == NULL)
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- }
-#endif
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
- }
-
- /* This scope complete? */
-
- if (AcpiPsHasCompletedScope (ParserState))
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else
- {
- Op = NULL;
- }
-
- } /* while ParserState->Aml */
-
-
- /*
- * Complete the last Op (if not completed), and clear the scope stack.
- * It is easily possible to end an AML "package" with an unbounded number
- * of open scopes (such as when several ASL blocks are closed with
- * sequential closing braces). We want to terminate each one cleanly.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
- do
- {
- if (Op)
- {
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (Status == AE_CTRL_TERMINATE)
- {
- Status = AE_OK;
-
- /* Clean up */
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
-
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
- }
-
- else if (ACPI_FAILURE (Status))
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- return_ACPI_STATUS (Status);
- }
- }
-
- AcpiPsCompleteThisOp (WalkState, Op);
- }
-
- AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
- &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiPsParseAml
*
* PARAMETERS: WalkState - Current state
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c
index 982c8f5b7f..1e2afbe947 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 63 $
+ * $Revision: 65 $
*
*****************************************************************************/
@@ -232,13 +232,13 @@ AcpiPsAllocOp (
{
/* The generic op (default) is by far the most common (16 to 1) */
- Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE);
+ Op = AcpiOsAcquireObject (AcpiGbl_PsNodeCache);
}
else
{
/* Extended parseop */
- Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE_EXT);
+ Op = AcpiOsAcquireObject (AcpiGbl_PsNodeExtCache);
}
/* Initialize the Op */
@@ -280,42 +280,15 @@ AcpiPsFreeOp (
if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
{
- AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op);
+ AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op);
}
else
{
- AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE_EXT, Op);
+ AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op);
}
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsDeleteParseCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Free all objects that are on the parse cache list.
- *
- ******************************************************************************/
-
-void
-AcpiPsDeleteParseCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("PsDeleteParseCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE);
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE_EXT);
- return_VOID;
-}
-#endif
-
-
/*******************************************************************************
*
* FUNCTION: Utility functions
diff --git a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c
index 18a7649f3c..a1ffc60b98 100644
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c
+++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 78 $
+ * $Revision: 79 $
*
*****************************************************************************/
@@ -218,11 +218,15 @@ AcpiPsxExecute (
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
- ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup2;
+ }
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
+ WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
NULL, NULL, NULL);
if (!WalkState)
{
diff --git a/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c b/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c
index a066bc9f53..aee8df15e8 100644
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c
+++ b/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 188 $
+ * $Revision: 190 $
*
******************************************************************************/
@@ -243,11 +243,11 @@ AcpiNsRootInitialize (
ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_APP)
+#if defined (ACPI_ASL_COMPILER) || defined (ACPI_DUMP_APP)
/*
* iASL Compiler cheats by putting parameter count
- * in the OwnerID
+ * in the OwnerID (ParamCount max is 7)
*/
NewNode->OwnerId = ObjDesc->Method.ParamCount;
#else
diff --git a/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c b/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c
index ce6226ce55..736595fe26 100644
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c
+++ b/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 92 $
+ * $Revision: 94 $
*
******************************************************************************/
@@ -159,7 +159,7 @@ AcpiNsCreateNode (
return_PTR (NULL);
}
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalAllocated++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
Node->Name.Integer = Name;
Node->ReferenceCount = 1;
@@ -233,7 +233,7 @@ AcpiNsDeleteNode (
}
}
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
/*
* Detach an object if there is one then delete the node
@@ -272,7 +272,7 @@ AcpiNsInstallNode (
ACPI_NAMESPACE_NODE *Node, /* New Child*/
ACPI_OBJECT_TYPE Type)
{
- UINT16 OwnerId = 0;
+ ACPI_OWNER_ID OwnerId = 0;
ACPI_NAMESPACE_NODE *ChildNode;
#ifdef ACPI_ALPHABETIC_NAMESPACE
@@ -458,7 +458,7 @@ AcpiNsDeleteChildren (
/* Now we can free this child object */
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
ChildNode, AcpiGbl_CurrentNodeCount));
@@ -664,7 +664,7 @@ AcpiNsRemoveReference (
void
AcpiNsDeleteNamespaceByOwner (
- UINT16 OwnerId)
+ ACPI_OWNER_ID OwnerId)
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *DeletionNode;
@@ -749,6 +749,7 @@ AcpiNsDeleteNamespaceByOwner (
}
}
+ (void) AcpiUtReleaseOwnerId (OwnerId);
return_VOID;
}
diff --git a/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c b/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c
index 728fb7d384..218df13ed6 100644
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c
+++ b/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 164 $
+ * $Revision: 170 $
*
*****************************************************************************/
@@ -284,41 +284,46 @@ AcpiNsDumpOneObject (
/* Check if the owner matches */
- if ((Info->OwnerId != ACPI_UINT32_MAX) &&
+ if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
(Info->OwnerId != ThisNode->OwnerId))
{
return (AE_OK);
}
- /* Indent the object according to the level */
+ if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
+ {
+ /* Indent the object according to the level */
- AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
+ AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
- /* Check the node type and name */
+ /* Check the node type and name */
- if (Type > ACPI_TYPE_LOCAL_MAX)
- {
- ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
- }
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
+ }
- if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
- {
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
- ThisNode->Name.Integer));
+ if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
+ {
+ ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
+ ThisNode->Name.Integer));
+ }
+
+ AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
}
/*
* Now we can print out the pertinent information
*/
- AcpiOsPrintf ("%4.4s %-12s %p ",
- AcpiUtGetNodeName (ThisNode), AcpiUtGetTypeName (Type), ThisNode);
+ AcpiOsPrintf (" %-12s %p ",
+ AcpiUtGetTypeName (Type), ThisNode);
DbgLevel = AcpiDbgLevel;
AcpiDbgLevel = 0;
ObjDesc = AcpiNsGetAttachedObject (ThisNode);
AcpiDbgLevel = DbgLevel;
- switch (Info->DisplayType)
+ switch (Info->DisplayType & ACPI_DISPLAY_MASK)
{
case ACPI_DISPLAY_SUMMARY:
@@ -576,7 +581,7 @@ AcpiNsDumpOneObject (
while (ObjDesc)
{
ObjType = ACPI_TYPE_INVALID;
- AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
+ AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
/* Decode the type of attached object and dump the contents */
@@ -586,9 +591,9 @@ AcpiNsDumpOneObject (
AcpiOsPrintf ("(Ptr to Node)\n");
BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
break;
-
case ACPI_DESC_TYPE_OPERAND:
ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
@@ -601,24 +606,19 @@ AcpiNsDumpOneObject (
}
else
{
- AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n",
- AcpiUtGetTypeName (ObjType), ObjType);
+ AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n",
+ ObjType, AcpiUtGetTypeName (ObjType));
BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
}
- break;
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
+ break;
default:
- AcpiOsPrintf (
- "(String or Buffer ptr - not an object descriptor) [%s]\n",
- AcpiUtGetDescriptorName (ObjDesc));
- BytesToDump = 16;
break;
}
- ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
-
/* If value is NOT an internal object, we are done */
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
@@ -631,13 +631,17 @@ AcpiNsDumpOneObject (
*/
switch (ObjType)
{
+ case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
+ /*
+ * NOTE: takes advantage of common fields between string/buffer
+ */
+ BytesToDump = ObjDesc->String.Length;
ObjDesc = (void *) ObjDesc->String.Pointer;
- break;
-
- case ACPI_TYPE_BUFFER:
- ObjDesc = (void *) ObjDesc->Buffer.Pointer;
- break;
+ AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
+ ObjDesc, BytesToDump);
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
+ goto Cleanup;
case ACPI_TYPE_BUFFER_FIELD:
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
@@ -700,7 +704,7 @@ AcpiNsDumpObjects (
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
- UINT32 OwnerId,
+ ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle)
{
ACPI_WALK_INFO Info;
@@ -744,14 +748,14 @@ AcpiNsDumpEntry (
Info.DebugLevel = DebugLevel;
- Info.OwnerId = ACPI_UINT32_MAX;
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
Info.DisplayType = ACPI_DISPLAY_SUMMARY;
(void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
}
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpTables
@@ -797,7 +801,7 @@ AcpiNsDumpTables (
}
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
- ACPI_UINT32_MAX, SearchHandle);
+ ACPI_OWNER_ID_MAX, SearchHandle);
return_VOID;
}
#endif
diff --git a/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c b/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c
index 40abbc7328..f5d64b2927 100644
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c
+++ b/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
- * $Revision: 7 $
+ * $Revision: 9 $
*
*****************************************************************************/
@@ -162,7 +162,7 @@ AcpiNsOneCompleteParse (
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TableDesc->TableId,
+ WalkState = AcpiDsCreateWalkState (TableDesc->OwnerId,
NULL, NULL, NULL);
if (!WalkState)
{
@@ -223,6 +223,7 @@ AcpiNsParseTable (
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
Status = AcpiNsOneCompleteParse (1, TableDesc);
if (ACPI_FAILURE (Status))
{
@@ -238,6 +239,7 @@ AcpiNsParseTable (
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
Status = AcpiNsOneCompleteParse (2, TableDesc);
if (ACPI_FAILURE (Status))
{
diff --git a/usr/src/uts/i86pc/io/acpica/osl.c b/usr/src/uts/i86pc/io/acpica/osl.c
index 547b6b4fb4..84d75338e0 100644
--- a/usr/src/uts/i86pc/io/acpica/osl.c
+++ b/usr/src/uts/i86pc/io/acpica/osl.c
@@ -19,6 +19,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -337,31 +338,17 @@ AcpiOsDeleteLock(ACPI_HANDLE Handle)
kmem_free((void *)Handle, sizeof (ksema_t));
}
-void
-AcpiOsAcquireLock(ACPI_HANDLE Handle, UINT32 Flags)
+UINT32
+AcpiOsAcquireLock(ACPI_HANDLE Handle)
{
- /* FUTUREWORK: does it matter which context we call from? */
- switch (Flags) {
- case ACPI_NOT_ISR:
- break;
- case ACPI_ISR:
- break;
- }
-
sema_p((ksema_t *)Handle);
+ return (0);
}
void
AcpiOsReleaseLock(ACPI_HANDLE Handle, UINT32 Flags)
{
-
- /* FUTUREWORK: does it matter which context we call from? */
- switch (Flags) {
- case ACPI_NOT_ISR:
- break;
- case ACPI_ISR:
- break;
- }
+ _NOTE(ARGUNUSED(Flags))
sema_v((ksema_t *)Handle);
}
@@ -444,19 +431,25 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
void *Context)
{
int retval;
+ int sci_vect;
+ iflag_t sci_flags;
-#ifdef DEBUG
- cmn_err(CE_NOTE, "!acpica: attaching SCI %d", InterruptNumber);
-#endif
acpi_isr = ServiceRoutine;
acpi_isr_context = Context;
/*
- * FUTUREWORK: the FADT SCI may be changed by MADT ISO someday
- * Right thing to do: move get_sci into acpica from psm_common
+ * Get SCI (adjusted for PIC/APIC mode if necessary)
*/
+ if (acpica_get_sci(&sci_vect, &sci_flags) != AE_OK) {
+ return (AE_ERROR);
+ }
+
+#ifdef DEBUG
+ cmn_err(CE_NOTE, "!acpica: attaching SCI %d", sci_vect);
+#endif
+
retval = add_avintr(NULL, SCI_IPL, (avfunc)acpi_wrapper_isr,
- "ACPI SCI", InterruptNumber, NULL, NULL, NULL);
+ "ACPI SCI", sci_vect, NULL, NULL, NULL);
if (retval) {
intr_hooked = 1;
return (AE_OK);
diff --git a/usr/src/uts/i86pc/io/acpica/resources/rsdump.c b/usr/src/uts/i86pc/io/acpica/resources/rsdump.c
index 13e3a68980..29120d8715 100644
--- a/usr/src/uts/i86pc/io/acpica/resources/rsdump.c
+++ b/usr/src/uts/i86pc/io/acpica/resources/rsdump.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 44 $
+ * $Revision: 45 $
*
******************************************************************************/
@@ -123,6 +123,9 @@
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsdump")
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
/* Local prototypes */
static void
@@ -178,7 +181,6 @@ AcpiRsDumpVendorSpecific (
ACPI_RESOURCE_DATA *Data);
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: AcpiRsDumpIrq
diff --git a/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c b/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c
index 962a604d6f..1e7b09e54b 100644
--- a/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c
+++ b/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
- * $Revision: 63 $
+ * $Revision: 64 $
*
*****************************************************************************/
@@ -167,7 +167,9 @@ AcpiTbGetTableCount (
ACPI_FUNCTION_ENTRY ();
- if (RSDP->Revision < 2)
+ /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+ if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
{
PointerSize = sizeof (UINT32);
}
@@ -232,7 +234,9 @@ AcpiTbConvertToXsdt (
for (i = 0; i < AcpiGbl_RsdtTableCount; i++)
{
- if (AcpiGbl_RSDP->Revision < 2)
+ /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+ if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
{
ACPI_STORE_ADDRESS (NewTable->TableOffsetEntry[i],
(ACPI_CAST_PTR (RSDT_DESCRIPTOR_REV1,
diff --git a/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c b/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c
index 3a3799aced..811389a5c7 100644
--- a/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c
+++ b/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 78 $
+ * $Revision: 79 $
*
*****************************************************************************/
@@ -335,6 +335,7 @@ AcpiTbInitTableDescriptor (
{
ACPI_TABLE_LIST *ListHead;
ACPI_TABLE_DESC *TableDesc;
+ ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
@@ -348,6 +349,14 @@ AcpiTbInitTableDescriptor (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ /* Get a new owner ID for the table */
+
+ Status = AcpiUtAllocateOwnerId (&TableDesc->OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Install the table into the global data structure */
ListHead = &AcpiGbl_TableLists[TableType];
@@ -417,8 +426,6 @@ AcpiTbInitTableDescriptor (
TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1),
TableDesc->AmlLength = (UINT32) (TableDesc->Length -
(UINT32) sizeof (ACPI_TABLE_HEADER));
- TableDesc->TableId = AcpiUtAllocateOwnerId (
- ACPI_OWNER_TYPE_TABLE);
TableDesc->LoadedIntoNamespace = FALSE;
/*
@@ -432,7 +439,7 @@ AcpiTbInitTableDescriptor (
/* Return Data */
- TableInfo->TableId = TableDesc->TableId;
+ TableInfo->OwnerId = TableDesc->OwnerId;
TableInfo->InstalledDesc = TableDesc;
return_ACPI_STATUS (AE_OK);
diff --git a/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c b/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c
index 7cbb9f8da6..9468cd5c63 100644
--- a/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c
+++ b/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbrsdt - ACPI RSDT table utilities
- * $Revision: 16 $
+ * $Revision: 19 $
*
*****************************************************************************/
@@ -172,36 +172,14 @@ AcpiTbVerifyRsdp (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * The signature and checksum must both be correct
- */
- if (ACPI_STRNCMP ((char *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
- {
- /* Nope, BAD Signature */
-
- Status = AE_BAD_SIGNATURE;
- goto Cleanup;
- }
-
- /* Check the standard checksum */
+ /* Verify RSDP signature and checksum */
- if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ Status = AcpiTbValidateRsdp (Rsdp);
+ if (ACPI_FAILURE (Status))
{
- Status = AE_BAD_CHECKSUM;
goto Cleanup;
}
- /* Check extended checksum if table version >= 2 */
-
- if (Rsdp->Revision >= 2)
- {
- if (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)
- {
- Status = AE_BAD_CHECKSUM;
- goto Cleanup;
- }
- }
-
/* The RSDP supplied is OK */
TableInfo.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp);
@@ -241,8 +219,8 @@ Cleanup:
*
* RETURN: None, Address
*
- * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
- * version of the RSDP
+ * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the
+ * version of the RSDP and whether the XSDT pointer is valid
*
******************************************************************************/
@@ -256,18 +234,21 @@ AcpiTbGetRsdtAddress (
OutAddress->PointerType = AcpiGbl_TableFlags | ACPI_LOGICAL_ADDRESSING;
- /*
- * For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 (and above), we use the XSDT
- */
- if (AcpiGbl_RSDP->Revision < 2)
+ /* Use XSDT if it is present */
+
+ if ((AcpiGbl_RSDP->Revision >= 2) &&
+ ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress))
{
- OutAddress->Pointer.Value = AcpiGbl_RSDP->RsdtPhysicalAddress;
+ OutAddress->Pointer.Value =
+ ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
+ AcpiGbl_RootTableType = ACPI_TABLE_TYPE_XSDT;
}
else
{
- OutAddress->Pointer.Value = ACPI_GET_ADDRESS (
- AcpiGbl_RSDP->XsdtPhysicalAddress);
+ /* No XSDT, use the RSDT */
+
+ OutAddress->Pointer.Value = AcpiGbl_RSDP->RsdtPhysicalAddress;
+ AcpiGbl_RootTableType = ACPI_TABLE_TYPE_RSDT;
}
}
@@ -295,10 +276,9 @@ AcpiTbValidateRsdt (
/*
- * For RSDP revision 0 or 1, we use the RSDT.
- * For RSDP revision 2 and above, we use the XSDT
+ * Search for appropriate signature, RSDT or XSDT
*/
- if (AcpiGbl_RSDP->Revision < 2)
+ if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
{
NoMatch = ACPI_STRNCMP ((char *) TablePtr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
@@ -323,13 +303,13 @@ AcpiTbValidateRsdt (
AcpiGbl_RSDP->RsdtPhysicalAddress,
(void *) (ACPI_NATIVE_UINT) AcpiGbl_RSDP->RsdtPhysicalAddress));
- if (AcpiGbl_RSDP->Revision < 2)
+ if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
{
- ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n"))
+ ACPI_REPORT_ERROR (("Looking for RSDT\n"))
}
else
{
- ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n"))
+ ACPI_REPORT_ERROR (("Looking for XSDT\n"))
}
ACPI_DUMP_BUFFER ((char *) TablePtr, 48);
diff --git a/usr/src/uts/i86pc/io/acpica/tables/tbxface.c b/usr/src/uts/i86pc/io/acpica/tables/tbxface.c
index 4ecd2e345a..56216ac716 100644
--- a/usr/src/uts/i86pc/io/acpica/tables/tbxface.c
+++ b/usr/src/uts/i86pc/io/acpica/tables/tbxface.c
@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 67 $
+ * $Revision: 68 $
*
*****************************************************************************/
@@ -344,8 +344,7 @@ AcpiUnloadTable (
* "Scope" operator. Thus, we need to track ownership by an ID, not
* simply a position within the hierarchy
*/
- AcpiNsDeleteNamespaceByOwner (TableDesc->TableId);
-
+ AcpiNsDeleteNamespaceByOwner (TableDesc->OwnerId);
TableDesc = TableDesc->Next;
}
diff --git a/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c b/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c
index b4b54f9516..c552507576 100644
--- a/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c
+++ b/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 85 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -138,6 +138,54 @@ AcpiTbScanMemoryForRsdp (
/*******************************************************************************
*
+ * FUNCTION: AcpiTbValidateRsdp
+ *
+ * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Validate the RSDP (ptr)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbValidateRsdp (
+ RSDP_DESCRIPTOR *Rsdp)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * The signature and checksum must both be correct
+ */
+ if (ACPI_STRNCMP ((char *) Rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ {
+ /* Nope, BAD Signature */
+
+ return (AE_BAD_SIGNATURE);
+ }
+
+ /* Check the standard checksum */
+
+ if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ /* Check extended checksum if table version >= 2 */
+
+ if ((Rsdp->Revision >= 2) &&
+ (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
+ {
+ return (AE_BAD_CHECKSUM);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiTbFindTable
*
* PARAMETERS: Signature - String with ACPI table signature
@@ -303,21 +351,12 @@ AcpiGetFirmwareTable (
AcpiGbl_RSDP = Address.Pointer.Logical;
}
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG,
- sizeof (RSDP_SIG)-1) != 0)
- {
- /* Nope, BAD Signature */
+ /* The RDSP signature and checksum must both be correct */
- return_ACPI_STATUS (AE_BAD_SIGNATURE);
- }
-
- if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ Status = AcpiTbValidateRsdp (AcpiGbl_RSDP);
+ if (ACPI_FAILURE (Status))
{
- /* Nope, BAD Checksum */
-
- return_ACPI_STATUS (AE_BAD_CHECKSUM);
+ return_ACPI_STATUS (Status);
}
}
@@ -380,9 +419,11 @@ AcpiGetFirmwareTable (
*/
for (i = 0, j = 0; i < TableCount; i++)
{
- /* Get the next table pointer, handle RSDT vs. XSDT */
-
- if (AcpiGbl_RSDP->Revision < 2)
+ /*
+ * Get the next table pointer, handle RSDT vs. XSDT
+ * RSDT pointers are 32 bits, XSDT pointers are 64 bits
+ */
+ if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
{
Address.Pointer.Value = (ACPI_CAST_PTR (
RSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i];
@@ -430,8 +471,11 @@ AcpiGetFirmwareTable (
Cleanup:
- AcpiOsUnmapMemory (RsdtInfo->Pointer,
- (ACPI_SIZE) RsdtInfo->Pointer->Length);
+ if (RsdtInfo->Pointer)
+ {
+ AcpiOsUnmapMemory (RsdtInfo->Pointer,
+ (ACPI_SIZE) RsdtInfo->Pointer->Length);
+ }
ACPI_MEM_FREE (RsdtInfo);
if (Header)
@@ -511,9 +555,9 @@ AcpiTbScanMemoryForRsdp (
UINT8 *StartAddress,
UINT32 Length)
{
+ ACPI_STATUS Status;
UINT8 *MemRover;
UINT8 *EndAddress;
- UINT8 Checksum;
ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
@@ -526,49 +570,26 @@ AcpiTbScanMemoryForRsdp (
for (MemRover = StartAddress; MemRover < EndAddress;
MemRover += ACPI_RSDP_SCAN_STEP)
{
- /* The signature and checksum must both be correct */
+ /* The RSDP signature and checksum must both be correct */
- if (ACPI_STRNCMP ((char *) MemRover,
- RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0)
+ Status = AcpiTbValidateRsdp (ACPI_CAST_PTR (RSDP_DESCRIPTOR, MemRover));
+ if (ACPI_SUCCESS (Status))
{
- /* No signature match, keep looking */
-
- continue;
- }
-
- /* Signature matches, check the appropriate checksum */
-
- if ((ACPI_CAST_PTR (RSDP_DESCRIPTOR, MemRover))->Revision < 2)
- {
- /* ACPI version 1.0 */
-
- Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH);
- }
- else
- {
- /* Post ACPI 1.0, use ExtendedChecksum */
-
- Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_XCHECKSUM_LENGTH);
- }
-
- if (Checksum == 0)
- {
- /* Checksum valid, we have found a valid RSDP */
+ /* Sig and checksum valid, we have found a real RSDP */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at physical address %p\n", MemRover));
return_PTR (MemRover);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found an RSDP at physical address %p, but it has a bad checksum\n",
- MemRover));
+ /* No sig match or bad checksum, keep searching */
}
/* Searched entire block, no RSDP was found */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Searched entire block, no valid RSDP was found.\n"));
+ "Searched entire block from %p, valid RSDP was not found\n",
+ StartAddress));
return_PTR (NULL);
}
@@ -661,7 +682,7 @@ AcpiTbFindRsdp (
if (MemRover)
{
- /* Found it, return the physical address */
+ /* Return the physical address */
PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr);
@@ -692,7 +713,7 @@ AcpiTbFindRsdp (
if (MemRover)
{
- /* Found it, return the physical address */
+ /* Return the physical address */
PhysicalAddress =
ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr);
@@ -726,7 +747,7 @@ AcpiTbFindRsdp (
ACPI_EBDA_WINDOW_SIZE);
if (MemRover)
{
- /* Found it, return the physical address */
+ /* Return the physical address */
TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
return_ACPI_STATUS (AE_OK);
@@ -747,8 +768,9 @@ AcpiTbFindRsdp (
}
}
- /* RSDP signature was not found */
+ /* A valid RSDP was not found */
+ ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c b/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c
index ee7c935e1c..15e5e47022 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 144 $
+ * Module Name: utalloc - local memory allocation routines
+ * $Revision: 146 $
*
*****************************************************************************/
@@ -125,12 +125,10 @@
static ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
- UINT32 ListId,
void *Allocation);
static ACPI_STATUS
AcpiUtTrackAllocation (
- UINT32 ListId,
ACPI_DEBUG_MEM_BLOCK *Address,
ACPI_SIZE Size,
UINT8 AllocType,
@@ -140,213 +138,123 @@ AcpiUtTrackAllocation (
static ACPI_STATUS
AcpiUtRemoveAllocation (
- UINT32 ListId,
ACPI_DEBUG_MEM_BLOCK *Address,
UINT32 Component,
char *Module,
UINT32 Line);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static ACPI_STATUS
+AcpiUtCreateList (
+ char *ListName,
+ UINT16 ObjectSize,
+ ACPI_HANDLE *ReturnCache);
+#endif
+
/*******************************************************************************
*
- * FUNCTION: AcpiUtReleaseToCache
+ * FUNCTION: AcpiUtCreateCaches
*
- * PARAMETERS: ListId - Memory list/cache ID
- * Object - The object to be released
+ * PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
- * DESCRIPTION: Release an object to the specified cache. If cache is full,
- * the object is deleted.
+ * DESCRIPTION: Create all local caches
*
******************************************************************************/
-void
-AcpiUtReleaseToCache (
- UINT32 ListId,
- void *Object)
+ACPI_STATUS
+AcpiUtCreateCaches (
+ void)
{
- ACPI_MEMORY_LIST *CacheInfo;
-
-
- ACPI_FUNCTION_ENTRY ();
-
+ ACPI_STATUS Status;
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
-#ifdef ACPI_ENABLE_OBJECT_CACHE
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- /* If walk cache is full, just free this wallkstate object */
+ /* Memory allocation lists */
- if (CacheInfo->CacheDepth >= CacheInfo->MaxCacheDepth)
+ Status = AcpiUtCreateList ("Acpi-Global", 0,
+ &AcpiGbl_GlobalList);
+ if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (Object);
- ACPI_MEM_TRACKING (CacheInfo->TotalFreed++);
+ return (Status);
}
- /* Otherwise put this object back into the cache */
-
- else
+ Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
+ &AcpiGbl_NsNodeList);
+ if (ACPI_FAILURE (Status))
{
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
- {
- return;
- }
-
- /* Mark the object as cached */
-
- ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize);
- ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
-
- /* Put the object at the head of the cache list */
-
- * (ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead;
- CacheInfo->ListHead = Object;
- CacheInfo->CacheDepth++;
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return (Status);
}
-
-#else
-
- /* Object cache is disabled; just free the object */
-
- ACPI_MEM_FREE (Object);
- ACPI_MEM_TRACKING (CacheInfo->TotalFreed++);
#endif
-}
+ /* Object Caches, for frequently used objects */
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAcquireFromCache
- *
- * PARAMETERS: ListId - Memory list ID
- *
- * RETURN: A requested object. NULL if the object could not be
- * allocated.
- *
- * DESCRIPTION: Get an object from the specified cache. If cache is empty,
- * the object is allocated.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAcquireFromCache (
- UINT32 ListId)
-{
- ACPI_MEMORY_LIST *CacheInfo;
- void *Object;
-
-
- ACPI_FUNCTION_NAME ("UtAcquireFromCache");
-
-
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE),
+ ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache);
+ if (ACPI_FAILURE (Status))
{
- return (NULL);
+ return (Status);
}
- ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
-
- /* Check the cache first */
-
- if (CacheInfo->ListHead)
+ Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON),
+ ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache);
+ if (ACPI_FAILURE (Status))
{
- /* There is an object available, use it */
-
- Object = CacheInfo->ListHead;
- CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) Object)[CacheInfo->LinkOffset])));
-
- ACPI_MEM_TRACKING (CacheInfo->CacheHits++);
- CacheInfo->CacheDepth--;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
- Object, AcpiGbl_MemoryLists[ListId].ListName));
-#endif
-
- if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
- {
- return (NULL);
- }
-
- /* Clear (zero) the previously used Object */
-
- ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize);
+ return (Status);
}
- else
+ Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED),
+ ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache);
+ if (ACPI_FAILURE (Status))
{
- /* The cache is empty, create a new object */
-
- /* Avoid deadlock with ACPI_MEM_CALLOCATE */
-
- if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
- {
- return (NULL);
- }
-
- Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
- ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
+ return (Status);
}
-#else
-
- /* Object cache is disabled; just allocate the object */
-
- Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
- ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
-#endif
+ Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT),
+ ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- return (Object);
+ return (AE_OK);
}
-#ifdef ACPI_ENABLE_OBJECT_CACHE
/*******************************************************************************
*
- * FUNCTION: AcpiUtDeleteGenericCache
+ * FUNCTION: AcpiUtDeleteCaches
*
- * PARAMETERS: ListId - Memory list ID
+ * PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
- * DESCRIPTION: Free all objects within the requested cache.
+ * DESCRIPTION: Purge and delete all local caches
*
******************************************************************************/
-void
-AcpiUtDeleteGenericCache (
- UINT32 ListId)
+ACPI_STATUS
+AcpiUtDeleteCaches (
+ void)
{
- ACPI_MEMORY_LIST *CacheInfo;
- char *Next;
+ (void) AcpiOsDeleteCache (AcpiGbl_StateCache);
+ AcpiGbl_StateCache = NULL;
- ACPI_FUNCTION_ENTRY ();
+ (void) AcpiOsDeleteCache (AcpiGbl_OperandCache);
+ AcpiGbl_OperandCache = NULL;
+ (void) AcpiOsDeleteCache (AcpiGbl_PsNodeCache);
+ AcpiGbl_PsNodeCache = NULL;
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
- while (CacheInfo->ListHead)
- {
- /* Delete one cached state object */
+ (void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
+ AcpiGbl_PsNodeExtCache = NULL;
- Next = *(ACPI_CAST_INDIRECT_PTR (char,
- &(((char *) CacheInfo->ListHead)[CacheInfo->LinkOffset])));
- ACPI_MEM_FREE (CacheInfo->ListHead);
-
- CacheInfo->ListHead = Next;
- CacheInfo->CacheDepth--;
- }
+ return (AE_OK);
}
-#endif
/*******************************************************************************
@@ -592,6 +500,44 @@ AcpiUtCallocate (
* occurs in the body of AcpiUtFree.
*/
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateList
+ *
+ * PARAMETERS: CacheName - Ascii name for the cache
+ * ObjectSize - Size of each cached object
+ * ReturnCache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a local memory list for tracking purposed
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCreateList (
+ char *ListName,
+ UINT16 ObjectSize,
+ ACPI_HANDLE *ReturnCache)
+{
+ ACPI_MEMORY_LIST *Cache;
+
+
+ Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
+ if (!Cache)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
+
+ Cache->ListName = ListName;
+ Cache->ObjectSize = ObjectSize;
+
+ *ReturnCache = Cache;
+ return (AE_OK);
+}
+
/*******************************************************************************
*
@@ -626,7 +572,7 @@ AcpiUtAllocateAndTrack (
return (NULL);
}
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ Status = AcpiUtTrackAllocation (Allocation, Size,
ACPI_MEM_MALLOC, Component, Module, Line);
if (ACPI_FAILURE (Status))
{
@@ -634,8 +580,8 @@ AcpiUtAllocateAndTrack (
return (NULL);
}
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+ AcpiGbl_GlobalList->TotalAllocated++;
+ AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
return ((void *) &Allocation->UserSpace);
}
@@ -678,7 +624,7 @@ AcpiUtCallocateAndTrack (
return (NULL);
}
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
+ Status = AcpiUtTrackAllocation (Allocation, Size,
ACPI_MEM_CALLOC, Component, Module, Line);
if (ACPI_FAILURE (Status))
{
@@ -686,8 +632,8 @@ AcpiUtCallocateAndTrack (
return (NULL);
}
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
+ AcpiGbl_GlobalList->TotalAllocated++;
+ AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
return ((void *) &Allocation->UserSpace);
}
@@ -733,10 +679,10 @@ AcpiUtFreeAndTrack (
DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
(((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size;
+ AcpiGbl_GlobalList->TotalFreed++;
+ AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size;
- Status = AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock,
+ Status = AcpiUtRemoveAllocation (DebugBlock,
Component, Module, Line);
if (ACPI_FAILURE (Status))
{
@@ -756,8 +702,7 @@ AcpiUtFreeAndTrack (
*
* FUNCTION: AcpiUtFindAllocation
*
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
*
* RETURN: A list element if found; NULL otherwise.
*
@@ -767,7 +712,6 @@ AcpiUtFreeAndTrack (
static ACPI_DEBUG_MEM_BLOCK *
AcpiUtFindAllocation (
- UINT32 ListId,
void *Allocation)
{
ACPI_DEBUG_MEM_BLOCK *Element;
@@ -776,12 +720,7 @@ AcpiUtFindAllocation (
ACPI_FUNCTION_ENTRY ();
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return (NULL);
- }
-
- Element = AcpiGbl_MemoryLists[ListId].ListHead;
+ Element = AcpiGbl_GlobalList->ListHead;
/* Search for the address. */
@@ -803,8 +742,7 @@ AcpiUtFindAllocation (
*
* FUNCTION: AcpiUtTrackAllocation
*
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Size - Size of the allocation
* AllocType - MEM_MALLOC or MEM_CALLOC
* Component - Component type of caller
@@ -819,7 +757,6 @@ AcpiUtFindAllocation (
static ACPI_STATUS
AcpiUtTrackAllocation (
- UINT32 ListId,
ACPI_DEBUG_MEM_BLOCK *Allocation,
ACPI_SIZE Size,
UINT8 AllocType,
@@ -835,12 +772,7 @@ AcpiUtTrackAllocation (
ACPI_FUNCTION_TRACE_PTR ("UtTrackAllocation", Allocation);
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- MemList = &AcpiGbl_MemoryLists[ListId];
+ MemList = AcpiGbl_GlobalList;
Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
if (ACPI_FAILURE (Status))
{
@@ -851,8 +783,7 @@ AcpiUtTrackAllocation (
* Search list for this address to make sure it is not already on the list.
* This will catch several kinds of problems.
*/
-
- Element = AcpiUtFindAllocation (ListId, Allocation);
+ Element = AcpiUtFindAllocation (Allocation);
if (Element)
{
ACPI_REPORT_ERROR ((
@@ -898,8 +829,7 @@ UnlockAndExit:
*
* FUNCTION: AcpiUtRemoveAllocation
*
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
+ * PARAMETERS: Allocation - Address of allocated memory
* Component - Component type of caller
* Module - Source file name of caller
* Line - Line number of caller
@@ -912,7 +842,6 @@ UnlockAndExit:
static ACPI_STATUS
AcpiUtRemoveAllocation (
- UINT32 ListId,
ACPI_DEBUG_MEM_BLOCK *Allocation,
UINT32 Component,
char *Module,
@@ -925,12 +854,7 @@ AcpiUtRemoveAllocation (
ACPI_FUNCTION_TRACE ("UtRemoveAllocation");
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- MemList = &AcpiGbl_MemoryLists[ListId];
+ MemList = AcpiGbl_GlobalList;
if (NULL == MemList->ListHead)
{
/* No allocations! */
@@ -1069,7 +993,7 @@ AcpiUtDumpAllocations (
return;
}
- Element = AcpiGbl_MemoryLists[0].ListHead;
+ Element = AcpiGbl_GlobalList->ListHead;
while (Element)
{
if ((Element->Component & Component) &&
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utcache.c b/usr/src/uts/i86pc/io/acpica/utilities/utcache.c
new file mode 100644
index 0000000000..196772cb0d
--- /dev/null
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utcache.c
@@ -0,0 +1,418 @@
+/******************************************************************************
+ *
+ * Module Name: utcache - local cache allocation routines
+ * $Revision: 2 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2005, 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 __UTCACHE_C__
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utcache")
+
+
+#ifdef ACPI_USE_LOCAL_CACHE
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsCreateCache
+ *
+ * PARAMETERS: CacheName - Ascii name for the cache
+ * ObjectSize - Size of each cached object
+ * MaxDepth - Maximum depth of the cache (in objects)
+ * ReturnCache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiOsCreateCache (
+ char *CacheName,
+ UINT16 ObjectSize,
+ UINT16 MaxDepth,
+ ACPI_MEMORY_LIST **ReturnCache)
+{
+ ACPI_MEMORY_LIST *Cache;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!CacheName || !ReturnCache || (ObjectSize < 16))
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Create the cache object */
+
+ Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
+ if (!Cache)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Populate the cache object and return it */
+
+ ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
+ Cache->LinkOffset = 8;
+ Cache->ListName = CacheName;
+ Cache->ObjectSize = ObjectSize;
+ Cache->MaxDepth = MaxDepth;
+
+ *ReturnCache = Cache;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsPurgeCache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiOsPurgeCache (
+ ACPI_MEMORY_LIST *Cache)
+{
+ char *Next;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Cache)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Walk the list of objects in this cache */
+
+ while (Cache->ListHead)
+ {
+ /* Delete and unlink one cached state object */
+
+ Next = *(ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) Cache->ListHead)[Cache->LinkOffset])));
+ ACPI_MEM_FREE (Cache->ListHead);
+
+ Cache->ListHead = Next;
+ Cache->CurrentDepth--;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsDeleteCache
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ * cache object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiOsDeleteCache (
+ ACPI_MEMORY_LIST *Cache)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Purge all objects in the cache */
+
+ Status = AcpiOsPurgeCache (Cache);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Now we can delete the cache object */
+
+ AcpiOsFree (Cache);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsReleaseObject
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ * Object - The object to be released
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Release an object to the specified cache. If cache is full,
+ * the object is deleted.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiOsReleaseObject (
+ ACPI_MEMORY_LIST *Cache,
+ void *Object)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!Cache || !Object)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* If cache is full, just free this object */
+
+ if (Cache->CurrentDepth >= Cache->MaxDepth)
+ {
+ ACPI_MEM_FREE (Object);
+ ACPI_MEM_TRACKING (Cache->TotalFreed++);
+ }
+
+ /* Otherwise put this object back into the cache */
+
+ else
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Mark the object as cached */
+
+ ACPI_MEMSET (Object, 0xCA, Cache->ObjectSize);
+ ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
+
+ /* Put the object at the head of the cache list */
+
+ * (ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
+ Cache->ListHead = Object;
+ Cache->CurrentDepth++;
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsAcquireObject
+ *
+ * PARAMETERS: Cache - Handle to cache object
+ *
+ * RETURN: the acquired object. NULL on error
+ *
+ * DESCRIPTION: Get an object from the specified cache. If cache is empty,
+ * the object is allocated.
+ *
+ ******************************************************************************/
+
+void *
+AcpiOsAcquireObject (
+ ACPI_MEMORY_LIST *Cache)
+{
+ ACPI_STATUS Status;
+ void *Object;
+
+
+ ACPI_FUNCTION_NAME ("OsAcquireObject");
+
+
+ if (!Cache)
+ {
+ return (NULL);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ ACPI_MEM_TRACKING (Cache->Requests++);
+
+ /* Check the cache first */
+
+ if (Cache->ListHead)
+ {
+ /* There is an object available, use it */
+
+ Object = Cache->ListHead;
+ Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
+ &(((char *) Object)[Cache->LinkOffset])));
+
+ Cache->CurrentDepth--;
+
+ ACPI_MEM_TRACKING (Cache->Hits++);
+ ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Object %p from %s cache\n", Object, Cache->ListName)));
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ /* Clear (zero) the previously used Object */
+
+ ACPI_MEMSET (Object, 0, Cache->ObjectSize);
+ }
+ else
+ {
+ /* The cache is empty, create a new object */
+
+ ACPI_MEM_TRACKING (Cache->TotalAllocated++);
+
+ /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ Object = ACPI_MEM_CALLOCATE (Cache->ObjectSize);
+ if (!Object)
+ {
+ return (NULL);
+ }
+ }
+
+ return (Object);
+}
+#endif /* ACPI_USE_LOCAL_CACHE */
+
+
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c b/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c
index 4e73ec37df..7695ceb157 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 120 $
+ * $Revision: 121 $
*
*****************************************************************************/
@@ -782,56 +782,45 @@ AcpiUtCopySimpleObject (
DestDesc->Common.ReferenceCount = ReferenceCount;
DestDesc->Common.NextObject = NextObject;
+ /* New object is not static, regardless of source */
+
+ DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
+
/* Handle the objects with extra data */
switch (ACPI_GET_OBJECT_TYPE (DestDesc))
{
case ACPI_TYPE_BUFFER:
-
- DestDesc->Buffer.Node = NULL;
- DestDesc->Common.Flags = SourceDesc->Common.Flags;
-
/*
* Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer pointer
- * 2) The buffer is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * 2) The buffer has a length > 0
*/
if ((SourceDesc->Buffer.Pointer) &&
- (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ (SourceDesc->Buffer.Length))
{
- DestDesc->Buffer.Pointer = NULL;
-
- /* Create an actual buffer only if length > 0 */
-
- if (SourceDesc->Buffer.Length)
+ DestDesc->Buffer.Pointer =
+ ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
+ if (!DestDesc->Buffer.Pointer)
{
- DestDesc->Buffer.Pointer =
- ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
- if (!DestDesc->Buffer.Pointer)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Copy the actual buffer data */
-
- ACPI_MEMCPY (DestDesc->Buffer.Pointer,
- SourceDesc->Buffer.Pointer,
- SourceDesc->Buffer.Length);
+ return (AE_NO_MEMORY);
}
+
+ /* Copy the actual buffer data */
+
+ ACPI_MEMCPY (DestDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Length);
}
break;
case ACPI_TYPE_STRING:
-
/*
* Allocate and copy the actual string if and only if:
* 1) There is a valid string pointer
- * 2) The string is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * (Pointer to a NULL string is allowed)
*/
- if ((SourceDesc->String.Pointer) &&
- (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ if (SourceDesc->String.Pointer)
{
DestDesc->String.Pointer =
ACPI_MEM_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
@@ -840,6 +829,8 @@ AcpiUtCopySimpleObject (
return (AE_NO_MEMORY);
}
+ /* Copy the actual string data */
+
ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
(ACPI_SIZE) SourceDesc->String.Length + 1);
}
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c b/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c
index 1fe0221d3b..2f69c16820 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 115 $
+ * $Revision: 118 $
*
*****************************************************************************/
@@ -191,10 +191,9 @@ AcpiUtTrackStackPtr (
*
* PARAMETERS: RequestedDebugLevel - Requested debug print level
* LineNumber - Caller's line number (for error output)
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Format - Printf format field
* ... - Optional printf arguments
*
@@ -209,7 +208,9 @@ void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...)
{
@@ -221,7 +222,7 @@ AcpiUtDebugPrint (
* Stay silent if the debug level or component ID is disabled
*/
if (!(RequestedDebugLevel & AcpiDbgLevel) ||
- !(DbgInfo->ComponentId & AcpiDbgLayer))
+ !(ComponentId & AcpiDbgLayer))
{
return;
}
@@ -247,7 +248,7 @@ AcpiUtDebugPrint (
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
- AcpiOsPrintf ("%8s-%04ld ", DbgInfo->ModuleName, LineNumber);
+ AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
@@ -255,7 +256,7 @@ AcpiUtDebugPrint (
}
AcpiOsPrintf ("[%02ld] %-22.22s: ",
- AcpiGbl_NestingLevel, DbgInfo->ProcName);
+ AcpiGbl_NestingLevel, FunctionName);
va_start (args, Format);
AcpiOsVprintf (Format, args);
@@ -268,10 +269,9 @@ AcpiUtDebugPrint (
*
* PARAMETERS: RequestedDebugLevel - Requested debug print level
* LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Format - Printf format field
* ... - Optional printf arguments
*
@@ -286,7 +286,9 @@ void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...)
{
@@ -294,7 +296,7 @@ AcpiUtDebugPrintRaw (
if (!(RequestedDebugLevel & AcpiDbgLevel) ||
- !(DbgInfo->ComponentId & AcpiDbgLayer))
+ !(ComponentId & AcpiDbgLayer))
{
return;
}
@@ -309,10 +311,9 @@ AcpiUtDebugPrintRaw (
* FUNCTION: AcpiUtTrace
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
*
* RETURN: None
*
@@ -324,14 +325,17 @@ AcpiUtDebugPrintRaw (
void
AcpiUtTrace (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo)
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s\n", AcpiGbl_FnEntryStr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s\n", AcpiGbl_FnEntryStr);
}
@@ -340,10 +344,9 @@ AcpiUtTrace (
* FUNCTION: AcpiUtTracePtr
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Pointer - Pointer to display
*
* RETURN: None
@@ -356,14 +359,17 @@ AcpiUtTrace (
void
AcpiUtTracePtr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
void *Pointer)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
}
@@ -372,10 +378,9 @@ AcpiUtTracePtr (
* FUNCTION: AcpiUtTraceStr
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* String - Additional string to display
*
* RETURN: None
@@ -388,15 +393,18 @@ AcpiUtTracePtr (
void
AcpiUtTraceStr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *String)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %s\n", AcpiGbl_FnEntryStr, String);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %s\n", AcpiGbl_FnEntryStr, String);
}
@@ -405,10 +413,9 @@ AcpiUtTraceStr (
* FUNCTION: AcpiUtTraceU32
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Integer - Integer to display
*
* RETURN: None
@@ -421,15 +428,18 @@ AcpiUtTraceStr (
void
AcpiUtTraceU32 (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT32 Integer)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
}
@@ -438,10 +448,9 @@ AcpiUtTraceU32 (
* FUNCTION: AcpiUtExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
*
* RETURN: None
*
@@ -453,11 +462,14 @@ AcpiUtTraceU32 (
void
AcpiUtExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo)
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s\n", AcpiGbl_FnExitStr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s\n", AcpiGbl_FnExitStr);
AcpiGbl_NestingLevel--;
}
@@ -468,10 +480,9 @@ AcpiUtExit (
* FUNCTION: AcpiUtStatusExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Status - Exit status code
*
* RETURN: None
@@ -484,21 +495,25 @@ AcpiUtExit (
void
AcpiUtStatusExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_STATUS Status)
{
if (ACPI_SUCCESS (Status))
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %s\n", AcpiGbl_FnExitStr,
- AcpiFormatException (Status));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
}
else
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
- AcpiFormatException (Status));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
}
AcpiGbl_NestingLevel--;
@@ -510,10 +525,9 @@ AcpiUtStatusExit (
* FUNCTION: AcpiUtValueExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Value - Value to be printed with exit msg
*
* RETURN: None
@@ -526,13 +540,16 @@ AcpiUtStatusExit (
void
AcpiUtValueExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_INTEGER Value)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
- ACPI_FORMAT_UINT64 (Value));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
+ ACPI_FORMAT_UINT64 (Value));
AcpiGbl_NestingLevel--;
}
@@ -543,10 +560,9 @@ AcpiUtValueExit (
* FUNCTION: AcpiUtPtrExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Ptr - Pointer to display
*
* RETURN: None
@@ -559,12 +575,15 @@ AcpiUtValueExit (
void
AcpiUtPtrExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT8 *Ptr)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %p\n", AcpiGbl_FnExitStr, Ptr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %p\n", AcpiGbl_FnExitStr, Ptr);
AcpiGbl_NestingLevel--;
}
@@ -630,7 +649,7 @@ AcpiUtDumpBuffer (
/* Dump fill spaces */
AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
- j += Display;
+ j += (ACPI_NATIVE_UINT) Display;
continue;
}
@@ -666,7 +685,7 @@ AcpiUtDumpBuffer (
break;
}
- j += Display;
+ j += (ACPI_NATIVE_UINT) Display;
}
/*
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c b/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c
index c435aafbf0..77b3bf57fc 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 105 $
+ * $Revision: 107 $
*
******************************************************************************/
@@ -529,38 +529,26 @@ AcpiUtUpdateObjectReference (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action)
{
- ACPI_STATUS Status;
- UINT32 i;
- ACPI_GENERIC_STATE *StateList = NULL;
- ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *StateList = NULL;
+ ACPI_OPERAND_OBJECT *NextObject = NULL;
+ ACPI_GENERIC_STATE *State;
+ ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
- /* Ignore a null object ptr */
-
- if (!Object)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Make sure that this isn't a namespace handle */
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ while (Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "Object %p is NS handle\n", Object));
- return_ACPI_STATUS (AE_OK);
- }
+ /* Make sure that this isn't a namespace handle */
- State = AcpiUtCreateUpdateState (Object, Action);
-
- while (State)
- {
- Object = State->Update.Object;
- Action = State->Update.Value;
- AcpiUtDeleteGenericState (State);
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Object %p is NS handle\n", Object));
+ return_ACPI_STATUS (AE_OK);
+ }
/*
* All sub-objects must have their reference count incremented also.
@@ -574,12 +562,10 @@ AcpiUtUpdateObjectReference (
AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
break;
-
case ACPI_TYPE_PACKAGE:
-
/*
- * We must update all the sub-objects of the package
- * (Each of whom may have their own sub-objects, etc.
+ * We must update all the sub-objects of the package,
+ * each of whom may have their own sub-objects.
*/
for (i = 0; i < Object->Package.Count; i++)
{
@@ -597,38 +583,19 @@ AcpiUtUpdateObjectReference (
}
break;
-
case ACPI_TYPE_BUFFER_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BufferField.BufferObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
+ NextObject = Object->BufferField.BufferObj;
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->Field.RegionObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
- break;
-
+ NextObject = Object->Field.RegionObj;
+ break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BankField.BankObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
+ NextObject = Object->BankField.BankObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->BankField.RegionObj, Action, &StateList);
if (ACPI_FAILURE (Status))
@@ -637,16 +604,9 @@ AcpiUtUpdateObjectReference (
}
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->IndexField.IndexObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
+ NextObject = Object->IndexField.IndexObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->IndexField.DataObj, Action, &StateList);
if (ACPI_FAILURE (Status))
@@ -655,30 +615,20 @@ AcpiUtUpdateObjectReference (
}
break;
-
case ACPI_TYPE_LOCAL_REFERENCE:
-
/*
* The target of an Index (a package, string, or buffer) must track
* changes to the ref count of the index.
*/
if (Object->Reference.Opcode == AML_INDEX_OP)
{
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->Reference.Object, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
+ NextObject = Object->Reference.Object;
}
break;
-
case ACPI_TYPE_REGION:
default:
-
- /* No subobjects */
- break;
+ break;/* No subobjects */
}
/*
@@ -687,15 +637,25 @@ AcpiUtUpdateObjectReference (
* main object to be deleted.
*/
AcpiUtUpdateRefCount (Object, Action);
+ Object = NULL;
/* Move on to the next object to be updated */
- State = AcpiUtPopGenericState (&StateList);
+ if (NextObject)
+ {
+ Object = NextObject;
+ NextObject = NULL;
+ }
+ else if (StateList)
+ {
+ State = AcpiUtPopGenericState (&StateList);
+ Object = State->Update.Object;
+ AcpiUtDeleteGenericState (State);
+ }
}
return_ACPI_STATUS (AE_OK);
-
ErrorExit:
ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c b/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c
index 1a50dfce7e..6de849c5db 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 211 $
+ * $Revision: 213 $
*
*****************************************************************************/
@@ -822,73 +822,6 @@ AcpiUtValidObjectType (
/*******************************************************************************
*
- * FUNCTION: AcpiUtAllocateOwnerId
- *
- * PARAMETERS: IdType - Type of ID (method or table)
- *
- * DESCRIPTION: Allocate a table or method owner id
- *
- * NOTE: This algorithm has a wraparound problem at 64K method invocations, and
- * should be revisited (TBD)
- *
- ******************************************************************************/
-
-ACPI_OWNER_ID
-AcpiUtAllocateOwnerId (
- UINT32 IdType)
-{
- ACPI_OWNER_ID OwnerId = 0xFFFF;
-
-
- ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
-
-
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
- {
- return (0);
- }
-
- switch (IdType)
- {
- case ACPI_OWNER_TYPE_TABLE:
-
- OwnerId = AcpiGbl_NextTableOwnerId;
- AcpiGbl_NextTableOwnerId++;
-
- /* Check for wraparound */
-
- if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
- {
- AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
- ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
- }
- break;
-
-
- case ACPI_OWNER_TYPE_METHOD:
-
- OwnerId = AcpiGbl_NextMethodOwnerId;
- AcpiGbl_NextMethodOwnerId++;
-
- if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
- {
- /* Check for wraparound */
-
- AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
- }
- break;
-
- default:
- break;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
- return_VALUE (OwnerId);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiUtInitGlobals
*
* PARAMETERS: None
@@ -904,42 +837,20 @@ void
AcpiUtInitGlobals (
void)
{
+ ACPI_STATUS Status;
UINT32 i;
ACPI_FUNCTION_TRACE ("UtInitGlobals");
- /* Memory allocation and cache lists */
-
- ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
+ /* Create all memory caches */
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE);
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH;
-
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache");
+ Status = AcpiUtCreateCaches ();
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
/* ACPI table structure */
@@ -954,7 +865,7 @@ AcpiUtInitGlobals (
for (i = 0; i < NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].Mutex = NULL;
- AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[i].UseCount = 0;
}
@@ -995,8 +906,7 @@ AcpiUtInitGlobals (
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
- AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
+ AcpiGbl_OwnerIdMask = 0;
AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utinit.c b/usr/src/uts/i86pc/io/acpica/utilities/utinit.c
index 0f00178879..5863e15a5d 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utinit.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 122 $
+ * $Revision: 123 $
*
*****************************************************************************/
@@ -351,7 +351,7 @@ AcpiUtSubsystemShutdown (
/* Purge the local caches */
- (void) AcpiPurgeCachedObjects ();
+ (void) AcpiUtDeleteCaches ();
/* Debug only - display leftover memory allocation, if any */
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c b/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c
index 29b5ff0cc3..546dd1ce91 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 112 $
+ * $Revision: 116 $
*
******************************************************************************/
@@ -124,15 +124,105 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utmisc")
-/* Local prototypes */
-static ACPI_STATUS
-AcpiUtCreateMutex (
- ACPI_MUTEX_HANDLE MutexId);
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateOwnerId
+ *
+ * PARAMETERS: OwnerId - Where the new owner ID is returned
+ *
+ * DESCRIPTION: Allocate a table or method owner id
+ *
+ ******************************************************************************/
-static ACPI_STATUS
-AcpiUtDeleteMutex (
- ACPI_MUTEX_HANDLE MutexId);
+ACPI_STATUS
+AcpiUtAllocateOwnerId (
+ ACPI_OWNER_ID *OwnerId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Find a free owner ID */
+
+ for (i = 0; i < 32; i++)
+ {
+ if (!(AcpiGbl_OwnerIdMask & (1 << i)))
+ {
+ AcpiGbl_OwnerIdMask |= (1 << i);
+ *OwnerId = (ACPI_OWNER_ID) i;
+ goto exit;
+ }
+ }
+
+ /*
+ * If we are here, all OwnerIds have been allocated. This probably should
+ * not happen since the IDs are reused after deallocation. The IDs are
+ * allocated upon table load (one per table) and method execution, and
+ * they are released when a table is unloaded or a method completes
+ * execution.
+ */
+ Status = AE_OWNER_ID_LIMIT;
+ ACPI_REPORT_ERROR ((
+ "Could not allocate new OwnerId (32 max), AE_OWNER_ID_LIMIT\n"));
+
+exit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReleaseOwnerId
+ *
+ * PARAMETERS: OwnerId - A previously allocated owner ID
+ *
+ * DESCRIPTION: Release a table or method owner id
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtReleaseOwnerId (
+ ACPI_OWNER_ID OwnerId)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtReleaseOwnerId");
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Free the owner ID */
+
+ if (AcpiGbl_OwnerIdMask & (1 << OwnerId))
+ {
+ AcpiGbl_OwnerIdMask ^= (1 << OwnerId);
+ }
+ else
+ {
+ /* This OwnerId has not been allocated */
+
+ Status = AE_NOT_EXIST;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return_ACPI_STATUS (Status);
+}
/*******************************************************************************
@@ -159,6 +249,11 @@ AcpiUtStrupr (
ACPI_FUNCTION_ENTRY ();
+ if (!SrcString)
+ {
+ return (NULL);
+ }
+
/* Walk entire string, uppercasing the letters */
for (String = SrcString; *String; String++)
@@ -650,339 +745,6 @@ ErrorExit:
/*******************************************************************************
*
- * FUNCTION: AcpiUtMutexInitialize
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtMutexInitialize (
- void)
-{
- UINT32 i;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("UtMutexInitialize");
-
-
- /*
- * Create each of the predefined mutex objects
- */
- for (i = 0; i < NUM_MUTEX; i++)
- {
- Status = AcpiUtCreateMutex (i);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtMutexTerminate
- *
- * PARAMETERS: None.
- *
- * RETURN: None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void
-AcpiUtMutexTerminate (
- void)
-{
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE ("UtMutexTerminate");
-
-
- /*
- * Delete each predefined mutex object
- */
- for (i = 0; i < NUM_MUTEX; i++)
- {
- (void) AcpiUtDeleteMutex (i);
- }
-
- AcpiOsDeleteLock (AcpiGbl_GpeLock);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be created
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a mutex object.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiUtCreateMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
-
-
- if (MutexId > MAX_MUTEX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (!AcpiGbl_MutexInfo[MutexId].Mutex)
- {
- Status = AcpiOsCreateSemaphore (1, 1,
- &AcpiGbl_MutexInfo[MutexId].Mutex);
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_MutexInfo[MutexId].UseCount = 0;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be deleted
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete a mutex object.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiUtDeleteMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
-
-
- if (MutexId > MAX_MUTEX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
-
- AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAcquireMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be acquired
- *
- * RETURN: Status
- *
- * DESCRIPTION: Acquire a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtAcquireMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
- UINT32 ThisThreadId;
-
-
- ACPI_FUNCTION_NAME ("UtAcquireMutex");
-
-
- if (MutexId > MAX_MUTEX)
- {
- return (AE_BAD_PARAMETER);
- }
-
- ThisThreadId = AcpiOsGetThreadId ();
-
-#ifdef ACPI_MUTEX_DEBUG
- {
- UINT32 i;
- /*
- * Mutex debug code, for internal debugging only.
- *
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than or equal to this one. If so, the thread has violated
- * the mutex ordering rule. This indicates a coding error somewhere in
- * the ACPI subsystem code.
- */
- for (i = MutexId; i < MAX_MUTEX; i++)
- {
- if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
- {
- if (i == MutexId)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] already acquired by this thread [%X]\n",
- AcpiUtGetMutexName (MutexId), ThisThreadId));
-
- return (AE_ALREADY_ACQUIRED);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (i),
- AcpiUtGetMutexName (MutexId)));
-
- return (AE_ACQUIRE_DEADLOCK);
- }
- }
- }
-#endif
-
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X attempting to acquire Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
-
- Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
- 1, ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
-
- AcpiGbl_MutexInfo[MutexId].UseCount++;
- AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId;
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not acquire Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReleaseMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be released
- *
- * RETURN: Status
- *
- * DESCRIPTION: Release a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtReleaseMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
- UINT32 i;
- UINT32 ThisThreadId;
-
-
- ACPI_FUNCTION_NAME ("UtReleaseMutex");
-
-
- ThisThreadId = AcpiOsGetThreadId ();
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X releasing Mutex [%s]\n", ThisThreadId,
- AcpiUtGetMutexName (MutexId)));
-
- if (MutexId > MAX_MUTEX)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Mutex must be acquired in order to release it!
- */
- if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] is not acquired, cannot release\n",
- AcpiUtGetMutexName (MutexId)));
-
- return (AE_NOT_ACQUIRED);
- }
-
- /*
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than this one. If so, the thread has violated the mutex
- * ordering rule. This indicates a coding error somewhere in
- * the ACPI subsystem code.
- */
- for (i = MutexId; i < MAX_MUTEX; i++)
- {
- if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
- {
- if (i == MutexId)
- {
- continue;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid release order: owns [%s], releasing [%s]\n",
- AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
-
- return (AE_RELEASE_DEADLOCK);
- }
- }
-
- /* Mark unlocked FIRST */
-
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
-
- Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not release Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiUtCreateUpdateStateAndPush
*
* PARAMETERS: Object - Object to be added to the new state
@@ -1027,367 +789,6 @@ AcpiUtCreateUpdateStateAndPush (
/*******************************************************************************
*
- * FUNCTION: AcpiUtCreatePkgStateAndPush
- *
- * PARAMETERS: Object - Object to be added to the new state
- * Action - Increment/Decrement
- * StateList - List the state will be added to
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtCreatePkgStateAndPush (
- void *InternalObject,
- void *ExternalObject,
- UINT16 Index,
- ACPI_GENERIC_STATE **StateList)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
- if (!State)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiUtPushGenericState (StateList, State);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPushGenericState
- *
- * PARAMETERS: ListHead - Head of the state stack
- * State - State object to push
- *
- * RETURN: None
- *
- * DESCRIPTION: Push a state object onto a state stack
- *
- ******************************************************************************/
-
-void
-AcpiUtPushGenericState (
- ACPI_GENERIC_STATE **ListHead,
- ACPI_GENERIC_STATE *State)
-{
- ACPI_FUNCTION_TRACE ("UtPushGenericState");
-
-
- /* Push the state object onto the front of the list (stack) */
-
- State->Common.Next = *ListHead;
- *ListHead = State;
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPopGenericState
- *
- * PARAMETERS: ListHead - Head of the state stack
- *
- * RETURN: The popped state object
- *
- * DESCRIPTION: Pop a state object from a state stack
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtPopGenericState (
- ACPI_GENERIC_STATE **ListHead)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE ("UtPopGenericState");
-
-
- /* Remove the state object at the head of the list (stack) */
-
- State = *ListHead;
- if (State)
- {
- /* Update the list head */
-
- *ListHead = State->Common.Next;
- }
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateGenericState
- *
- * PARAMETERS: None
- *
- * RETURN: The new state object. NULL on failure.
- *
- * DESCRIPTION: Create a generic state object. Attempt to obtain one from
- * the global state cache; If none available, create a new one.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreateGenericState (
- void)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- State = AcpiUtAcquireFromCache (ACPI_MEM_LIST_STATE);
-
- /* Initialize */
-
- if (State)
- {
- State->Common.DataType = ACPI_DESC_TYPE_STATE;
- }
-
- return (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateThreadState
- *
- * PARAMETERS: None
- *
- * RETURN: New Thread State. NULL on failure
- *
- * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
- * to track per-thread info during method execution
- *
- ******************************************************************************/
-
-ACPI_THREAD_STATE *
-AcpiUtCreateThreadState (
- void)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE ("UtCreateThreadState");
-
-
- /* Create the generic state object */
-
- State = AcpiUtCreateGenericState ();
- if (!State)
- {
- return_PTR (NULL);
- }
-
- /* Init fields specific to the update struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
- State->Thread.ThreadId = AcpiOsGetThreadId ();
-
- return_PTR ((ACPI_THREAD_STATE *) State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateUpdateState
- *
- * PARAMETERS: Object - Initial Object to be installed in the state
- * Action - Update action to be performed
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- * to update reference counts and delete complex objects such
- * as packages.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreateUpdateState (
- ACPI_OPERAND_OBJECT *Object,
- UINT16 Action)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
-
-
- /* Create the generic state object */
-
- State = AcpiUtCreateGenericState ();
- if (!State)
- {
- return_PTR (NULL);
- }
-
- /* Init fields specific to the update struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
- State->Update.Object = Object;
- State->Update.Value = Action;
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreatePkgState
- *
- * PARAMETERS: Object - Initial Object to be installed in the state
- * Action - Update action to be performed
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create a "Package State"
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreatePkgState (
- void *InternalObject,
- void *ExternalObject,
- UINT16 Index)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
-
-
- /* Create the generic state object */
-
- State = AcpiUtCreateGenericState ();
- if (!State)
- {
- return_PTR (NULL);
- }
-
- /* Init fields specific to the update struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE;
- State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
- State->Pkg.DestObject = ExternalObject;
- State->Pkg.Index = Index;
- State->Pkg.NumPackages = 1;
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateControlState
- *
- * PARAMETERS: None
- *
- * RETURN: New state object, null on failure
- *
- * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
- * to support nested IF/WHILE constructs in the AML.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreateControlState (
- void)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE ("UtCreateControlState");
-
-
- /* Create the generic state object */
-
- State = AcpiUtCreateGenericState ();
- if (!State)
- {
- return_PTR (NULL);
- }
-
- /* Init fields specific to the control struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
- State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteGenericState
- *
- * PARAMETERS: State - The state object to be deleted
- *
- * RETURN: None
- *
- * DESCRIPTION: Put a state object back into the global state cache. The object
- * is not actually freed at this time.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteGenericState (
- ACPI_GENERIC_STATE *State)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
-
-
- AcpiUtReleaseToCache (ACPI_MEM_LIST_STATE, State);
- return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteGenericStateCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteGenericStateCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteGenericStateCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_STATE);
- return_VOID;
-}
-#endif
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiUtWalkPackageTree
*
* PARAMETERS: SourceObject - The package to walk
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utmutex.c b/usr/src/uts/i86pc/io/acpica/utilities/utmutex.c
new file mode 100644
index 0000000000..2b99b3a4fe
--- /dev/null
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utmutex.c
@@ -0,0 +1,474 @@
+/*******************************************************************************
+ *
+ * Module Name: utmutex - local mutex support
+ * $Revision: 2 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2005, 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 __UTMUTEX_C__
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utmutex")
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiUtCreateMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+static ACPI_STATUS
+AcpiUtDeleteMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMutexInitialize
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create the system mutex objects.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtMutexInitialize (
+ void)
+{
+ UINT32 i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE ("UtMutexInitialize");
+
+
+ /*
+ * Create each of the predefined mutex objects
+ */
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ Status = AcpiUtCreateMutex (i);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMutexTerminate
+ *
+ * PARAMETERS: None.
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Delete all of the system mutex objects.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtMutexTerminate (
+ void)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE ("UtMutexTerminate");
+
+
+ /*
+ * Delete each predefined mutex object
+ */
+ for (i = 0; i < NUM_MUTEX; i++)
+ {
+ (void) AcpiUtDeleteMutex (i);
+ }
+
+ AcpiOsDeleteLock (AcpiGbl_GpeLock);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be created
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a mutex object.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtCreateMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (!AcpiGbl_MutexInfo[MutexId].Mutex)
+ {
+ Status = AcpiOsCreateSemaphore (1, 1,
+ &AcpiGbl_MutexInfo[MutexId].Mutex);
+ AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[MutexId].UseCount = 0;
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be deleted
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete a mutex object.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtDeleteMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
+
+ AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
+ AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAcquireMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be acquired
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAcquireMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+ UINT32 ThisThreadId;
+
+
+ ACPI_FUNCTION_NAME ("UtAcquireMutex");
+
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ ThisThreadId = AcpiOsGetThreadId ();
+
+#ifdef ACPI_MUTEX_DEBUG
+ {
+ UINT32 i;
+ /*
+ * Mutex debug code, for internal debugging only.
+ *
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than or equal to this one. If so, the thread has violated
+ * the mutex ordering rule. This indicates a coding error somewhere in
+ * the ACPI subsystem code.
+ */
+ for (i = MutexId; i < MAX_MUTEX; i++)
+ {
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
+ {
+ if (i == MutexId)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] already acquired by this thread [%X]\n",
+ AcpiUtGetMutexName (MutexId), ThisThreadId));
+
+ return (AE_ALREADY_ACQUIRED);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (i),
+ AcpiUtGetMutexName (MutexId)));
+
+ return (AE_ACQUIRE_DEADLOCK);
+ }
+ }
+ }
+#endif
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X attempting to acquire Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+
+ Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
+ 1, ACPI_WAIT_FOREVER);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+
+ AcpiGbl_MutexInfo[MutexId].UseCount++;
+ AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId;
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Thread %X could not acquire Mutex [%s] %s\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId),
+ AcpiFormatException (Status)));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReleaseMutex
+ *
+ * PARAMETERS: MutexID - ID of the mutex to be released
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release a mutex object.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtReleaseMutex (
+ ACPI_MUTEX_HANDLE MutexId)
+{
+ ACPI_STATUS Status;
+ UINT32 ThisThreadId;
+
+
+ ACPI_FUNCTION_NAME ("UtReleaseMutex");
+
+
+ ThisThreadId = AcpiOsGetThreadId ();
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
+ "Thread %X releasing Mutex [%s]\n", ThisThreadId,
+ AcpiUtGetMutexName (MutexId)));
+
+ if (MutexId > MAX_MUTEX)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Mutex must be acquired in order to release it!
+ */
+ if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Mutex [%s] is not acquired, cannot release\n",
+ AcpiUtGetMutexName (MutexId)));
+
+ return (AE_NOT_ACQUIRED);
+ }
+
+#ifdef ACPI_MUTEX_DEBUG
+ {
+ UINT32 i;
+ /*
+ * Mutex debug code, for internal debugging only.
+ *
+ * Deadlock prevention. Check if this thread owns any mutexes of value
+ * greater than this one. If so, the thread has violated the mutex
+ * ordering rule. This indicates a coding error somewhere in
+ * the ACPI subsystem code.
+ */
+ for (i = MutexId; i < MAX_MUTEX; i++)
+ {
+ if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
+ {
+ if (i == MutexId)
+ {
+ continue;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Invalid release order: owns [%s], releasing [%s]\n",
+ AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
+
+ return (AE_RELEASE_DEADLOCK);
+ }
+ }
+ }
+#endif
+
+ /* Mark unlocked FIRST */
+
+ AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
+
+ Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Thread %X could not release Mutex [%s] %s\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId),
+ AcpiFormatException (Status)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
+ ThisThreadId, AcpiUtGetMutexName (MutexId)));
+ }
+
+ return (Status);
+}
+
+
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utobject.c b/usr/src/uts/i86pc/io/acpica/utilities/utobject.c
index fe93ba2d92..39f1b44806 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utobject.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 95 $
+ * $Revision: 97 $
*
*****************************************************************************/
@@ -422,7 +422,7 @@ AcpiUtAllocateObjectDescDbg (
ACPI_FUNCTION_TRACE ("UtAllocateObjectDescDbg");
- Object = AcpiUtAcquireFromCache (ACPI_MEM_LIST_OPERAND);
+ Object = AcpiOsAcquireObject (AcpiGbl_OperandCache);
if (!Object)
{
_ACPI_REPORT_ERROR (ModuleName, LineNumber, ComponentId,
@@ -471,37 +471,9 @@ AcpiUtDeleteObjectDesc (
return_VOID;
}
- AcpiUtReleaseToCache (ACPI_MEM_LIST_OPERAND, Object);
-
- return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteObjectCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteObjectCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteObjectCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_OPERAND);
+ (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object);
return_VOID;
}
-#endif
/*******************************************************************************
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utstate.c b/usr/src/uts/i86pc/io/acpica/utilities/utstate.c
new file mode 100644
index 0000000000..ce9a20ccd6
--- /dev/null
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utstate.c
@@ -0,0 +1,459 @@
+/*******************************************************************************
+ *
+ * Module Name: utstate - state object support procedures
+ * $Revision: 1 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2005, 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 __UTSTATE_C__
+
+#include "acpi.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utstate")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreatePkgStateAndPush
+ *
+ * PARAMETERS: Object - Object to be added to the new state
+ * Action - Increment/Decrement
+ * StateList - List the state will be added to
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreatePkgStateAndPush (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index,
+ ACPI_GENERIC_STATE **StateList)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
+ if (!State)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ AcpiUtPushGenericState (StateList, State);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPushGenericState
+ *
+ * PARAMETERS: ListHead - Head of the state stack
+ * State - State object to push
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Push a state object onto a state stack
+ *
+ ******************************************************************************/
+
+void
+AcpiUtPushGenericState (
+ ACPI_GENERIC_STATE **ListHead,
+ ACPI_GENERIC_STATE *State)
+{
+ ACPI_FUNCTION_TRACE ("UtPushGenericState");
+
+
+ /* Push the state object onto the front of the list (stack) */
+
+ State->Common.Next = *ListHead;
+ *ListHead = State;
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtPopGenericState
+ *
+ * PARAMETERS: ListHead - Head of the state stack
+ *
+ * RETURN: The popped state object
+ *
+ * DESCRIPTION: Pop a state object from a state stack
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtPopGenericState (
+ ACPI_GENERIC_STATE **ListHead)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtPopGenericState");
+
+
+ /* Remove the state object at the head of the list (stack) */
+
+ State = *ListHead;
+ if (State)
+ {
+ /* Update the list head */
+
+ *ListHead = State->Common.Next;
+ }
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateGenericState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: The new state object. NULL on failure.
+ *
+ * DESCRIPTION: Create a generic state object. Attempt to obtain one from
+ * the global state cache; If none available, create a new one.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateGenericState (
+ void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ State = AcpiOsAcquireObject (AcpiGbl_StateCache);
+ if (State)
+ {
+ /* Initialize */
+ State->Common.DataType = ACPI_DESC_TYPE_STATE;
+ }
+
+ return (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateThreadState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: New Thread State. NULL on failure
+ *
+ * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
+ * to track per-thread info during method execution
+ *
+ ******************************************************************************/
+
+ACPI_THREAD_STATE *
+AcpiUtCreateThreadState (
+ void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtCreateThreadState");
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
+ State->Thread.ThreadId = AcpiOsGetThreadId ();
+
+ return_PTR ((ACPI_THREAD_STATE *) State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateUpdateState
+ *
+ * PARAMETERS: Object - Initial Object to be installed in the state
+ * Action - Update action to be performed
+ *
+ * RETURN: New state object, null on failure
+ *
+ * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
+ * to update reference counts and delete complex objects such
+ * as packages.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateUpdateState (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
+ State->Update.Object = Object;
+ State->Update.Value = Action;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreatePkgState
+ *
+ * PARAMETERS: Object - Initial Object to be installed in the state
+ * Action - Update action to be performed
+ *
+ * RETURN: New state object, null on failure
+ *
+ * DESCRIPTION: Create a "Package State"
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreatePkgState (
+ void *InternalObject,
+ void *ExternalObject,
+ UINT16 Index)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the update struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE;
+ State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
+ State->Pkg.DestObject = ExternalObject;
+ State->Pkg.Index = Index;
+ State->Pkg.NumPackages = 1;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateControlState
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: New state object, null on failure
+ *
+ * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
+ * to support nested IF/WHILE constructs in the AML.
+ *
+ ******************************************************************************/
+
+ACPI_GENERIC_STATE *
+AcpiUtCreateControlState (
+ void)
+{
+ ACPI_GENERIC_STATE *State;
+
+
+ ACPI_FUNCTION_TRACE ("UtCreateControlState");
+
+
+ /* Create the generic state object */
+
+ State = AcpiUtCreateGenericState ();
+ if (!State)
+ {
+ return_PTR (NULL);
+ }
+
+ /* Init fields specific to the control struct */
+
+ State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
+ State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
+
+ return_PTR (State);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDeleteGenericState
+ *
+ * PARAMETERS: State - The state object to be deleted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Put a state object back into the global state cache. The object
+ * is not actually freed at this time.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDeleteGenericState (
+ ACPI_GENERIC_STATE *State)
+{
+ ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
+
+
+ (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
+ return_VOID;
+}
+
+
+
+
diff --git a/usr/src/uts/i86pc/io/acpica/utilities/utxface.c b/usr/src/uts/i86pc/io/acpica/utilities/utxface.c
index abbff581e4..f66b265581 100644
--- a/usr/src/uts/i86pc/io/acpica/utilities/utxface.c
+++ b/usr/src/uts/i86pc/io/acpica/utilities/utxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 110 $
+ * $Revision: 112 $
*
*****************************************************************************/
@@ -120,8 +120,6 @@
#include "acpi.h"
#include "acevents.h"
#include "acnamesp.h"
-#include "acparser.h"
-#include "acdispat.h"
#include "acdebug.h"
#define _COMPONENT ACPI_UTILITIES
@@ -153,11 +151,6 @@ AcpiInitializeSubsystem (
ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
-
- /* Initialize all globals used by the subsystem */
-
- AcpiUtInitGlobals ();
-
/* Initialize the OS-Dependent layer */
Status = AcpiOsInitialize ();
@@ -168,6 +161,10 @@ AcpiInitializeSubsystem (
return_ACPI_STATUS (Status);
}
+ /* Initialize all globals used by the subsystem */
+
+ AcpiUtInitGlobals ();
+
/* Create the default mutex objects */
Status = AcpiUtMutexInitialize ();
@@ -622,13 +619,9 @@ AcpiPurgeCachedObjects (
{
ACPI_FUNCTION_TRACE ("AcpiPurgeCachedObjects");
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
- AcpiUtDeleteGenericStateCache ();
- AcpiUtDeleteObjectCache ();
- AcpiDsDeleteWalkStateCache ();
- AcpiPsDeleteParseCache ();
-#endif
-
+ (void) AcpiOsPurgeCache (AcpiGbl_StateCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
return_ACPI_STATUS (AE_OK);
}
diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic.c b/usr/src/uts/i86pc/io/pcplusmp/apic.c
index bc93e8c98c..f669b61d86 100644
--- a/usr/src/uts/i86pc/io/pcplusmp/apic.c
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c
@@ -1699,6 +1699,7 @@ apic_picinit(void)
uint_t isr;
volatile int32_t *ioapic;
apic_irq_t *irqptr;
+ struct intrspec ispec;
/*
* On UniSys Model 6520, the BIOS leaves vector 0x20 isr
@@ -1759,22 +1760,23 @@ apic_picinit(void)
/*
* Hack alert: deal with ACPI SCI interrupt chicken/egg here
*/
- if (apic_sci_vect >= 0) {
+ if (apic_sci_vect > 0) {
/*
* acpica has already done add_avintr(); we just
* to finish the job by mimicing translate_irq()
+ *
+ * Fake up an intrspec and setup the tables
*/
- if (apic_setup_sci_irq_table(apic_sci_vect, SCI_IPL,
- &apic_sci_flags) < 0) {
+ ispec.intrspec_vec = apic_sci_vect;
+ ispec.intrspec_pri = SCI_IPL;
+
+ if (apic_setup_irq_table(NULL, apic_sci_vect, NULL,
+ &ispec, &apic_sci_flags, DDI_INTR_TYPE_FIXED) < 0) {
cmn_err(CE_WARN, "!apic: SCI setup failed");
return;
}
irqptr = apic_irq_table[apic_sci_vect];
- /* Assert we're the sole entry in the list */
- ASSERT(irqptr != NULL);
- ASSERT(irqptr->airq_next == NULL);
-
/* Program I/O APIC */
(void) apic_setup_io_intr(irqptr, apic_sci_vect);
}
@@ -3379,10 +3381,6 @@ apic_share_vector(int irqno, iflag_t *intr_flagp, short intr_index, int ipl,
continue;
irqptr = apic_irq_table[newirq];
- /* don't share SCI */
- if (irqptr->airq_mps_intr_index == SCI_INDEX)
- continue;
-
if ((dummyirq.airq_rdt_entry & 0xFF00) !=
(irqptr->airq_rdt_entry & 0xFF00))
/* not compatible */
@@ -3450,65 +3448,6 @@ apic_share_vector(int irqno, iflag_t *intr_flagp, short intr_index, int ipl,
*
*/
static int
-apic_setup_sci_irq_table(int irqno, uchar_t ipl, iflag_t *intr_flagp)
-{
- int intr_index;
- uchar_t ipin, ioapicindex, vector;
- apic_irq_t *irqptr;
-
- ASSERT(intr_flagp != NULL);
-
- intr_index = SCI_INDEX;
- ioapicindex = acpi_find_ioapic(irqno);
- ASSERT(ioapicindex != 0xFF);
- ipin = irqno - apic_io_vectbase[ioapicindex];
- if (apic_irq_table[irqno] &&
- apic_irq_table[irqno]->airq_mps_intr_index == SCI_INDEX) {
- ASSERT(apic_irq_table[irqno]->airq_intin_no == ipin &&
- apic_irq_table[irqno]->airq_ioapicindex ==
- ioapicindex);
- return (irqno);
- }
-
- if ((vector = apic_allocate_vector(ipl, irqno, 0)) == 0) {
- cmn_err(CE_WARN, "!apic: failed to allocate vector for SCI");
- return (-1);
- }
- mutex_enter(&airq_mutex);
- if (apic_irq_table[irqno] == NULL) {
- irqptr = kmem_zalloc(sizeof (apic_irq_t), KM_SLEEP);
- irqptr->airq_temp_cpu = IRQ_UNINIT;
- apic_irq_table[irqno] = irqptr;
- } else {
- /*
- * We assume that SCI is the first to attach this IRQ
- */
- cmn_err(CE_WARN, "!acpi: apic_irq_t not empty for SCI");
- return (-1);
- }
-
- apic_max_device_irq = max(irqno, apic_max_device_irq);
- apic_min_device_irq = min(irqno, apic_min_device_irq);
- mutex_exit(&airq_mutex);
- irqptr->airq_ioapicindex = ioapicindex;
- irqptr->airq_intin_no = ipin;
- irqptr->airq_ipl = ipl;
- irqptr->airq_vector = vector;
- irqptr->airq_origirq = (uchar_t)irqno;
- irqptr->airq_share_id = 0;
- irqptr->airq_mps_intr_index = (short)intr_index;
- irqptr->airq_dip = NULL;
- irqptr->airq_major = 0;
- irqptr->airq_cpu = 0; /* SCI always on CPU 0 */
- irqptr->airq_iflag = *intr_flagp;
- apic_record_rdt_entry(irqptr, irqno);
- return (irqno);
-}
-
-/*
- *
- */
-static int
apic_setup_irq_table(dev_info_t *dip, int irqno, struct apic_io_intr *intrp,
struct intrspec *ispec, iflag_t *intr_flagp, int type)
{
@@ -3594,6 +3533,7 @@ apic_setup_irq_table(dev_info_t *dip, int irqno, struct apic_io_intr *intrp,
irqptr->airq_dip = dip;
irqptr->airq_major = major;
sdip = apic_irq_table[IRQINDEX(newirq)]->airq_dip;
+ /* This is OK to do really */
if (sdip == NULL) {
cmn_err(CE_WARN, "Sharing vectors: %s"
" instance %d and SCI",
@@ -4185,7 +4125,7 @@ apic_record_rdt_entry(apic_irq_t *irqptr, int irq)
level = AV_LEVEL;
if (intr_index == FREE_INDEX && apic_defconf == 0)
apic_error |= APIC_ERR_INVALID_INDEX;
- } else if (intr_index == ACPI_INDEX || intr_index == SCI_INDEX) {
+ } else if (intr_index == ACPI_INDEX) {
bus_type = irqptr->airq_iflag.bustype;
if (irqptr->airq_iflag.intr_el == INTR_EL_CONFORM) {
if (bus_type == BUS_PCI)
diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic.h b/usr/src/uts/i86pc/io/pcplusmp/apic.h
index 13cc4ef629..260966ea79 100644
--- a/usr/src/uts/i86pc/io/pcplusmp/apic.h
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic.h
@@ -357,7 +357,6 @@ struct apic_io_intr {
#define ACPI_INDEX (short)-3 /* ACPI */
#define MSI_INDEX (short)-4 /* MSI */
#define MSIX_INDEX (short)-5 /* MSI-X */
-#define SCI_INDEX (short)-6 /* SCI */
#define DEFAULT_INDEX (short)0x7FFF
/* biggest positive no. to avoid conflict with actual index */
diff --git a/usr/src/uts/i86pc/io/psm/psm_common.c b/usr/src/uts/i86pc/io/psm/psm_common.c
index 4473d56a3b..4809daffed 100644
--- a/usr/src/uts/i86pc/io/psm/psm_common.c
+++ b/usr/src/uts/i86pc/io/psm/psm_common.c
@@ -57,9 +57,16 @@ char *psm_module_name; /* used to store name of psm module */
/*
* acpi_irq_check_elcr: when set elcr will also be consulted for building
- * the reserved irq list
+ * the reserved irq list. When 0 (false), the existing state of the ELCR
+ * is ignored when selecting a vector during IRQ translation, and the ELCR
+ * is programmed to the proper setting for the type of bus (level-triggered
+ * for PCI, edge-triggered for non-PCI). When non-zero (true), vectors
+ * set to edge-mode will not be used when in PIC-mode. The default value
+ * is 0 (false). Note that ACPI's SCI vector is always set to conform to
+ * ACPI-specification regardless of this.
+ *
*/
-int acpi_irq_check_elcr = 1;
+int acpi_irq_check_elcr = 0;
/*
* acpi_s5_slp_typ:
@@ -949,3 +956,38 @@ acpi_poweroff(void)
PSM_VERBOSE_POWEROFF(("acpi_poweroff: failed to actually power off\n"));
return (1);
}
+
+
+/*
+ * psm_set_elcr() sets ELCR bit for specified vector
+ */
+void
+psm_set_elcr(int vecno, int val)
+{
+ int elcr_port = ELCR_PORT1 + (vecno >> 3);
+ int elcr_bit = 1 << (vecno & 0x07);
+
+ ASSERT((vecno >= 0) && (vecno < 16));
+
+ if (val) {
+ /* set bit to force level-triggered mode */
+ outb(elcr_port, inb(elcr_port) | elcr_bit);
+ } else {
+ /* clear bit to force edge-triggered mode */
+ outb(elcr_port, inb(elcr_port) & ~elcr_bit);
+ }
+}
+
+/*
+ * psm_get_elcr() returns status of ELCR bit for specific vector
+ */
+int
+psm_get_elcr(int vecno)
+{
+ int elcr_port = ELCR_PORT1 + (vecno >> 3);
+ int elcr_bit = 1 << (vecno & 0x07);
+
+ ASSERT((vecno >= 0) && (vecno < 16));
+
+ return ((inb(elcr_port) & elcr_bit) ? 1 : 0);
+}
diff --git a/usr/src/uts/i86pc/io/psm/uppc.c b/usr/src/uts/i86pc/io/psm/uppc.c
index 6edf86b9b3..523abf8660 100644
--- a/usr/src/uts/i86pc/io/psm/uppc.c
+++ b/usr/src/uts/i86pc/io/psm/uppc.c
@@ -410,7 +410,6 @@ uppc_init_acpi(void)
{
int verboseflags = 0;
int sci;
- int elcr_port, elcr_bit;
iflag_t sci_flags;
/*
@@ -435,22 +434,10 @@ uppc_init_acpi(void)
* as recommended by Intel ACPI CA team.
*/
if (sci >= 0) {
- elcr_port = ELCR_PORT1 + (sci >> 3);
- elcr_bit = 1 << (sci & 0x07);
-
ASSERT((sci_flags.intr_el == INTR_EL_LEVEL) ||
(sci_flags.intr_el == INTR_EL_EDGE));
- switch (sci_flags.intr_el) {
- case INTR_EL_LEVEL:
- /* set bit to force level-triggered mode */
- outb(elcr_port, inb(elcr_port) | elcr_bit);
- break;
- case INTR_EL_EDGE:
- /* clear bit to force edge-triggered mode */
- outb(elcr_port, inb(elcr_port) & ~elcr_bit);
- break;
- }
+ psm_set_elcr(sci, sci_flags.intr_el == INTR_EL_LEVEL);
}
/*
@@ -542,6 +529,7 @@ uppc_acpi_translate_pci_irq(dev_info_t *dip, int busid, int devid,
if (status == ACPI_PSM_SUCCESS) {
acpi_new_irq_cache_ent(busid, devid, ipin, *pci_irqp,
intr_flagp, &acpipsmlnk);
+ psm_set_elcr(*pci_irqp, 1); /* set IRQ to PCI mode */
UPPC_VERBOSE_IRQ((CE_CONT, "!uppc: [ACPI] "
"new irq %d for device %s, instance #%d\n",
@@ -791,10 +779,13 @@ uppc_translate_irq(dev_info_t *dip, int irqno)
/* FALLTHRU to common case - returning irqno */
} else {
- /* non pci */
+ /* non-PCI; assumes ISA-style edge-triggered */
+ psm_set_elcr(irqno, 0); /* set IRQ to ISA mode */
+
UPPC_VERBOSE_IRQ((CE_CONT, "!uppc: non-pci,"
"irqno %d device %s instance %d\n", irqno,
ddi_get_name(dip), ddi_get_instance(dip)));
+
}
return (irqno);
diff --git a/usr/src/uts/i86pc/sys/psm_common.h b/usr/src/uts/i86pc/sys/psm_common.h
index 98ce87e02c..ee2b3e6697 100644
--- a/usr/src/uts/i86pc/sys/psm_common.h
+++ b/usr/src/uts/i86pc/sys/psm_common.h
@@ -137,6 +137,9 @@ extern int acpi_get_irq_cache_ent(uchar_t bus, uchar_t dev, int ipin,
extern int acpi_poweroff(void);
+extern void psm_set_elcr(int vecno, int val);
+extern int psm_get_elcr(int vecno);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/uts/intel/sys/acpi/acconfig.h b/usr/src/uts/intel/sys/acpi/acconfig.h
index a518388db4..a6885bc538 100644
--- a/usr/src/uts/intel/sys/acpi/acconfig.h
+++ b/usr/src/uts/intel/sys/acpi/acconfig.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 183 $
+ * $Revision: 189 $
*
*****************************************************************************/
@@ -137,7 +137,7 @@
/* Version string */
-#define ACPI_CA_VERSION 0x20050408
+#define ACPI_CA_VERSION 0x20050708
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -151,11 +151,10 @@
/* Maximum objects in the various object caches */
-#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */
+#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
-#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
/*
* Should the subystem abort the loading of an ACPI table if the
diff --git a/usr/src/uts/intel/sys/acpi/acdebug.h b/usr/src/uts/intel/sys/acpi/acdebug.h
index 2cf7770d36..dbe476e6c2 100644
--- a/usr/src/uts/intel/sys/acpi/acdebug.h
+++ b/usr/src/uts/intel/sys/acpi/acdebug.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 79 $
+ * $Revision: 80 $
*
*****************************************************************************/
@@ -189,6 +189,10 @@ AcpiDbSetMethodCallBreakpoint (
ACPI_PARSE_OBJECT *Op);
void
+AcpiDbGetBusInfo (
+ void);
+
+void
AcpiDbDisassembleAml (
char *Statements,
ACPI_PARSE_OBJECT *Op);
@@ -407,7 +411,7 @@ AcpiDbSetOutputDestination (
UINT32 Where);
void
-AcpiDbDumpObject (
+AcpiDbDumpExternalObject (
ACPI_OBJECT *ObjDesc,
UINT32 Level);
diff --git a/usr/src/uts/intel/sys/acpi/acdisasm.h b/usr/src/uts/intel/sys/acpi/acdisasm.h
index 908fe276d5..7b7c83b371 100644
--- a/usr/src/uts/intel/sys/acpi/acdisasm.h
+++ b/usr/src/uts/intel/sys/acpi/acdisasm.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
- * $Revision: 19 $
+ * $Revision: 21 $
*
*****************************************************************************/
@@ -164,6 +164,7 @@ typedef struct acpi_op_walk_info
{
UINT32 Level;
UINT32 BitOffset;
+ ACPI_WALK_STATE *WalkState;
} ACPI_OP_WALK_INFO;
@@ -285,7 +286,7 @@ AcpiDmByteList (
ACPI_PARSE_OBJECT *Op);
void
-AcpiIsEisaId (
+AcpiDmIsEisaId (
ACPI_PARSE_OBJECT *Op);
void
diff --git a/usr/src/uts/intel/sys/acpi/acdispat.h b/usr/src/uts/intel/sys/acpi/acdispat.h
index 01dca4e53d..75b4e0d921 100644
--- a/usr/src/uts/intel/sys/acpi/acdispat.h
+++ b/usr/src/uts/intel/sys/acpi/acdispat.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 64 $
+ * $Revision: 65 $
*
*****************************************************************************/
@@ -521,10 +521,4 @@ AcpiDsResultPopFromBottom (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-AcpiDsDeleteWalkStateCache (
- void);
-#endif
-
#endif /* _ACDISPAT_H_ */
diff --git a/usr/src/uts/intel/sys/acpi/acevents.h b/usr/src/uts/intel/sys/acpi/acevents.h
index 07fed64762..41acc09743 100644
--- a/usr/src/uts/intel/sys/acpi/acevents.h
+++ b/usr/src/uts/intel/sys/acpi/acevents.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 100 $
+ * $Revision: 103 $
*
*****************************************************************************/
@@ -118,7 +118,6 @@
#define __ACEVENTS_H__
-
/*
* evevent
*/
@@ -196,8 +195,7 @@ AcpiEvValidGpeEvent (
ACPI_STATUS
AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- UINT32 Flags);
+ ACPI_GPE_CALLBACK GpeWalkCallback);
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
@@ -210,7 +208,7 @@ AcpiEvCreateGpeBlock (
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
UINT8 GpeBlockBaseNumber,
- UINT32 InterruptLevel,
+ UINT32 InterruptNumber,
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock);
ACPI_STATUS
diff --git a/usr/src/uts/intel/sys/acpi/acexcep.h b/usr/src/uts/intel/sys/acpi/acexcep.h
index b81bde67d3..c56966096d 100644
--- a/usr/src/uts/intel/sys/acpi/acexcep.h
+++ b/usr/src/uts/intel/sys/acpi/acexcep.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 74 $
+ * $Revision: 75 $
*
*****************************************************************************/
@@ -168,8 +168,9 @@
#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL)
#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001E | AE_CODE_ENVIRONMENTAL)
+#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001F | AE_CODE_ENVIRONMENTAL)
-#define AE_CODE_ENV_MAX 0x001E
+#define AE_CODE_ENV_MAX 0x001F
/*
@@ -299,7 +300,8 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
- "AE_WAKE_ONLY_GPE"
+ "AE_WAKE_ONLY_GPE",
+ "AE_OWNER_ID_LIMIT"
};
char const *AcpiGbl_ExceptionNames_Pgm[] =
diff --git a/usr/src/uts/intel/sys/acpi/acglobal.h b/usr/src/uts/intel/sys/acpi/acglobal.h
index ab8a507a60..170cdeedc9 100644
--- a/usr/src/uts/intel/sys/acpi/acglobal.h
+++ b/usr/src/uts/intel/sys/acpi/acglobal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 164 $
+ * $Revision: 167 $
*
*****************************************************************************/
@@ -224,6 +224,13 @@ ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
*/
+/* The root table can be either an RSDT or an XSDT */
+
+ACPI_EXTERN UINT8 AcpiGbl_RootTableType;
+#define ACPI_TABLE_TYPE_RSDT 'R'
+#define ACPI_TABLE_TYPE_XSDT 'X'
+
+
/*
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
* If we are executing a method that exists in a 32-bit ACPI table,
@@ -253,8 +260,23 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
*
****************************************************************************/
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Lists for tracking memory allocations */
+
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
+#endif
+
+/* Object caches */
+
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache;
+
+/* Global handlers */
-ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler;
@@ -262,14 +284,15 @@ ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
+/* Misc */
+
ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount;
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
+ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask;
ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
-ACPI_EXTERN UINT16 AcpiGbl_NextTableOwnerId;
-ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId;
ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
diff --git a/usr/src/uts/intel/sys/acpi/achware.h b/usr/src/uts/intel/sys/acpi/achware.h
index 784a47ea8e..1b69a7bf45 100644
--- a/usr/src/uts/intel/sys/acpi/achware.h
+++ b/usr/src/uts/intel/sys/acpi/achware.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 77 $
+ * $Revision: 78 $
*
*****************************************************************************/
@@ -214,15 +214,15 @@ AcpiHwGetGpeStatus (
ACPI_STATUS
AcpiHwDisableAllGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableAllRuntimeGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableRuntimeGpeBlock (
diff --git a/usr/src/uts/intel/sys/acpi/aclocal.h b/usr/src/uts/intel/sys/acpi/aclocal.h
index 71f95c7134..7aa6dcf0db 100644
--- a/usr/src/uts/intel/sys/acpi/aclocal.h
+++ b/usr/src/uts/intel/sys/acpi/aclocal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 206 $
+ * $Revision: 211 $
*
*****************************************************************************/
@@ -129,6 +129,13 @@ typedef UINT32 ACPI_MUTEX_HANDLE;
#define AML_NUM_OPCODES 0x7F
+/* Forward declarations */
+
+struct acpi_walk_state;
+struct acpi_obj_mutex;
+union acpi_parse_object;
+
+
/*****************************************************************************
*
* Mutex typedefs and structs
@@ -189,20 +196,25 @@ static char *AcpiGbl_MutexNames[] =
#endif
+/* 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
+
/* Table for the global mutexes */
typedef struct acpi_mutex_info
{
ACPI_MUTEX Mutex;
UINT32 UseCount;
- UINT32 OwnerId;
+ UINT32 ThreadId;
} ACPI_MUTEX_INFO;
-/* This owner ID means that the mutex is not in use (unlocked) */
-
-#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) (-1)
-
/* Lock flag parameter for various interfaces */
@@ -210,13 +222,6 @@ typedef struct acpi_mutex_info
#define ACPI_MTX_LOCK 1
-typedef UINT16 ACPI_OWNER_ID;
-#define ACPI_OWNER_TYPE_TABLE 0x0
-#define ACPI_OWNER_TYPE_METHOD 0x1
-#define ACPI_FIRST_METHOD_ID 0x0001
-#define ACPI_FIRST_TABLE_ID 0xF000
-
-
/* Field access granularities */
#define ACPI_FIELD_BYTE_GRANULARITY 1
@@ -260,14 +265,21 @@ typedef struct acpi_namespace_node
{
UINT8 Descriptor; /* Used to differentiate object descriptor types */
UINT8 Type; /* Type associated with this name */
- UINT16 OwnerId;
+ UINT16 ReferenceCount; /* Current count of references and children */
ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
struct acpi_namespace_node *Child; /* First child */
struct acpi_namespace_node *Peer; /* Next peer*/
- UINT16 ReferenceCount; /* Current count of references and children */
+ UINT8 OwnerId; /* Who created this node */
UINT8 Flags;
+ /* Fields used by the ASL compiler only */
+
+#ifdef ACPI_ASL_COMPILER
+ UINT32 Value;
+ union acpi_parse_object *Op;
+#endif
+
} ACPI_NAMESPACE_NODE;
@@ -298,7 +310,7 @@ typedef struct acpi_table_desc
UINT64 PhysicalAddress;
UINT32 AmlLength;
ACPI_SIZE Length;
- ACPI_OWNER_ID TableId;
+ ACPI_OWNER_ID OwnerId;
UINT8 Type;
UINT8 Allocation;
BOOLEAN LoadedIntoNamespace;
@@ -453,7 +465,7 @@ typedef struct acpi_gpe_xrupt_info
struct acpi_gpe_xrupt_info *Previous;
struct acpi_gpe_xrupt_info *Next;
ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
- UINT32 InterruptLevel; /* System interrupt level */
+ UINT32 InterruptNumber; /* System interrupt number */
} ACPI_GPE_XRUPT_INFO;
@@ -513,13 +525,6 @@ typedef struct acpi_field_info
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
-/* Forward declarations */
-
-struct acpi_walk_state;
-struct acpi_obj_mutex;
-union acpi_parse_object;
-
-
#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
UINT8 DataType; /* To differentiate various internal objs */\
UINT8 Flags; \
@@ -845,6 +850,7 @@ typedef struct acpi_parse_state
****************************************************************************/
#define PCI_ROOT_HID_STRING "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
typedef struct acpi_bit_register_info
{
@@ -1026,15 +1032,6 @@ typedef struct acpi_integrity_info
*
****************************************************************************/
-typedef struct acpi_debug_print_info
-{
- UINT32 ComponentId;
- char *ProcName;
- char *ModuleName;
-
-} ACPI_DEBUG_PRINT_INFO;
-
-
/* Entry for a memory allocation (debug only) */
#define ACPI_MEM_MALLOC 0
@@ -1066,24 +1063,18 @@ typedef struct acpi_debug_mem_block
#define ACPI_MEM_LIST_GLOBAL 0
#define ACPI_MEM_LIST_NSNODE 1
-
-#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2
-#define ACPI_MEM_LIST_STATE 2
-#define ACPI_MEM_LIST_PSNODE 3
-#define ACPI_MEM_LIST_PSNODE_EXT 4
-#define ACPI_MEM_LIST_OPERAND 5
-#define ACPI_MEM_LIST_WALK 6
-#define ACPI_MEM_LIST_MAX 6
-#define ACPI_NUM_MEM_LISTS 7
+#define ACPI_MEM_LIST_MAX 1
+#define ACPI_NUM_MEM_LISTS 2
typedef struct acpi_memory_list
{
+ char *ListName;
void *ListHead;
- UINT16 LinkOffset;
- UINT16 MaxCacheDepth;
- UINT16 CacheDepth;
UINT16 ObjectSize;
+ UINT16 MaxDepth;
+ UINT16 CurrentDepth;
+ UINT16 LinkOffset;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
@@ -1092,9 +1083,8 @@ typedef struct acpi_memory_list
UINT32 TotalAllocated;
UINT32 TotalFreed;
UINT32 CurrentTotalSize;
- UINT32 CacheRequests;
- UINT32 CacheHits;
- char *ListName;
+ UINT32 Requests;
+ UINT32 Hits;
#endif
} ACPI_MEMORY_LIST;
diff --git a/usr/src/uts/intel/sys/acpi/acmacros.h b/usr/src/uts/intel/sys/acpi/acmacros.h
index b4a32406b5..b088f7ce0b 100644
--- a/usr/src/uts/intel/sys/acpi/acmacros.h
+++ b/usr/src/uts/intel/sys/acpi/acmacros.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 158 $
+ * $Revision: 160 $
*
*****************************************************************************/
@@ -510,21 +510,22 @@
#define ACPI_PARAM_LIST(pl) pl
/*
- * Error reporting. These versions add callers module and line#. Since
- * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
- * use it in debug mode.
+ * Error reporting. These versions add callers module and line#.
+ *
+ * Since _AcpiModuleName gets compiled out when ACPI_DEBUG_OUTPUT
+ * isn't defined, only use it in debug mode.
*/
#ifdef ACPI_DEBUG_OUTPUT
-#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_AcpiModuleName,__LINE__,_COMPONENT); \
AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_AcpiModuleName,__LINE__,_COMPONENT); \
AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_AcpiModuleName,__LINE__,_COMPONENT); \
AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_AcpiModuleName,__LINE__,_COMPONENT, s, e);
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_AcpiModuleName,__LINE__,_COMPONENT, s, n, p, e);
#else
@@ -553,36 +554,56 @@
* Debug macros that are conditionally compiled
*/
#ifdef ACPI_DEBUG_OUTPUT
+#define ACPI_MODULE_NAME(Name) static char ACPI_UNUSED_VAR *_AcpiModuleName = Name;
-#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = 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
/*
- * Function entry tracing.
- * The first parameter should be the procedure name as a quoted string. This is declared
- * as a local string ("_ProcName) so that it can be also used by the function exit macros below.
+ * Function entry tracing
*/
-#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _DebugInfo; \
- _DebugInfo.ComponentId = _COMPONENT; \
- _DebugInfo.ProcName = a; \
- _DebugInfo.ModuleName = _THIS_MODULE;
-
-#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
- AcpiUtTrace(__LINE__,&_DebugInfo)
-#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTracePtr(__LINE__,&_DebugInfo,(void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTraceU32(__LINE__,&_DebugInfo,(UINT32)b)
-#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTraceStr(__LINE__,&_DebugInfo,(char *)b)
-
-#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
+
+/*
+ * 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. We save the function name on the
+ * local stack.
+ */
+#ifndef ACPI_GET_FUNCTION_NAME
+#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName
+/*
+ * The Name parameter should be the procedure name as a quoted string.
+ * This is declared as a local string ("MyFunctionName") so that it can
+ * be also used by the function exit macros below.
+ */
+#define ACPI_FUNCTION_NAME(Name) 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) \
+ AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS,(UINT32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
/*
* Function exit tracing.
* WARNING: These macros include a return statement. This is usually considered
* bad form, but having a separate exit macro is very ugly and difficult to maintain.
* One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_ProcName" is defined.
+ * so that "_AcpiFunctionName" is defined.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)
@@ -590,10 +611,10 @@
#define ACPI_DO_WHILE0(a) a
#endif
-#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_DebugInfo);return;})
-#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_DebugInfo,(s));return((s));})
-#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_DebugInfo,(ACPI_INTEGER)(s));return((s));})
-#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_DebugInfo,(UINT8 *)(s));return((s));})
+#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(ACPI_DEBUG_PARAMETERS);return;})
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(ACPI_DEBUG_PARAMETERS,(s));return((s));})
+#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(ACPI_DEBUG_PARAMETERS,(ACPI_INTEGER)(s));return((s));})
+#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(ACPI_DEBUG_PARAMETERS,(UINT8 *)(s));return((s));})
/* Conditional execution */
@@ -608,7 +629,7 @@
/* Stack and buffer dumping */
#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a),0)
-#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_AcpiModuleName,__LINE__)
#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)
@@ -644,8 +665,8 @@
* This is the non-debug case -- make everything go away,
* leaving no executable debug code!
*/
-#define ACPI_MODULE_NAME(name)
-#define _THIS_MODULE ""
+#define ACPI_MODULE_NAME(Name)
+#define _AcpiModuleName ""
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
@@ -722,19 +743,18 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
#define ACPI_MEM_FREE(a) AcpiOsFree(a)
#define ACPI_MEM_TRACKING(a)
-
#else
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_AcpiModuleName,__LINE__)
#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/usr/src/uts/intel/sys/acpi/acnamesp.h b/usr/src/uts/intel/sys/acpi/acnamesp.h
index ff03ced74d..e05e4d8b2d 100644
--- a/usr/src/uts/intel/sys/acpi/acnamesp.h
+++ b/usr/src/uts/intel/sys/acpi/acnamesp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 140 $
+ * $Revision: 141 $
*
*****************************************************************************/
@@ -236,7 +236,7 @@ AcpiNsDeleteNamespaceSubtree (
void
AcpiNsDeleteNamespaceByOwner (
- UINT16 TableId);
+ ACPI_OWNER_ID OwnerId);
void
AcpiNsDetachObject (
@@ -289,7 +289,7 @@ AcpiNsDumpObjects (
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
- UINT32 OwnderId,
+ ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle);
diff --git a/usr/src/uts/intel/sys/acpi/acobject.h b/usr/src/uts/intel/sys/acpi/acobject.h
index 9210d69e77..a2cae21c9c 100644
--- a/usr/src/uts/intel/sys/acpi/acobject.h
+++ b/usr/src/uts/intel/sys/acpi/acobject.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
- * $Revision: 129 $
+ * $Revision: 130 $
*
*****************************************************************************/
@@ -278,7 +278,7 @@ typedef struct acpi_object_method
ACPI_INTERNAL_METHOD Implementation;
UINT8 Concurrency;
UINT8 ThreadCount;
- ACPI_OWNER_ID OwningId;
+ ACPI_OWNER_ID OwnerId;
} ACPI_OBJECT_METHOD;
diff --git a/usr/src/uts/intel/sys/acpi/acopcode.h b/usr/src/uts/intel/sys/acpi/acopcode.h
index 9ff5c30af9..8cba6107ee 100644
--- a/usr/src/uts/intel/sys/acpi/acopcode.h
+++ b/usr/src/uts/intel/sys/acpi/acopcode.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acopcode.h - AML opcode information for the AML parser and interpreter
- * $Revision: 2 $
+ * $Revision: 3 $
*
*****************************************************************************/
@@ -319,7 +319,7 @@
#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
+#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_IF_OP ARGI_INVALID_OPCODE
#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
diff --git a/usr/src/uts/intel/sys/acpi/acoutput.h b/usr/src/uts/intel/sys/acpi/acoutput.h
index ba35c13c22..18902fff8a 100644
--- a/usr/src/uts/intel/sys/acpi/acoutput.h
+++ b/usr/src/uts/intel/sys/acpi/acoutput.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
- * $Revision: 96 $
+ * $Revision: 97 $
*
*****************************************************************************/
@@ -209,7 +209,7 @@
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
-#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,__LINE__,&_DebugInfo
+#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS
/* Exception level -- used in the global "DebugLevel" */
diff --git a/usr/src/uts/intel/sys/acpi/acparser.h b/usr/src/uts/intel/sys/acpi/acparser.h
index 60ad25386b..c298684d86 100644
--- a/usr/src/uts/intel/sys/acpi/acparser.h
+++ b/usr/src/uts/intel/sys/acpi/acparser.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 73 $
+ * $Revision: 76 $
*
*****************************************************************************/
@@ -136,6 +136,7 @@
#define ACPI_PARSE_MODE_MASK 0x0030
#define ACPI_PARSE_DEFERRED_OP 0x0100
+#define ACPI_PARSE_DISASSEMBLE 0x0200
/******************************************************************************
@@ -231,6 +232,25 @@ UINT16
AcpiPsPeekOpcode (
ACPI_PARSE_STATE *state);
+ACPI_STATUS
+AcpiPsCompleteThisOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiPsNextParseState (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS CallbackStatus);
+
+
+/*
+ * psloop - main parse loop
+ */
+ACPI_STATUS
+AcpiPsParseLoop (
+ ACPI_WALK_STATE *WalkState);
+
/*
* psscope - Scope stack management routines
@@ -360,12 +380,6 @@ AcpiPsSetName(
ACPI_PARSE_OBJECT *op,
UINT32 name);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-AcpiPsDeleteParseCache (
- void);
-#endif
-
/*
* psdump - display parser tree
diff --git a/usr/src/uts/intel/sys/acpi/acpiosxf.h b/usr/src/uts/intel/sys/acpi/acpiosxf.h
index ddb8dd9278..08fcf65a64 100644
--- a/usr/src/uts/intel/sys/acpi/acpiosxf.h
+++ b/usr/src/uts/intel/sys/acpi/acpiosxf.h
@@ -213,10 +213,9 @@ void
AcpiOsDeleteLock (
ACPI_HANDLE Handle);
-void
+UINT32
AcpiOsAcquireLock (
- ACPI_HANDLE Handle,
- UINT32 Flags);
+ ACPI_HANDLE Handle);
void
AcpiOsReleaseLock (
@@ -253,6 +252,34 @@ AcpiOsGetPhysicalAddress (
/*
+ * Memory/Object Cache
+ */
+ACPI_STATUS
+AcpiOsCreateCache (
+ char *CacheName,
+ UINT16 ObjectSize,
+ UINT16 MaxDepth,
+ ACPI_CACHE_T **ReturnCache);
+
+ACPI_STATUS
+AcpiOsDeleteCache (
+ ACPI_CACHE_T *Cache);
+
+ACPI_STATUS
+AcpiOsPurgeCache (
+ ACPI_CACHE_T *Cache);
+
+void *
+AcpiOsAcquireObject (
+ ACPI_CACHE_T *Cache);
+
+ACPI_STATUS
+AcpiOsReleaseObject (
+ ACPI_CACHE_T *Cache,
+ void *Object);
+
+
+/*
* Interrupt handlers
*/
ACPI_STATUS
diff --git a/usr/src/uts/intel/sys/acpi/acpixf.h b/usr/src/uts/intel/sys/acpi/acpixf.h
index 29519bd0ae..5a2ac03286 100644
--- a/usr/src/uts/intel/sys/acpi/acpixf.h
+++ b/usr/src/uts/intel/sys/acpi/acpixf.h
@@ -443,7 +443,7 @@ AcpiInstallGpeBlock (
ACPI_HANDLE GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
- UINT32 InterruptLevel);
+ UINT32 InterruptNumber);
ACPI_STATUS
AcpiRemoveGpeBlock (
diff --git a/usr/src/uts/intel/sys/acpi/acstruct.h b/usr/src/uts/intel/sys/acpi/acstruct.h
index 60030dcd5e..1d41064d2b 100644
--- a/usr/src/uts/intel/sys/acpi/acstruct.h
+++ b/usr/src/uts/intel/sys/acpi/acstruct.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 31 $
+ * $Revision: 35 $
*
*****************************************************************************/
@@ -144,14 +144,13 @@ typedef struct acpi_walk_state
UINT8 WalkType;
ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
BOOLEAN LastPredicate; /* Result of last predicate */
- UINT8 Reserved; /* For alignment */
UINT8 CurrentResult; /* */
UINT8 NextOpInfo; /* Info about NextOp */
UINT8 NumOperands; /* Stack pointer for Operands[] array */
UINT8 ReturnUsed;
UINT16 Opcode; /* Current AML opcode */
UINT8 ScopeDepth;
- UINT8 Reserved1;
+ UINT8 PassNumber; /* Parse pass during table load */
UINT32 ArgCount; /* push for fixed or var args */
UINT32 AmlOffset;
UINT32 ArgTypes;
@@ -230,15 +229,18 @@ typedef struct acpi_device_walk_info
typedef struct acpi_walk_info
{
UINT32 DebugLevel;
- UINT32 OwnerId;
+ ACPI_OWNER_ID OwnerId;
UINT8 DisplayType;
} ACPI_WALK_INFO;
/* Display Types */
-#define ACPI_DISPLAY_SUMMARY 0
-#define ACPI_DISPLAY_OBJECTS 1
+#define ACPI_DISPLAY_SUMMARY (UINT8) 0
+#define ACPI_DISPLAY_OBJECTS (UINT8) 1
+#define ACPI_DISPLAY_MASK (UINT8) 1
+
+#define ACPI_DISPLAY_SHORT (UINT8) 2
typedef struct acpi_get_devices_info
{
diff --git a/usr/src/uts/intel/sys/acpi/actables.h b/usr/src/uts/intel/sys/acpi/actables.h
index 649c917b36..921a17ec6c 100644
--- a/usr/src/uts/intel/sys/acpi/actables.h
+++ b/usr/src/uts/intel/sys/acpi/actables.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 50 $
+ * $Revision: 51 $
*
*****************************************************************************/
@@ -242,6 +242,10 @@ ACPI_STATUS
AcpiTbGetTableRsdt (
void);
+ACPI_STATUS
+AcpiTbValidateRsdp (
+ RSDP_DESCRIPTOR *Rsdp);
+
/*
* tbutils - common table utilities
diff --git a/usr/src/uts/intel/sys/acpi/actbl.h b/usr/src/uts/intel/sys/acpi/actbl.h
index ece26071bc..18d7cd2aea 100644
--- a/usr/src/uts/intel/sys/acpi/actbl.h
+++ b/usr/src/uts/intel/sys/acpi/actbl.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 69 $
+ * $Revision: 72 $
*
*****************************************************************************/
@@ -159,15 +159,15 @@
*/
typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
{
- char Signature [8]; /* ACPI signature, contains "RSD PTR " */
- UINT8 Checksum; /* To make sum of struct == 0 */
- char OemId [6]; /* OEM identification */
- UINT8 Revision; /* Must be 0 for 1.0, 2 for 2.0 */
- UINT32 RsdtPhysicalAddress; /* 32-bit physical address of RSDT */
- UINT32 Length; /* XSDT Length in bytes including hdr */
- UINT64 XsdtPhysicalAddress; /* 64-bit physical address of XSDT */
- UINT8 ExtendedChecksum; /* Checksum of entire table */
- char Reserved [3]; /* Reserved field must be 0 */
+ char Signature[8]; /* ACPI signature, contains "RSD PTR " */
+ UINT8 Checksum; /* ACPI 1.0 checksum */
+ char OemId[6]; /* OEM identification */
+ UINT8 Revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+ UINT32 RsdtPhysicalAddress; /* 32-bit physical address of the RSDT */
+ UINT32 Length; /* XSDT Length in bytes, including header */
+ UINT64 XsdtPhysicalAddress; /* 64-bit physical address of the XSDT */
+ UINT8 ExtendedChecksum; /* Checksum of entire table (ACPI 2.0) */
+ char Reserved[3]; /* Reserved, must be zero */
} RSDP_DESCRIPTOR;
@@ -182,15 +182,15 @@ typedef struct acpi_common_facs /* Common FACS for internal use */
#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
- char Signature [4]; /* ACPI signature (4 ASCII characters) */\
- UINT32 Length; /* Length of table, in bytes, including header */\
+ char Signature[4]; /* ASCII table signature */\
+ UINT32 Length; /* Length of table in bytes, including this header */\
UINT8 Revision; /* ACPI Specification minor version # */\
UINT8 Checksum; /* To make sum of entire table == 0 */\
- char OemId [6]; /* OEM identification */\
- char OemTableId [8]; /* OEM table identification */\
+ char OemId[6]; /* ASCII OEM identification */\
+ char OemTableId[8]; /* ASCII OEM table identification */\
UINT32 OemRevision; /* OEM revision number */\
- char AslCompilerId [4]; /* ASL compiler vendor ID */\
- UINT32 AslCompilerRevision; /* ASL compiler revision number */
+ char AslCompilerId [4]; /* ASCII ASL compiler vendor ID */\
+ UINT32 AslCompilerRevision; /* ASL compiler version */
typedef struct acpi_table_header /* ACPI common table header */
@@ -215,8 +215,12 @@ typedef struct multiple_apic_table
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
UINT32 LocalApicAddress; /* Physical address of local APIC */
- UINT32_BIT PCATCompat : 1; /* A one indicates system also has dual 8259s */
- UINT32_BIT Reserved1 : 31;
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT PCATCompat : 1; /* 00: System also has dual 8259s */
+ UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
+ UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
} MULTIPLE_APIC_TABLE;
@@ -258,16 +262,18 @@ typedef struct apic_header
#define TRIGGER_RESERVED 2
#define TRIGGER_LEVEL 3
-/* Common flag definitions */
+/* Common flag definitions (16 bits each) */
#define MPS_INTI_FLAGS \
- UINT16_BIT Polarity : 2; /* Polarity of APIC I/O input signals */\
- UINT16_BIT TriggerMode : 2; /* Trigger mode of APIC input signals */\
- UINT16_BIT Reserved1 : 12; /* Reserved, must be zero */
+ UINT8_BIT Polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
+ UINT8_BIT TriggerMode : 2; /* 02-03: Trigger mode of APIC input signals */\
+ UINT8_BIT : 4; /* 04-07: Reserved, must be zero */\
+ UINT8 Reserved1; /* 08-15: Reserved, must be zero */
#define LOCAL_APIC_FLAGS \
- UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */\
- UINT32_BIT Reserved2 : 31; /* Reserved, must be zero */
+ UINT8_BIT ProcessorEnabled: 1; /* 00: Processor is usable if set */\
+ UINT8_BIT : 7; /* 01-07: Reserved, must be zero */\
+ UINT8 Reserved2; /* 08-15: Reserved, must be zero */
/* Sub-structures for MADT */
@@ -320,7 +326,7 @@ typedef struct madt_local_apic_nmi
typedef struct madt_address_override
{
APIC_HEADER_DEF
- UINT16 Reserved; /* Reserved - must be zero */
+ UINT16 Reserved; /* Reserved, must be zero */
UINT64 Address; /* APIC physical address */
} MADT_ADDRESS_OVERRIDE;
@@ -329,7 +335,7 @@ typedef struct madt_io_sapic
{
APIC_HEADER_DEF
UINT8 IoSapicId; /* I/O SAPIC ID */
- UINT8 Reserved; /* Reserved - must be zero */
+ UINT8 Reserved; /* Reserved, must be zero */
UINT32 InterruptBase; /* Glocal interrupt for SAPIC start */
UINT64 Address; /* SAPIC physical address */
@@ -341,7 +347,7 @@ typedef struct madt_local_sapic
UINT8 ProcessorId; /* ACPI processor id */
UINT8 LocalSapicId; /* SAPIC ID */
UINT8 LocalSapicEid; /* SAPIC EID */
- UINT8 Reserved [3]; /* Reserved - must be zero */
+ UINT8 Reserved[3]; /* Reserved, must be zero */
LOCAL_APIC_FLAGS
UINT32 ProcessorUID; /* Numeric UID - ACPI 3.0 */
char ProcessorUIDString[1]; /* String UID - ACPI 3.0 */
diff --git a/usr/src/uts/intel/sys/acpi/actbl1.h b/usr/src/uts/intel/sys/acpi/actbl1.h
index 326d18944a..c18dfe4d31 100644
--- a/usr/src/uts/intel/sys/acpi/actbl1.h
+++ b/usr/src/uts/intel/sys/acpi/actbl1.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl1.h - ACPI 1.0 tables
- * $Revision: 29 $
+ * $Revision: 32 $
*
*****************************************************************************/
@@ -125,8 +125,8 @@
typedef struct rsdt_descriptor_rev1
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry [1]; /* Array of pointers to other */
- /* ACPI tables */
+ UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+
} RSDT_DESCRIPTOR_REV1;
@@ -135,14 +135,19 @@ typedef struct rsdt_descriptor_rev1
*/
typedef struct facs_descriptor_rev1
{
- char Signature[4]; /* ACPI Signature */
- UINT32 Length; /* Length of structure, in bytes */
+ char Signature[4]; /* ASCII table signature */
+ UINT32 Length; /* Length of structure in bytes */
UINT32 HardwareSignature; /* Hardware configuration signature */
UINT32 FirmwareWakingVector; /* ACPI OS waking vector */
UINT32 GlobalLock; /* Global Lock */
- UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* Must be 0 */
- UINT8 Resverved3 [40]; /* Reserved - must be zero */
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT S4Bios_f : 1; /* 00: S4BIOS support is present */
+ UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
+ UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
+
+ UINT8 Reserved2[40]; /* Reserved, must be zero */
} FACS_DESCRIPTOR_REV1;
@@ -156,13 +161,13 @@ typedef struct fadt_descriptor_rev1
UINT32 FirmwareCtrl; /* Physical address of FACS */
UINT32 Dsdt; /* Physical address of DSDT */
UINT8 Model; /* System Interrupt Model */
- UINT8 Reserved1; /* Reserved */
+ UINT8 Reserved1; /* Reserved, must be zero */
UINT16 SciInt; /* System vector of SCI interrupt */
UINT32 SmiCmd; /* Port address of SMI command port */
UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
- UINT8 Reserved2; /* Reserved - must be zero */
+ UINT8 Reserved2; /* Reserved, must be zero */
UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
@@ -178,7 +183,7 @@ typedef struct fadt_descriptor_rev1
UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
- UINT8 Reserved3; /* Reserved */
+ UINT8 Reserved3; /* Reserved, must be zero */
UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
UINT16 FlushSize; /* Size of area read to flush caches */
@@ -188,19 +193,21 @@ typedef struct fadt_descriptor_rev1
UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
UINT8 Century; /* Index to century in RTC CMOS RAM */
- UINT8 Reserved4; /* Reserved */
- UINT8 Reserved4a; /* Reserved */
- UINT8 Reserved4b; /* Reserved */
- UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
- UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
- UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
- UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
- UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
- UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
- UINT32_BIT Reserved5 : 23; /* Reserved - must be zero */
+ UINT8 Reserved4[3]; /* Reserved, must be zero */
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT WbInvd : 1; /* 00: The wbinvd instruction works properly */
+ UINT8_BIT WbInvdFlush : 1; /* 01: The wbinvd flushes but does not invalidate */
+ UINT8_BIT ProcC1 : 1; /* 02: All processors support C1 state */
+ UINT8_BIT Plvl2Up : 1; /* 03: C2 state works on MP system */
+ UINT8_BIT PwrButton : 1; /* 04: Power button is handled as a generic feature */
+ UINT8_BIT SleepButton : 1; /* 05: Sleep button is handled as a generic feature, or not present */
+ UINT8_BIT FixedRTC : 1; /* 06: RTC wakeup stat not in fixed register space */
+ UINT8_BIT Rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
+ UINT8_BIT TmrValExt : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */
+ UINT8_BIT : 7; /* 09-15: Reserved, must be zero */
+ UINT8 Reserved5[2]; /* 16-31: Reserved, must be zero */
} FADT_DESCRIPTOR_REV1;
diff --git a/usr/src/uts/intel/sys/acpi/actbl2.h b/usr/src/uts/intel/sys/acpi/actbl2.h
index 8c3cc797e8..7bcc8b7162 100644
--- a/usr/src/uts/intel/sys/acpi/actbl2.h
+++ b/usr/src/uts/intel/sys/acpi/actbl2.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- * $Revision: 41 $
+ * $Revision: 44 $
*
*****************************************************************************/
@@ -146,8 +146,8 @@
typedef struct rsdt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry [1]; /* Array of pointers to */
- /* ACPI table headers */
+ UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+
} RSDT_DESCRIPTOR_REV2;
@@ -157,8 +157,8 @@ typedef struct rsdt_descriptor_rev2
typedef struct xsdt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT64 TableOffsetEntry [1]; /* Array of pointers to */
- /* ACPI table headers */
+ UINT64 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+
} XSDT_DESCRIPTOR_REV2;
@@ -167,16 +167,21 @@ typedef struct xsdt_descriptor_rev2
*/
typedef struct facs_descriptor_rev2
{
- char Signature[4]; /* ACPI signature */
+ char Signature[4]; /* ASCII table signature */
UINT32 Length; /* Length of structure, in bytes */
UINT32 HardwareSignature; /* Hardware configuration signature */
- UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */
+ UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector. */
UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */
- UINT32_BIT S4Bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* Must be 0 */
- UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT S4Bios_f : 1; /* 00: S4BIOS support is present */
+ UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
+ UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
+
+ UINT64 XFirmwareWakingVector; /* 64-bit physical address of the Firmware Waking Vector. */
UINT8 Version; /* Version of this table */
- UINT8 Reserved3 [31]; /* Reserved - must be zero */
+ UINT8 Reserved3[31]; /* Reserved, must be zero */
} FACS_DESCRIPTOR_REV2;
@@ -240,35 +245,37 @@ typedef struct fadt_descriptor_rev2
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved */
- UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
- UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
- UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
- UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
- UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
- UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits */
- UINT32_BIT DockCap : 1; /* Supports Docking */
- UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG */
- UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed */
- UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices */
- UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */
- /* must be executed after writing the SLP_TYPx register */
- /* ACPI 3.0 flag bits */
-
- UINT32_BIT PciExpWak : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */
- UINT32_BIT UsePlatformClock : 1; /* OSPM should use platform-provided timer */
- UINT32_BIT S4RtcStsValid : 1; /* Contents of RTC_STS valid after S4 wake */
- UINT32_BIT RemotePowerOnCapable : 1; /* System is compatible with remote power on */
- UINT32_BIT ForceApicClusterModel : 1; /* All local APICs must use cluster model */
- UINT32_BIT ForceApicPhysicalDestinationMode : 1; /* All local xAPICs must use physical dest mode */
- UINT32_BIT Reserved6 : 12;/* Reserved - must be zero */
+ UINT8 Reserved2; /* Reserved, must be zero */
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT WbInvd : 1; /* 00: The wbinvd instruction works properly */
+ UINT8_BIT WbInvdFlush : 1; /* 01: The wbinvd flushes but does not invalidate */
+ UINT8_BIT ProcC1 : 1; /* 02: All processors support C1 state */
+ UINT8_BIT Plvl2Up : 1; /* 03: C2 state works on MP system */
+ UINT8_BIT PwrButton : 1; /* 04: Power button is handled as a generic feature */
+ UINT8_BIT SleepButton : 1; /* 05: Sleep button is handled as a generic feature, or not present */
+ UINT8_BIT FixedRTC : 1; /* 06: RTC wakeup stat not in fixed register space */
+ UINT8_BIT Rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
+ UINT8_BIT TmrValExt : 1; /* 08: tmr_val is 32 bits 0=24-bits */
+ UINT8_BIT DockCap : 1; /* 09: Docking supported */
+ UINT8_BIT ResetRegSup : 1; /* 10: System reset via the FADT RESET_REG supported */
+ UINT8_BIT SealedCase : 1; /* 11: No internal expansion capabilities and case is sealed */
+ UINT8_BIT Headless : 1; /* 12: No local video capabilities or local input devices */
+ UINT8_BIT CpuSwSleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */
+
+ UINT8_BIT PciExpWak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+ UINT8_BIT UsePlatformClock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
+ UINT8_BIT S4RtcStsValid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+ UINT8_BIT RemotePowerOnCapable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */
+ UINT8_BIT ForceApicClusterModel : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
+ UINT8_BIT ForceApicPhysicalDestinationMode : 1; /* 19: All local xAPICs must use physical dest mode (ACPI 3.0) */
+ UINT8_BIT : 4; /* 20-23: Reserved, must be zero */
+ UINT8 Reserved3; /* 24-31: Reserved, must be zero */
ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */
- UINT8 Reserved7[3]; /* These three bytes must be zero */
+ UINT8 Reserved4[3]; /* These three bytes must be zero */
UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */
UINT64 XDsdt; /* 64-bit physical address of DSDT */
ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */
@@ -289,11 +296,11 @@ typedef struct fadt_descriptor_rev2_minus
{
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved */
+ UINT8 Reserved2; /* Reserved, must be zero */
UINT32 Flags;
ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
- UINT8 Reserved7[3]; /* These three bytes must be zero */
+ UINT8 Reserved7[3]; /* Reserved, must be zero */
} FADT_DESCRIPTOR_REV2_MINUS;
@@ -320,11 +327,16 @@ typedef struct static_resource_alloc
UINT8 Length;
UINT8 ProximityDomainLo;
UINT8 ApicId;
- UINT32_BIT Enabled :1;
- UINT32_BIT Reserved3 :31;
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT Enabled :1; /* 00: Use affinity structure */
+ UINT8_BIT :7; /* 01-07: Reserved, must be zero */
+ UINT8 Reserved3[3]; /* 08-31: Reserved, must be zero */
+
UINT8 LocalSapicEid;
UINT8 ProximityDomainHi[3];
- UINT32 Reserved4;
+ UINT32 Reserved4; /* Reserved, must be zero */
} STATIC_RESOURCE_ALLOC;
@@ -337,11 +349,16 @@ typedef struct memory_affinity
UINT64 BaseAddress;
UINT64 AddressLength;
UINT32 Reserved4;
- UINT32_BIT Enabled :1;
- UINT32_BIT HotPluggable :1;
- UINT32_BIT NonVolatile :1;
- UINT32_BIT Reserved5 :29;
- UINT64 Reserved6;
+
+ /* Flags (32 bits) */
+
+ UINT8_BIT Enabled :1; /* 00: Use affinity structure */
+ UINT8_BIT HotPluggable :1; /* 01: Memory region is hot pluggable */
+ UINT8_BIT NonVolatile :1; /* 02: Memory is non-volatile */
+ UINT8_BIT :5; /* 03-07: Reserved, must be zero */
+ UINT8 Reserved5[3]; /* 08-31: Reserved, must be zero */
+
+ UINT64 Reserved6; /* Reserved, must be zero */
} MEMORY_AFFINITY;
@@ -349,7 +366,7 @@ typedef struct system_resource_affinity
{
ACPI_TABLE_HEADER_DEF
UINT32 Reserved1; /* Must be value '1' */
- UINT64 Reserved2;
+ UINT64 Reserved2; /* Reserved, must be zero */
} SYSTEM_RESOURCE_AFFINITY;
diff --git a/usr/src/uts/intel/sys/acpi/actypes.h b/usr/src/uts/intel/sys/acpi/actypes.h
index 2ff89665c7..97f2c39918 100644
--- a/usr/src/uts/intel/sys/acpi/actypes.h
+++ b/usr/src/uts/intel/sys/acpi/actypes.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 278 $
+ * $Revision: 282 $
*
*****************************************************************************/
@@ -279,10 +279,11 @@ typedef UINT32 ACPI_SIZE;
/*
- * Miscellaneous common types
+ * This type is used for bitfields in ACPI tables. The only type that is
+ * even remotely portable is UINT8. Anything else is not portable, so
+ * do not add any more bitfield types.
*/
-typedef UINT16 UINT16_BIT;
-typedef UINT32 UINT32_BIT;
+typedef UINT8 UINT8_BIT;
typedef ACPI_NATIVE_UINT ACPI_PTRDIFF;
/*
@@ -319,6 +320,14 @@ typedef struct acpi_pointer
#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
+/*
+ * If ACPI_CACHE_T was not defined in the OS-dependent header,
+ * define it now. This is typically the case where the local cache
+ * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
+ */
+#ifndef ACPI_CACHE_T
+#define ACPI_CACHE_T ACPI_MEMORY_LIST
+#endif
/*
* Useful defines
diff --git a/usr/src/uts/intel/sys/acpi/acutils.h b/usr/src/uts/intel/sys/acpi/acutils.h
index 988b4926d5..dbad95bff0 100644
--- a/usr/src/uts/intel/sys/acpi/acutils.h
+++ b/usr/src/uts/intel/sys/acpi/acutils.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 172 $
+ * $Revision: 177 $
*
*****************************************************************************/
@@ -194,10 +194,6 @@ BOOLEAN
AcpiUtValidObjectType (
ACPI_OBJECT_TYPE Type);
-ACPI_OWNER_ID
-AcpiUtAllocateOwnerId (
- UINT32 IdType);
-
/*
* utinit - miscellaneous initialization and shutdown
@@ -380,47 +376,63 @@ AcpiUtTrackStackPtr (
void
AcpiUtTrace (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo);
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId);
void
AcpiUtTracePtr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
void *Pointer);
void
AcpiUtTraceU32 (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT32 Integer);
void
AcpiUtTraceStr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *String);
void
AcpiUtExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo);
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId);
void
AcpiUtStatusExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_STATUS Status);
void
AcpiUtValueExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_INTEGER Value);
void
AcpiUtPtrExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT8 *Ptr);
void
@@ -452,7 +464,9 @@ void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...) ACPI_PRINTF_LIKE_FUNC;
@@ -460,7 +474,9 @@ void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...) ACPI_PRINTF_LIKE_FUNC;
@@ -551,8 +567,8 @@ AcpiUtAllocateObjectDescDbg (
UINT32 LineNumber,
UINT32 ComponentId);
-#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
+#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
+#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
void
AcpiUtDeleteObjectDesc (
@@ -629,16 +645,6 @@ void
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-AcpiUtDeleteGenericStateCache (
- void);
-
-void
-AcpiUtDeleteObjectCache (
- void);
-#endif
-
/*
* utmath
@@ -661,6 +667,14 @@ AcpiUtShortDivide (
* utmisc
*/
ACPI_STATUS
+AcpiUtAllocateOwnerId (
+ ACPI_OWNER_ID *OwnerId);
+
+ACPI_STATUS
+AcpiUtReleaseOwnerId (
+ ACPI_OWNER_ID OwnerId);
+
+ACPI_STATUS
AcpiUtWalkPackageTree (
ACPI_OPERAND_OBJECT *SourceObject,
void *TargetObject,
@@ -694,22 +708,6 @@ AcpiUtStrtoul64 (
#define ACPI_ANY_BASE 0
-ACPI_STATUS
-AcpiUtMutexInitialize (
- void);
-
-void
-AcpiUtMutexTerminate (
- void);
-
-ACPI_STATUS
-AcpiUtAcquireMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
-ACPI_STATUS
-AcpiUtReleaseMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
UINT8 *
AcpiUtGetResourceEndTag (
ACPI_OPERAND_OBJECT *ObjDesc);
@@ -738,22 +736,36 @@ AcpiUtDisplayInitPathname (
/*
- * utalloc - memory allocation and object caching
+ * utmutex - mutex support
*/
-void *
-AcpiUtAcquireFromCache (
- UINT32 ListId);
+ACPI_STATUS
+AcpiUtMutexInitialize (
+ void);
void
-AcpiUtReleaseToCache (
- UINT32 ListId,
- void *Object);
+AcpiUtMutexTerminate (
+ void);
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-AcpiUtDeleteGenericCache (
- UINT32 ListId);
-#endif
+ACPI_STATUS
+AcpiUtAcquireMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+ACPI_STATUS
+AcpiUtReleaseMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+
+
+/*
+ * utalloc - memory allocation and object caching
+ */
+ACPI_STATUS
+AcpiUtCreateCaches (
+ void);
+
+ACPI_STATUS
+AcpiUtDeleteCaches (
+ void);
ACPI_STATUS
AcpiUtValidateBuffer (
diff --git a/usr/src/uts/intel/sys/acpi/amlcode.h b/usr/src/uts/intel/sys/acpi/amlcode.h
index 7b6fc0c18e..b546d60e77 100644
--- a/usr/src/uts/intel/sys/acpi/amlcode.h
+++ b/usr/src/uts/intel/sys/acpi/amlcode.h
@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 81 $
+ * $Revision: 82 $
*
*****************************************************************************/
@@ -142,7 +142,7 @@
#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f
#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30
#define AML_NAME_CHAR_FIRST (UINT16) 0x41
-#define AML_OP_PREFIX (UINT16) 0x5b
+#define AML_EXTENDED_OP_PREFIX (UINT16) 0x5b
#define AML_ROOT_PREFIX (UINT16) 0x5c
#define AML_PARENT_PREFIX (UINT16) 0x5e
#define AML_LOCAL_OP (UINT16) 0x60
@@ -219,7 +219,7 @@
/* prefixed opcodes */
-#define AML_EXTOP (UINT16) 0x005b /* prefix for 2-byte opcodes */
+#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* prefix for 2-byte opcodes */
#define AML_MUTEX_OP (UINT16) 0x5b01
#define AML_EVENT_OP (UINT16) 0x5b02
diff --git a/usr/src/uts/intel/sys/acpi/platform/acdos16.h b/usr/src/uts/intel/sys/acpi/platform/acdos16.h
index 2fa57c7926..dc47e019a4 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acdos16.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acdos16.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdos16.h - DOS specific defines, etc.
- * $Revision: 11 $
+ * $Revision: 12 $
*
*****************************************************************************/
@@ -149,7 +149,7 @@
#define ACPI_PRINTF_LIKE_FUNC
/* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused. However, MSVC doesn't do this.
*/
diff --git a/usr/src/uts/intel/sys/acpi/platform/acenv.h b/usr/src/uts/intel/sys/acpi/platform/acenv.h
index 295f58b658..d6001a2a70 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acenv.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acenv.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 114 $
+ * $Revision: 116 $
*
*****************************************************************************/
@@ -122,35 +122,38 @@
* Configuration for ACPI tools and utilities
*/
-#ifdef _ACPI_DUMP_APP
+#ifdef ACPI_LIBRARY
+#define ACPI_USE_LOCAL_CACHE
+#endif
+
+#ifdef ACPI_DUMP_APP
#ifndef MSDOS
#define ACPI_DEBUG_OUTPUT
#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
#endif
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
#define ACPI_DISASSEMBLER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
#endif
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
+#endif
+
+#ifdef ACPI_APPLICATION
#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
+#define ACPI_USE_LOCAL_CACHE
#endif
/*
diff --git a/usr/src/uts/intel/sys/acpi/platform/acgcc.h b/usr/src/uts/intel/sys/acpi/platform/acgcc.h
index 67667b1354..e95e35c5fd 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acgcc.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acgcc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 27 $
+ * $Revision: 29 $
*
*****************************************************************************/
@@ -117,13 +117,17 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
+/* Function name is used for debug output. Non-ANSI, compiler-dependent */
+
+#define ACPI_GET_FUNCTION_NAME __FUNCTION__
+
/* This macro is used to tag functions as "printf-like" because
* some compilers (like GCC) can catch printf format string problems.
*/
-#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7)))
/* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
diff --git a/usr/src/uts/intel/sys/acpi/platform/acintel.h b/usr/src/uts/intel/sys/acpi/platform/acintel.h
index 3824fc0c5c..b98bb59cec 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acintel.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acintel.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acintel.h - VC specific defines, etc.
- * $Revision: 12 $
+ * $Revision: 13 $
*
*****************************************************************************/
@@ -167,7 +167,7 @@
#define ACPI_PRINTF_LIKE_FUNC
/* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused. However, MSVC doesn't do this.
*/
diff --git a/usr/src/uts/intel/sys/acpi/platform/aclinux.h b/usr/src/uts/intel/sys/acpi/platform/aclinux.h
index bebf166fb0..457db6a82d 100644
--- a/usr/src/uts/intel/sys/acpi/platform/aclinux.h
+++ b/usr/src/uts/intel/sys/acpi/platform/aclinux.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
- * $Revision: 36 $
+ * $Revision: 37 $
*
*****************************************************************************/
@@ -135,6 +135,11 @@
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
+/* Type(s) for the OSL */
+
+#define ACPI_CACHE_T kmem_cache_t
+
+
#else /* !__KERNEL__ */
#include <stdarg.h>
diff --git a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
index 5160788041..80fb1ef940 100644
--- a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
+++ b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmsvc.h - VC specific defines, etc.
- * $Revision: 21 $
+ * $Revision: 22 $
*
*****************************************************************************/
@@ -192,7 +192,7 @@
/*
* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused. However, MSVC doesn't do this.
*/