From 323028cffd28a2b3094c8fd51adc357506362d5c Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 1 Sep 2016 21:26:26 +0200
Subject: [PATCH] Sync ACPICA with Intel's version 20160831.

* Improve support for the so-called "module-level code".

* Fixed a possible mutex error during control method auto-serialization.

* Implemented two new table handler events (table install/uninstall).

* New 'execute predef' subcommand in the AML debugger.

* Various issues fixed.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.
---
 sys/conf/files                                     |   1 +
 sys/contrib/dev/acpica/changes.txt                 |  72 +++-
 .../dev/acpica/generate/unix/acpidump/Makefile     |   2 +
 .../dev/acpica/generate/unix/acpiexamples/Makefile |   1 +
 .../dev/acpica/generate/unix/acpiexec/Makefile     |   1 +
 .../dev/acpica/generate/unix/acpisrc/Makefile      |   1 +
 .../dev/acpica/generate/unix/acpixtract/Makefile   |   1 +
 sys/contrib/dev/acpica/generate/unix/iasl/Makefile |   2 +
 .../dev/acpica/source/compiler/aslcompiler.h       |   6 +-
 sys/contrib/dev/acpica/source/compiler/aslhelp.c   | 220 +++++++++++
 sys/contrib/dev/acpica/source/compiler/aslmain.c   | 320 +++++----------
 sys/contrib/dev/acpica/source/compiler/aslopt.c    |   2 +-
 .../dev/acpica/source/compiler/asloptions.c        |  14 +
 sys/contrib/dev/acpica/source/compiler/aslstubs.c  |  15 +
 sys/contrib/dev/acpica/source/compiler/aslutils.c  |  67 +---
 .../dev/acpica/source/compiler/dtcompiler.h        |   5 -
 sys/contrib/dev/acpica/source/compiler/dtfield.c   |  47 +--
 sys/contrib/dev/acpica/source/compiler/dtparser.y  |   6 +-
 sys/contrib/dev/acpica/source/compiler/dtutils.c   |  87 -----
 sys/contrib/dev/acpica/source/compiler/prparser.y  |   4 +-
 .../acpica/source/components/debugger/dbconvert.c  |   3 +-
 .../dev/acpica/source/components/debugger/dbexec.c |  65 ++--
 .../acpica/source/components/debugger/dbinput.c    |   1 +
 .../acpica/source/components/debugger/dbmethod.c   | 145 +++++++
 .../source/components/disassembler/dmresrcl2.c     |   6 +-
 .../acpica/source/components/dispatcher/dsmethod.c |  14 +-
 .../acpica/source/components/dispatcher/dswexec.c  |   3 +-
 .../acpica/source/components/dispatcher/dswload2.c |   8 +-
 .../dev/acpica/source/components/events/evgpe.c    |  67 ++++
 .../acpica/source/components/events/evgpeinit.c    |   7 +-
 .../dev/acpica/source/components/events/evrgnini.c |   3 +-
 .../dev/acpica/source/components/events/evxfgpe.c  |  52 +++
 .../acpica/source/components/executer/exconcat.c   |   3 +-
 .../acpica/source/components/executer/exconfig.c   | 112 ++----
 .../acpica/source/components/executer/exconvrt.c   |   7 +-
 .../dev/acpica/source/components/executer/exmisc.c |   3 +-
 .../acpica/source/components/executer/exoparg1.c   |   7 +-
 .../acpica/source/components/executer/exresop.c    |  10 +-
 .../acpica/source/components/executer/extrace.c    |  28 --
 .../acpica/source/components/executer/exutils.c    |  10 +
 .../dev/acpica/source/components/hardware/hwgpe.c  |  22 +-
 .../acpica/source/components/namespace/nsconvert.c |   2 +-
 .../acpica/source/components/namespace/nsload.c    |  30 +-
 .../acpica/source/components/namespace/nsparse.c   | 181 +++++++--
 .../acpica/source/components/namespace/nsutils.c   |  68 +++-
 .../dev/acpica/source/components/parser/psparse.c  |   5 +-
 .../dev/acpica/source/components/parser/psxface.c  |  82 ++++
 .../dev/acpica/source/components/tables/tbdata.c   | 158 ++++++++
 .../dev/acpica/source/components/tables/tbfadt.c   | 104 ++---
 .../dev/acpica/source/components/tables/tbfind.c   |  10 +-
 .../dev/acpica/source/components/tables/tbinstal.c |  79 +---
 .../dev/acpica/source/components/tables/tbxfload.c |  55 +--
 .../acpica/source/components/utilities/utaddress.c |   9 -
 .../dev/acpica/source/components/utilities/uthex.c |  51 ++-
 .../acpica/source/components/utilities/utnonansi.c | 432 +--------------------
 .../dev/acpica/source/components/utilities/utosi.c |  22 +-
 .../source/components/utilities/utstrtoul64.c      | 390 +++++++++++++++++++
 .../acpica/source/components/utilities/utxfinit.c  |   2 +-
 sys/contrib/dev/acpica/source/include/acdebug.h    |   4 +-
 sys/contrib/dev/acpica/source/include/acevents.h   |   5 +
 sys/contrib/dev/acpica/source/include/aclocal.h    |  12 +-
 sys/contrib/dev/acpica/source/include/acnamesp.h   |  12 +
 sys/contrib/dev/acpica/source/include/acparser.h   |   4 +
 sys/contrib/dev/acpica/source/include/acpixf.h     |  16 +-
 sys/contrib/dev/acpica/source/include/actables.h   |  19 +-
 sys/contrib/dev/acpica/source/include/actypes.h    |  57 +--
 sys/contrib/dev/acpica/source/include/acutils.h    |  19 +-
 .../dev/acpica/source/include/platform/acefi.h     |   6 +-
 .../dev/acpica/source/include/platform/acefiex.h   |  65 ++++
 .../dev/acpica/source/tools/acpidump/apdump.c      |   4 +-
 .../dev/acpica/source/tools/acpidump/apmain.c      |   4 +-
 .../dev/acpica/source/tools/acpiexec/aeexec.c      |  15 +-
 .../dev/acpica/source/tools/acpiexec/aehandlers.c  |   2 +
 .../dev/acpica/source/tools/acpiexec/aeinitfile.c  |   6 +-
 .../dev/acpica/source/tools/acpiexec/aemain.c      |  43 +-
 sys/dev/acpica/Makefile                            |   2 +-
 usr.sbin/acpi/acpidump/Makefile                    |   2 +
 usr.sbin/acpi/acpiexec/Makefile                    |   1 +
 usr.sbin/acpi/acpiexec/acpiexec.8                  |   6 +-
 usr.sbin/acpi/acpixtract/Makefile                  |   1 +
 usr.sbin/acpi/iasl/Makefile                        |   2 +
 usr.sbin/acpi/iasl/iasl.8                          |   6 +-
 82 files changed, 2081 insertions(+), 1362 deletions(-)
 create mode 100644 sys/contrib/dev/acpica/source/compiler/aslhelp.c
 create mode 100644 sys/contrib/dev/acpica/source/components/utilities/utstrtoul64.c

diff --git a/sys/conf/files b/sys/conf/files
index 2a7b672..af156dd 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2456,6 +2456,7 @@ ${ACPICA_COMP_DIR}/utilities/utpredef.c		optional acpi
 ${ACPICA_COMP_DIR}/utilities/utresrc.c		optional acpi
 ${ACPICA_COMP_DIR}/utilities/utstate.c		optional acpi
 ${ACPICA_COMP_DIR}/utilities/utstring.c		optional acpi
+${ACPICA_COMP_DIR}/utilities/utstrtoul64.c	optional acpi
 ${ACPICA_COMP_DIR}/utilities/utuuid.c		optional acpi acpi_debug
 ${ACPICA_COMP_DIR}/utilities/utxface.c		optional acpi
 ${ACPICA_COMP_DIR}/utilities/utxferror.c	optional acpi
diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt
index 03c8d4f..3e87f12 100644
--- a/sys/contrib/dev/acpica/changes.txt
+++ b/sys/contrib/dev/acpica/changes.txt
@@ -1,7 +1,72 @@
 ----------------------------------------
-29 July 2016. Summary of changes for version 20160729:
+31 August 2016. Summary of changes for version 20160831:
 
-This release is available at https://acpica.org/downloads
+
+1) ACPICA kernel-resident subsystem:
+
+Improve support for the so-called "module-level code", which is defined 
+to be math, logical and control AML opcodes that appear outside of any 
+control method. This change improves the support by adding more opcodes 
+that can be executed in the manner. Some other issues have been solved, 
+and the ASL grammar changes to support such code under all scope 
+operators (Device, etc.) are complete. Lv Zheng.
+
+UEFI support: these OSL functions have been implemented. This is an 
+additional step toward supporting the AcpiExec utility natively (with 
+full hardware access) under UEFI. Marcelo Ferreira.
+    AcpiOsReadPciConfiguration
+    AcpiOsWritePciConfiguration
+
+Fixed a possible mutex error during control method auto-serialization. Lv 
+Zheng. 
+
+Updated support for the Generic Address Structure by fully implementing 
+all GAS fields when a 32-bit address is expanded to a 64-bit GAS. Lv 
+Zheng.
+
+Updated the return value for the internal _OSI method. Instead of 
+0xFFFFFFFF, the "Ones" value is now returned, which is 0xFFFFFFFFFFFFFFFF 
+for 64-bit ACPI tables. This fixes an incompatibility with other ACPI 
+implementations, and will be reflected and clarified in the next version 
+of the ACPI specification.
+
+Implemented two new table events that can be passed to an ACPICA table 
+handler. These events are used to indicate a table installation or 
+uninstallation. These events are used in addition to existed table load 
+and unload events. Lv Zheng.
+
+Implemented a cleanup for all internal string-to-integer conversions. 
+Consolidate multiple versions of this functionality and limit possible 
+bases to either 10 or 16 to simplify the code. Adds a new file, 
+utstrtoul64.
+
+Cleanup the inclusion order of the various compiler-specific headers. 
+This simplifies build configuration management. The compiler-specific 
+headers are now split out from the host-specific headers. Lv Zheng.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and 
+has a much larger code and data size.
+
+  Current Release:
+    Non-Debug Version: 140.1K Code, 58.1K Data, 198.1K Total
+    Debug Version:     200.3K Code, 82.1K Data, 282.4K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL/AcpiExec: Added a command line option to display the build date/time 
+of the tool (-vd). This can be useful to verify that the correct version 
+of the tools are being used.
+
+AML Debugger: Implemented a new subcommand ("execute predef") to execute 
+all predefined control methods and names within the current namespace. 
+This can be useful for debugging problems with ACPI tables and the ACPI 
+namespace.
+
+----------------------------------------
+29 July 2016. Summary of changes for version 20160729:
 
 
 1) ACPICA kernel-resident subsystem:
@@ -34,7 +99,6 @@ help in the implementation of these functions would be appreciated:
     AcpiOsReadPciConfiguration
     AcpiOsWritePciConfiguration
 
-
 Restructured and standardized the C library configuration for ACPICA, 
 resulting in the various configuration options below. This includes a 
 global restructuring of the compiler-dependent and platform-dependent 
@@ -102,8 +166,6 @@ through the registry on older versions.
 ----------------------------------------
 27 May 2016. Summary of changes for version 20160527:
 
-This release is available at https://acpica.org/downloads
-
 
 1) ACPICA kernel-resident subsystem:
 
diff --git a/sys/contrib/dev/acpica/generate/unix/acpidump/Makefile b/sys/contrib/dev/acpica/generate/unix/acpidump/Makefile
index 4aa98a3..7e3723f 100644
--- a/sys/contrib/dev/acpica/generate/unix/acpidump/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/acpidump/Makefile
@@ -43,9 +43,11 @@ OBJECTS = \
 	$(OBJDIR)/utdebug.o\
 	$(OBJDIR)/utexcep.o\
 	$(OBJDIR)/utglobal.o\
+	$(OBJDIR)/uthex.o\
 	$(OBJDIR)/utmath.o\
 	$(OBJDIR)/utnonansi.o\
 	$(OBJDIR)/utstring.o\
+	$(OBJDIR)/utstrtoul64.o\
 	$(OBJDIR)/utxferror.o
 
 #
diff --git a/sys/contrib/dev/acpica/generate/unix/acpiexamples/Makefile b/sys/contrib/dev/acpica/generate/unix/acpiexamples/Makefile
index d1e5ac2..691b65b 100644
--- a/sys/contrib/dev/acpica/generate/unix/acpiexamples/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/acpiexamples/Makefile
@@ -156,6 +156,7 @@ OBJECTS = \
 	$(OBJDIR)/utresrc.o\
 	$(OBJDIR)/utstate.o\
 	$(OBJDIR)/utstring.o\
+	$(OBJDIR)/utstrtoul64.o\
 	$(OBJDIR)/utxface.o\
 	$(OBJDIR)/utxferror.o\
 	$(OBJDIR)/utxfinit.o
diff --git a/sys/contrib/dev/acpica/generate/unix/acpiexec/Makefile b/sys/contrib/dev/acpica/generate/unix/acpiexec/Makefile
index ad53dbe..62850ac 100644
--- a/sys/contrib/dev/acpica/generate/unix/acpiexec/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/acpiexec/Makefile
@@ -226,6 +226,7 @@ OBJECTS = \
 	$(OBJDIR)/utresrc.o\
 	$(OBJDIR)/utstate.o\
 	$(OBJDIR)/utstring.o\
+	$(OBJDIR)/utstrtoul64.o\
 	$(OBJDIR)/uttrack.o\
 	$(OBJDIR)/utuuid.o\
 	$(OBJDIR)/utxface.o\
diff --git a/sys/contrib/dev/acpica/generate/unix/acpisrc/Makefile b/sys/contrib/dev/acpica/generate/unix/acpisrc/Makefile
index 2a3282c..25ce59f 100644
--- a/sys/contrib/dev/acpica/generate/unix/acpisrc/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/acpisrc/Makefile
@@ -42,6 +42,7 @@ OBJECTS = \
     $(OBJDIR)/utdebug.o\
     $(OBJDIR)/utexcep.o\
     $(OBJDIR)/utglobal.o\
+	$(OBJDIR)/uthex.o\
     $(OBJDIR)/utmath.o\
     $(OBJDIR)/utnonansi.o\
     $(OBJDIR)/utstring.o\
diff --git a/sys/contrib/dev/acpica/generate/unix/acpixtract/Makefile b/sys/contrib/dev/acpica/generate/unix/acpixtract/Makefile
index 609451f..cb08fc0 100644
--- a/sys/contrib/dev/acpica/generate/unix/acpixtract/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/acpixtract/Makefile
@@ -36,6 +36,7 @@ OBJECTS = \
     $(OBJDIR)/utdebug.o\
     $(OBJDIR)/utexcep.o\
     $(OBJDIR)/utglobal.o\
+	$(OBJDIR)/uthex.o\
     $(OBJDIR)/utmath.o\
     $(OBJDIR)/utnonansi.o\
     $(OBJDIR)/utxferror.o
diff --git a/sys/contrib/dev/acpica/generate/unix/iasl/Makefile b/sys/contrib/dev/acpica/generate/unix/iasl/Makefile
index a231bd6..d06524d 100644
--- a/sys/contrib/dev/acpica/generate/unix/iasl/Makefile
+++ b/sys/contrib/dev/acpica/generate/unix/iasl/Makefile
@@ -62,6 +62,7 @@ OBJECTS = \
 	$(OBJDIR)/aslfiles.o\
 	$(OBJDIR)/aslfileio.o\
 	$(OBJDIR)/aslfold.o\
+	$(OBJDIR)/aslhelp.o\
 	$(OBJDIR)/aslhex.o\
 	$(OBJDIR)/asllength.o\
 	$(OBJDIR)/asllisting.o\
@@ -222,6 +223,7 @@ OBJECTS = \
 	$(OBJDIR)/utpredef.o\
 	$(OBJDIR)/utresrc.o\
 	$(OBJDIR)/utstate.o\
+	$(OBJDIR)/utstrtoul64.o\
 	$(OBJDIR)/utstring.o\
 	$(OBJDIR)/utuuid.o\
 	$(OBJDIR)/utxface.o\
diff --git a/sys/contrib/dev/acpica/source/compiler/aslcompiler.h b/sys/contrib/dev/acpica/source/compiler/aslcompiler.h
index 5e9a46b..d3cbcba 100644
--- a/sys/contrib/dev/acpica/source/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/source/compiler/aslcompiler.h
@@ -911,7 +911,7 @@ LkFindUnreferencedObjects (
     void);
 
 /*
- * aslmain - startup
+ * aslhelp - help screens
  */
 void
 Usage (
@@ -921,6 +921,10 @@ void
 AslFilenameHelp (
     void);
 
+void
+AslDisassemblyHelp (
+    void);
+
 
 /*
  * aslnamesp - namespace output file generation
diff --git a/sys/contrib/dev/acpica/source/compiler/aslhelp.c b/sys/contrib/dev/acpica/source/compiler/aslhelp.c
new file mode 100644
index 0000000..a0bd61f
--- /dev/null
+++ b/sys/contrib/dev/acpica/source/compiler/aslhelp.c
@@ -0,0 +1,220 @@
+/******************************************************************************
+ *
+ * Module Name: aslhelp - iASL help screens
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "acapps.h"
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslhelp")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Usage
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display option help message.
+ *              Optional items in square brackets.
+ *
+ ******************************************************************************/
+
+void
+Usage (
+    void)
+{
+    printf ("%s\n\n", ASL_COMPLIANCE);
+    ACPI_USAGE_HEADER ("iasl [Options] [Files]");
+
+    printf ("\nGeneral:\n");
+    ACPI_OPTION ("-@ <file>",       "Specify command file");
+    ACPI_OPTION ("-I <dir>",        "Specify additional include directory");
+    ACPI_OPTION ("-p <prefix>",     "Specify path/filename prefix for all output files");
+    ACPI_OPTION ("-v",              "Display compiler version");
+    ACPI_OPTION ("-vd",             "Display compiler build date and time");
+    ACPI_OPTION ("-vo",             "Enable optimization comments");
+    ACPI_OPTION ("-vs",             "Disable signon");
+
+    printf ("\nHelp:\n");
+    ACPI_OPTION ("-h",              "This message");
+    ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
+    ACPI_OPTION ("-hd",             "Info for obtaining and disassembling binary ACPI tables");
+    ACPI_OPTION ("-hf",             "Display help for output filename generation");
+    ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
+    ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
+
+    printf ("\nPreprocessor:\n");
+    ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
+    ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
+    ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
+    ACPI_OPTION ("-Pn",             "Disable preprocessor");
+
+    printf ("\nErrors, Warnings, and Remarks:\n");
+    ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
+    ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
+    ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
+    ACPI_OPTION ("-vr",             "Disable remarks");
+    ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
+    ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");
+    ACPI_OPTION ("-we",             "Report warnings as errors");
+
+    printf ("\nAML Code Generation (*.aml):\n");
+    ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
+    ACPI_OPTION ("-of",             "Disable constant folding");
+    ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
+    ACPI_OPTION ("-on",             "Disable named reference string optimization");
+    ACPI_OPTION ("-ot",             "Disable typechecking");
+    ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
+    ACPI_OPTION ("-in",             "Ignore NoOp operators");
+    ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
+
+    printf ("\nListings:\n");
+    ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
+    ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
+    ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
+    ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
+    ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");
+
+    printf ("\nFirmware Support - C Output:\n");
+    ACPI_OPTION ("-tc",             "Create hex AML table in C (*.hex)");
+    ACPI_OPTION ("-sc",             "Create named hex AML arrays in C (*.c)");
+    ACPI_OPTION ("-ic",             "Create include file in C for -sc symbols (*.h)");
+    ACPI_OPTION ("-so",             "Create namespace AML offset table in C (*.offset.h)");
+
+    printf ("\nFirmware Support - Assembler Output:\n");
+    ACPI_OPTION ("-ta",             "Create hex AML table in assembler (*.hex)");
+    ACPI_OPTION ("-sa",             "Create named hex AML arrays in assembler (*.asm)");
+    ACPI_OPTION ("-ia",             "Create include file in assembler for -sa symbols (*.inc)");
+
+    printf ("\nFirmware Support - ASL Output:\n");
+    ACPI_OPTION ("-ts",             "Create hex AML table in ASL (Buffer object) (*.hex)");
+
+    printf ("\nData Table Compiler:\n");
+    ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
+    ACPI_OPTION ("-T <sig list>|ALL",   "Create ACPI table template/example files");
+    ACPI_OPTION ("-T <count>",      "Emit DSDT and <count> SSDTs to same file");
+    ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
+
+    printf ("\nAML Disassembler:\n");
+    ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
+    ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
+    ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
+    ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
+    ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
+    ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
+    ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
+    ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
+    ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
+    ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
+    ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
+    ACPI_OPTION ("-l",              "Disassemble to mixed ASL and AML code");
+    ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
+
+    printf ("\nDebug Options:\n");
+    ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
+    ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
+    ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
+    ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
+    ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
+    ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
+    ACPI_OPTION ("-n",              "Parse only, no output generation");
+    ACPI_OPTION ("-oc",             "Display compile times and statistics");
+    ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
+    ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FilenameHelp
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display help message for output filename generation
+ *
+ ******************************************************************************/
+
+void
+AslFilenameHelp (
+    void)
+{
+
+    printf ("\nAML output filename generation:\n");
+    printf ("  Output filenames are generated by appending an extension to a common\n");
+    printf ("  filename prefix. The filename prefix is obtained via one of the\n");
+    printf ("  following methods (in priority order):\n");
+    printf ("    1) The -p option specifies the prefix\n");
+    printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
+    printf ("    3) The prefix of the input filename\n");
+    printf ("\n");
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslDisassemblyHelp
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL
+ *              files.
+ *
+ ******************************************************************************/
+
+void
+AslDisassemblyHelp (
+    void)
+{
+
+    printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n");
+    printf ("Use the following ACPICA toolchain:\n");
+    printf ("  AcpiDump: Dump all ACPI tables to a hex ascii file\n");
+    printf ("  AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n");
+    printf ("  iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n");
+    printf ("\n");
+}
diff --git a/sys/contrib/dev/acpica/source/compiler/aslmain.c b/sys/contrib/dev/acpica/source/compiler/aslmain.c
index 423fb59..6041658 100644
--- a/sys/contrib/dev/acpica/source/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/source/compiler/aslmain.c
@@ -76,242 +76,15 @@ AslInitialize (
 
 /*******************************************************************************
  *
- * FUNCTION:    Usage
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Display option help message.
- *              Optional items in square brackets.
- *
- ******************************************************************************/
-
-void
-Usage (
-    void)
-{
-    printf ("%s\n\n", ASL_COMPLIANCE);
-    ACPI_USAGE_HEADER ("iasl [Options] [Files]");
-
-    printf ("\nGeneral:\n");
-    ACPI_OPTION ("-@ <file>",       "Specify command file");
-    ACPI_OPTION ("-I <dir>",        "Specify additional include directory");
-    ACPI_OPTION ("-p <prefix>",     "Specify path/filename prefix for all output files");
-    ACPI_OPTION ("-v",              "Display compiler version");
-    ACPI_OPTION ("-vo",             "Enable optimization comments");
-    ACPI_OPTION ("-vs",             "Disable signon");
-
-    printf ("\nHelp:\n");
-    ACPI_OPTION ("-h",              "This message");
-    ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
-    ACPI_OPTION ("-hf",             "Display help for output filename generation");
-    ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
-    ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
-
-    printf ("\nPreprocessor:\n");
-    ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
-    ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
-    ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
-    ACPI_OPTION ("-Pn",             "Disable preprocessor");
-
-    printf ("\nErrors, Warnings, and Remarks:\n");
-    ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
-    ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
-    ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
-    ACPI_OPTION ("-vr",             "Disable remarks");
-    ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
-    ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");
-    ACPI_OPTION ("-we",             "Report warnings as errors");
-
-    printf ("\nAML Code Generation (*.aml):\n");
-    ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
-    ACPI_OPTION ("-of",             "Disable constant folding");
-    ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
-    ACPI_OPTION ("-on",             "Disable named reference string optimization");
-    ACPI_OPTION ("-ot",             "Disable typechecking");
-    ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
-    ACPI_OPTION ("-in",             "Ignore NoOp operators");
-    ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
-
-    printf ("\nListings:\n");
-    ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
-    ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
-    ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
-    ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
-    ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");
-
-    printf ("\nFirmware Support - C Output:\n");
-    ACPI_OPTION ("-tc",             "Create hex AML table in C (*.hex)");
-    ACPI_OPTION ("-sc",             "Create named hex AML arrays in C (*.c)");
-    ACPI_OPTION ("-ic",             "Create include file in C for -sc symbols (*.h)");
-    ACPI_OPTION ("-so",             "Create namespace AML offset table in C (*.offset.h)");
-
-    printf ("\nFirmware Support - Assembler Output:\n");
-    ACPI_OPTION ("-ta",             "Create hex AML table in assembler (*.hex)");
-    ACPI_OPTION ("-sa",             "Create named hex AML arrays in assembler (*.asm)");
-    ACPI_OPTION ("-ia",             "Create include file in assembler for -sa symbols (*.inc)");
-
-    printf ("\nFirmware Support - ASL Output:\n");
-    ACPI_OPTION ("-ts",             "Create hex AML table in ASL (Buffer object) (*.hex)");
-
-    printf ("\nData Table Compiler:\n");
-    ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
-    ACPI_OPTION ("-T <sig list>|ALL",   "Create ACPI table template/example files");
-    ACPI_OPTION ("-T <count>",      "Emit DSDT and <count> SSDTs to same file");
-    ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
-
-    printf ("\nAML Disassembler:\n");
-    ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
-    ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
-    ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
-    ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
-    ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
-    ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
-    ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
-    ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
-    ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
-    ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
-    ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
-    ACPI_OPTION ("-l",              "Disassemble to mixed ASL and AML code");
-    ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
-
-    printf ("\nDebug Options:\n");
-    ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
-    ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
-    ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
-    ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
-    ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
-    ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
-    ACPI_OPTION ("-n",              "Parse only, no output generation");
-    ACPI_OPTION ("-oc",             "Display compile times and statistics");
-    ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
-    ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    FilenameHelp
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Display help message for output filename generation
- *
- ******************************************************************************/
-
-void
-AslFilenameHelp (
-    void)
-{
-
-    printf ("\nAML output filename generation:\n");
-    printf ("  Output filenames are generated by appending an extension to a common\n");
-    printf ("  filename prefix. The filename prefix is obtained via one of the\n");
-    printf ("  following methods (in priority order):\n");
-    printf ("    1) The -p option specifies the prefix\n");
-    printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
-    printf ("    3) The prefix of the input filename\n");
-    printf ("\n");
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    AslSignalHandler
- *
- * PARAMETERS:  Sig                 - Signal that invoked this handler
- *
- * RETURN:      None
- *
- * DESCRIPTION: Control-C handler. Delete any intermediate files and any
- *              output files that may be left in an indeterminate state.
- *
- *****************************************************************************/
-
-static void ACPI_SYSTEM_XFACE
-AslSignalHandler (
-    int                     Sig)
-{
-    UINT32                  i;
-
-
-    signal (Sig, SIG_IGN);
-    printf ("Aborting\n\n");
-
-    /* Close all open files */
-
-    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
-
-    for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
-    {
-        FlCloseFile (i);
-    }
-
-    /* Delete any output files */
-
-    for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
-    {
-        FlDeleteFile (i);
-    }
-
-    exit (0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AslInitialize
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Initialize compiler globals
- *
- ******************************************************************************/
-
-static void
-AslInitialize (
-    void)
-{
-    UINT32                  i;
-
-
-    AcpiGbl_DmOpt_Verbose = FALSE;
-
-    /* Default integer width is 64 bits */
-
-    AcpiGbl_IntegerBitWidth = 64;
-    AcpiGbl_IntegerNybbleWidth = 16;
-    AcpiGbl_IntegerByteWidth = 8;
-
-    for (i = 0; i < ASL_NUM_FILES; i++)
-    {
-        Gbl_Files[i].Handle = NULL;
-        Gbl_Files[i].Filename = NULL;
-    }
-
-    Gbl_Files[ASL_FILE_STDOUT].Handle   = stdout;
-    Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
-
-    Gbl_Files[ASL_FILE_STDERR].Handle   = stderr;
-    Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
-}
-
-
-/*******************************************************************************
- *
  * FUNCTION:    main
  *
  * PARAMETERS:  Standard argc/argv
  *
  * RETURN:      Program termination code
  *
- * DESCRIPTION: C main routine for the Asl Compiler. Handle command line
- *              options and begin the compile for each file on the command line
+ * DESCRIPTION: C main routine for the iASL Compiler/Disassembler. Process
+ *  command line options and begin the compile/disassembly for each file on
+ *  the command line (wildcards supported).
  *
  ******************************************************************************/
 
@@ -349,7 +122,8 @@ main (
     PrInitializePreprocessor ();
     AslInitialize ();
 
-    Index1 = Index2 = AslCommandLine (argc, argv);
+    Index1 = Index2 =
+        AslCommandLine (argc, argv);
 
     /* Allocate the line buffer(s), must be after command line */
 
@@ -409,3 +183,87 @@ CleanupAndExit:
 
     return (ReturnStatus);
 }
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AslSignalHandler
+ *
+ * PARAMETERS:  Sig                 - Signal that invoked this handler
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Control-C handler. Delete any intermediate files and any
+ *              output files that may be left in an indeterminate state.
+ *
+ *****************************************************************************/
+
+static void ACPI_SYSTEM_XFACE
+AslSignalHandler (
+    int                     Sig)
+{
+    UINT32                  i;
+
+
+    signal (Sig, SIG_IGN);
+    printf ("Aborting\n\n");
+
+    /* Close all open files */
+
+    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
+
+    for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
+    {
+        FlCloseFile (i);
+    }
+
+    /* Delete any output files */
+
+    for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
+    {
+        FlDeleteFile (i);
+    }
+
+    exit (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslInitialize
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Initialize compiler globals
+ *
+ ******************************************************************************/
+
+static void
+AslInitialize (
+    void)
+{
+    UINT32                  i;
+
+
+    AcpiGbl_DmOpt_Verbose = FALSE;
+
+    /* Default integer width is 64 bits */
+
+    AcpiGbl_IntegerBitWidth = 64;
+    AcpiGbl_IntegerNybbleWidth = 16;
+    AcpiGbl_IntegerByteWidth = 8;
+
+    for (i = 0; i < ASL_NUM_FILES; i++)
+    {
+        Gbl_Files[i].Handle = NULL;
+        Gbl_Files[i].Filename = NULL;
+    }
+
+    Gbl_Files[ASL_FILE_STDOUT].Handle   = stdout;
+    Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+
+    Gbl_Files[ASL_FILE_STDERR].Handle   = stderr;
+    Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
+}
diff --git a/sys/contrib/dev/acpica/source/compiler/aslopt.c b/sys/contrib/dev/acpica/source/compiler/aslopt.c
index a07f10c..ce923bc 100644
--- a/sys/contrib/dev/acpica/source/compiler/aslopt.c
+++ b/sys/contrib/dev/acpica/source/compiler/aslopt.c
@@ -133,7 +133,7 @@ OptSearchToRoot (
      * not match, and we cannot use this optimization.
      */
     Path = &(((char *) TargetPath->Pointer)[
-        TargetPath->Length - ACPI_NAME_SIZE]),
+        TargetPath->Length - ACPI_NAME_SIZE]);
     ScopeInfo.Scope.Node = CurrentNode;
 
     /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
diff --git a/sys/contrib/dev/acpica/source/compiler/asloptions.c b/sys/contrib/dev/acpica/source/compiler/asloptions.c
index 85f5aef..b9d4e3c 100644
--- a/sys/contrib/dev/acpica/source/compiler/asloptions.c
+++ b/sys/contrib/dev/acpica/source/compiler/asloptions.c
@@ -70,6 +70,9 @@ AslDoResponseFile (
 #define ASL_TOKEN_SEPARATORS    " \t\n"
 #define ASL_SUPPORTED_OPTIONS   "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
 
+static char ASL_BUILD_DATE[] = __DATE__;
+static char ASL_BUILD_TIME[] = __TIME__;
+
 
 /*******************************************************************************
  *
@@ -404,6 +407,11 @@ AslDoOptions (
             UtDisplayConstantOpcodes ();
             exit (0);
 
+        case 'd':
+
+            AslDisassemblyHelp ();
+            exit (0);
+
         case 'f':
 
             AslFilenameHelp ();
@@ -712,6 +720,12 @@ AslDoOptions (
             Gbl_NoErrors = TRUE;
             break;
 
+        case 'd':
+
+            printf ("%s Build date/time: %s %s\n",
+                ASL_COMPILER_NAME, ASL_BUILD_DATE, ASL_BUILD_TIME);
+            exit (0);
+
         case 'e':
 
             /* Disable all warning/remark messages (errors only) */
diff --git a/sys/contrib/dev/acpica/source/compiler/aslstubs.c b/sys/contrib/dev/acpica/source/compiler/aslstubs.c
index f0fbe03..b88513f 100644
--- a/sys/contrib/dev/acpica/source/compiler/aslstubs.c
+++ b/sys/contrib/dev/acpica/source/compiler/aslstubs.c
@@ -47,6 +47,7 @@
 #include "acevents.h"
 #include "acinterp.h"
 #include "acnamesp.h"
+#include "acparser.h"
 
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("aslstubs")
@@ -71,6 +72,13 @@ AcpiNsInitializeObjects (
 }
 
 ACPI_STATUS
+AcpiPsExecuteTable (
+    ACPI_EVALUATE_INFO      *Info)
+{
+    return (AE_OK);
+}
+
+ACPI_STATUS
 AcpiHwReadPort (
     ACPI_IO_ADDRESS         Address,
     UINT32                  *Value,
@@ -156,6 +164,13 @@ AcpiEvDeleteGpeBlock (
     return (AE_OK);
 }
 
+void
+AcpiEvUpdateGpes (
+    ACPI_OWNER_ID           TableOwnerId)
+{
+    return;
+}
+
 ACPI_STATUS
 AcpiEvAcquireGlobalLock (
     UINT16                  Timeout)
diff --git a/sys/contrib/dev/acpica/source/compiler/aslutils.c b/sys/contrib/dev/acpica/source/compiler/aslutils.c
index f5ca7b7..990e72f 100644
--- a/sys/contrib/dev/acpica/source/compiler/aslutils.c
+++ b/sys/contrib/dev/acpica/source/compiler/aslutils.c
@@ -889,7 +889,7 @@ UtAttachNamepathToOwner (
  *
  * FUNCTION:    UtDoConstant
  *
- * PARAMETERS:  String              - Hex, Octal, or Decimal string
+ * PARAMETERS:  String              - Hexadecimal or decimal string
  *
  * RETURN:      Converted Integer
  *
@@ -906,9 +906,7 @@ UtDoConstant (
     char                    ErrBuf[64];
 
 
-    Status = AcpiUtStrtoul64 (String, ACPI_ANY_BASE,
-        ACPI_MAX64_BYTE_WIDTH, &Converted);
-
+    Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted);
     if (ACPI_FAILURE (Status))
     {
         sprintf (ErrBuf, "%s %s\n", "Conversion error:",
@@ -918,64 +916,3 @@ UtDoConstant (
 
     return (Converted);
 }
-
-
-#ifdef _OBSOLETE_FUNCTIONS
-/* Removed 01/2016 */
-
-/*******************************************************************************
- *
- * FUNCTION:    UtConvertByteToHex
- *
- * PARAMETERS:  RawByte             - Binary data
- *              Buffer              - Pointer to where the hex bytes will be
- *                                    stored
- *
- * RETURN:      Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- *              with "0x"
- *
- ******************************************************************************/
-
-void
-UtConvertByteToHex (
-    UINT8                   RawByte,
-    UINT8                   *Buffer)
-{
-
-    Buffer[0] = '0';
-    Buffer[1] = 'x';
-
-    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
-    Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    UtConvertByteToAsmHex
- *
- * PARAMETERS:  RawByte             - Binary data
- *              Buffer              - Pointer to where the hex bytes will be
- *                                    stored
- *
- * RETURN:      Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- *              with '0', and a trailing 'h' is added.
- *
- ******************************************************************************/
-
-void
-UtConvertByteToAsmHex (
-    UINT8                   RawByte,
-    UINT8                   *Buffer)
-{
-
-    Buffer[0] = '0';
-    Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
-    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
-    Buffer[3] = 'h';
-}
-#endif /* OBSOLETE_FUNCTIONS */
diff --git a/sys/contrib/dev/acpica/source/compiler/dtcompiler.h b/sys/contrib/dev/acpica/source/compiler/dtcompiler.h
index 87ebd9d..af7bead 100644
--- a/sys/contrib/dev/acpica/source/compiler/dtcompiler.h
+++ b/sys/contrib/dev/acpica/source/compiler/dtcompiler.h
@@ -373,11 +373,6 @@ DtFatal (
     DT_FIELD                *FieldObject,
     char                    *ExtraMessage);
 
-ACPI_STATUS
-DtStrtoul64 (
-    char                    *String,
-    UINT64                  *ReturnInteger);
-
 char*
 DtGetFieldValue (
     DT_FIELD                *Field);
diff --git a/sys/contrib/dev/acpica/source/compiler/dtfield.c b/sys/contrib/dev/acpica/source/compiler/dtfield.c
index a34b8e1..49bae72 100644
--- a/sys/contrib/dev/acpica/source/compiler/dtfield.c
+++ b/sys/contrib/dev/acpica/source/compiler/dtfield.c
@@ -370,10 +370,10 @@ DtCompileInteger (
  * FUNCTION:    DtNormalizeBuffer
  *
  * PARAMETERS:  Buffer              - Input buffer
- *              Count               - Output the count of hex number in
+ *              Count               - Output the count of hex numbers in
  *                                    the Buffer
  *
- * RETURN:      The normalized buffer, freed by caller
+ * RETURN:      The normalized buffer, must be freed by caller
  *
  * DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
  *              to 1A 2B 3C 4D
@@ -457,36 +457,38 @@ DtCompileBuffer (
     DT_FIELD                *Field,
     UINT32                  ByteLength)
 {
+    char                    *Substring;
     ACPI_STATUS             Status;
-    char                    Hex[3];
-    UINT64                  Value;
-    UINT32                  i;
     UINT32                  Count;
+    UINT32                  i;
 
 
     /* Allow several different types of value separators */
 
     StringValue = DtNormalizeBuffer (StringValue, &Count);
+    Substring = StringValue;
 
-    Hex[2] = 0;
-    for (i = 0; i < Count; i++)
+    /* Each element of StringValue is now three chars (2 hex + 1 space) */
+
+    for (i = 0; i < Count; i++, Substring += 3)
     {
-        /* Each element of StringValue is three chars */
+        /* Check for byte value too long */
 
-        Hex[0] = StringValue[(3 * i)];
-        Hex[1] = StringValue[(3 * i) + 1];
+        if (*(&Substring[2]) &&
+           (*(&Substring[2]) != ' '))
+        {
+            DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
+            goto Exit;
+        }
 
-        /* Convert one hex byte */
+        /* Convert two ASCII characters to one hex byte */
 
-        Value = 0;
-        Status = DtStrtoul64 (Hex, &Value);
+        Status = AcpiUtAsciiToHexByte (Substring, &Buffer[i]);
         if (ACPI_FAILURE (Status))
         {
-            DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
+            DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
             goto Exit;
         }
-
-        Buffer[i] = (UINT8) Value;
     }
 
 Exit:
@@ -499,13 +501,13 @@ Exit:
  *
  * FUNCTION:    DtCompileFlag
  *
- * PARAMETERS:  Buffer              - Output buffer
- *              Field               - Field to be compiled
- *              Info                - Flag info
+ * PARAMETERS:  Buffer                      - Output buffer
+ *              Field                       - Field to be compiled
+ *              Info                        - Flag info
  *
- * RETURN:
+ * RETURN:      None
  *
- * DESCRIPTION: Compile a flag
+ * DESCRIPTION: Compile a flag field. Handles flags up to 64 bits.
  *
  *****************************************************************************/
 
@@ -521,7 +523,8 @@ DtCompileFlag (
     ACPI_STATUS             Status;
 
 
-    Status = DtStrtoul64 (Field->Value, &Value);
+    Status = AcpiUtStrtoul64 (Field->Value,
+        (ACPI_STRTOUL_64BIT | ACPI_STRTOUL_BASE16), &Value);
     if (ACPI_FAILURE (Status))
     {
         DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL);
diff --git a/sys/contrib/dev/acpica/source/compiler/dtparser.y b/sys/contrib/dev/acpica/source/compiler/dtparser.y
index 233aa96..01f25ff 100644
--- a/sys/contrib/dev/acpica/source/compiler/dtparser.y
+++ b/sys/contrib/dev/acpica/source/compiler/dtparser.y
@@ -169,15 +169,15 @@ Expression
 
       /* Default base for a non-prefixed integer is 16 */
 
-    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
 
       /* Standard hex number (0x1234) */
 
-    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
 
       /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */
 
-    | EXPOP_DECIMAL_NUMBER                          { AcpiUtStrtoul64 (DtParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+    | EXPOP_DECIMAL_NUMBER                          { AcpiUtStrtoul64 (DtParsertext, ACPI_STRTOUL_64BIT, &$$);}
     ;
 %%
 
diff --git a/sys/contrib/dev/acpica/source/compiler/dtutils.c b/sys/contrib/dev/acpica/source/compiler/dtutils.c
index 4a280a8..fcc0ce7 100644
--- a/sys/contrib/dev/acpica/source/compiler/dtutils.c
+++ b/sys/contrib/dev/acpica/source/compiler/dtutils.c
@@ -197,93 +197,6 @@ DtFatal (
 
 /******************************************************************************
  *
- * FUNCTION:    DtStrtoul64
- *
- * PARAMETERS:  String              - Null terminated string
- *              ReturnInteger       - Where the converted integer is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Simple conversion of a string hex integer constant to unsigned
- *              value. Assumes no leading "0x" for the constant.
- *
- * Portability note: The reason this function exists is because a 64-bit
- * sscanf is not available in all environments.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-DtStrtoul64 (
-    char                    *String,
-    UINT64                  *ReturnInteger)
-{
-    char                    *ThisChar = String;
-    UINT32                  ThisDigit;
-    UINT64                  ReturnValue = 0;
-    int                     DigitCount = 0;
-
-
-    /* Skip over any white space in the buffer */
-
-    while ((*ThisChar == ' ') || (*ThisChar == '\t'))
-    {
-        ThisChar++;
-    }
-
-    /* Skip leading zeros */
-
-    while ((*ThisChar) == '0')
-    {
-        ThisChar++;
-    }
-
-    /* Convert character-by-character */
-
-    while (*ThisChar)
-    {
-        if (isdigit ((int) *ThisChar))
-        {
-            /* Convert ASCII 0-9 to Decimal value */
-
-            ThisDigit = ((UINT8) *ThisChar) - '0';
-        }
-        else /* Letter */
-        {
-            ThisDigit = (UINT32) toupper ((int) *ThisChar);
-            if (!isxdigit ((int) ThisDigit))
-            {
-                /* Not A-F */
-
-                return (AE_BAD_CHARACTER);
-            }
-
-            /* Convert ASCII Hex char (A-F) to value */
-
-            ThisDigit = (ThisDigit - 'A') + 10;
-        }
-
-        /* Insert the 4-bit hex digit */
-
-        ReturnValue <<= 4;
-        ReturnValue += ThisDigit;
-
-        ThisChar++;
-        DigitCount++;
-        if (DigitCount > 16)
-        {
-            /* Value is too large (> 64 bits/8 bytes/16 hex digits) */
-
-            return (AE_LIMIT);
-        }
-    }
-
-    *ReturnInteger = ReturnValue;
-    return (AE_OK);
-}
-
-
-/******************************************************************************
- *
  * FUNCTION:    DtGetFieldValue
  *
  * PARAMETERS:  Field               - Current field list pointer
diff --git a/sys/contrib/dev/acpica/source/compiler/prparser.y b/sys/contrib/dev/acpica/source/compiler/prparser.y
index d2f8405..db9490d 100644
--- a/sys/contrib/dev/acpica/source/compiler/prparser.y
+++ b/sys/contrib/dev/acpica/source/compiler/prparser.y
@@ -182,11 +182,11 @@ Expression
 
       /* Default base for a non-prefixed integer is 10 */
 
-    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (PrParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (PrParsertext, ACPI_STRTOUL_64BIT, &$$);}
 
       /* Standard hex number (0x1234) */
 
-    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (PrParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (PrParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
     ;
 %%
 
diff --git a/sys/contrib/dev/acpica/source/components/debugger/dbconvert.c b/sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
index 91ff89f..ef5226d 100644
--- a/sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
+++ b/sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
@@ -322,7 +322,8 @@ AcpiDbConvertToObject (
     default:
 
         Object->Type = ACPI_TYPE_INTEGER;
-        Status = AcpiUtStrtoul64 (String, 16, AcpiGbl_IntegerByteWidth,
+        Status = AcpiUtStrtoul64 (String,
+            (AcpiGbl_IntegerByteWidth | ACPI_STRTOUL_BASE16),
             &Object->Integer.Value);
         break;
     }
diff --git a/sys/contrib/dev/acpica/source/components/debugger/dbexec.c b/sys/contrib/dev/acpica/source/components/debugger/dbexec.c
index 4efb607..af15d33 100644
--- a/sys/contrib/dev/acpica/source/components/debugger/dbexec.c
+++ b/sys/contrib/dev/acpica/source/components/debugger/dbexec.c
@@ -445,44 +445,51 @@ AcpiDbExecute (
             ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL);
         return;
     }
-    else
+
+    NameString = ACPI_ALLOCATE (strlen (Name) + 1);
+    if (!NameString)
     {
-        NameString = ACPI_ALLOCATE (strlen (Name) + 1);
-        if (!NameString)
-        {
-            return;
-        }
+        return;
+    }
 
-        memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+    memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+    strcpy (NameString, Name);
+    AcpiUtStrupr (NameString);
 
-        strcpy (NameString, Name);
-        AcpiUtStrupr (NameString);
-        AcpiGbl_DbMethodInfo.Name = NameString;
-        AcpiGbl_DbMethodInfo.Args = Args;
-        AcpiGbl_DbMethodInfo.Types = Types;
-        AcpiGbl_DbMethodInfo.Flags = Flags;
+    /* Subcommand to Execute all predefined names in the namespace */
 
-        ReturnObj.Pointer = NULL;
-        ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+    if (!strncmp (NameString, "PREDEF", 6))
+    {
+        AcpiDbEvaluatePredefinedNames ();
+        ACPI_FREE (NameString);
+        return;
+    }
 
-        Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_FREE (NameString);
-            return;
-        }
+    AcpiGbl_DbMethodInfo.Name = NameString;
+    AcpiGbl_DbMethodInfo.Args = Args;
+    AcpiGbl_DbMethodInfo.Types = Types;
+    AcpiGbl_DbMethodInfo.Flags = Flags;
 
-        /* Get the NS node, determines existence also */
+    ReturnObj.Pointer = NULL;
+    ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
 
-        Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
-            &AcpiGbl_DbMethodInfo.Method);
-        if (ACPI_SUCCESS (Status))
-        {
-            Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo,
-                &ReturnObj);
-        }
+    Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+    if (ACPI_FAILURE (Status))
+    {
         ACPI_FREE (NameString);
+        return;
+    }
+
+    /* Get the NS node, determines existence also */
+
+    Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
+        &AcpiGbl_DbMethodInfo.Method);
+    if (ACPI_SUCCESS (Status))
+    {
+        Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo,
+            &ReturnObj);
     }
+    ACPI_FREE (NameString);
 
     /*
      * Allow any handlers in separate threads to complete.
diff --git a/sys/contrib/dev/acpica/source/components/debugger/dbinput.c b/sys/contrib/dev/acpica/source/components/debugger/dbinput.c
index 61f5b8c..6978984 100644
--- a/sys/contrib/dev/acpica/source/components/debugger/dbinput.c
+++ b/sys/contrib/dev/acpica/source/components/debugger/dbinput.c
@@ -300,6 +300,7 @@ static const ACPI_DB_COMMAND_HELP   AcpiGbl_DbCommandHelp[] =
     {1, "     \"Ascii String\"",               "String method argument\n"},
     {1, "     (Hex Byte List)",                "Buffer method argument\n"},
     {1, "     [Package Element List]",         "Package method argument\n"},
+    {5, "  Execute predefined",                "Execute all predefined (public) methods\n"},
     {1, "  Go",                                "Allow method to run to completion\n"},
     {1, "  Information",                       "Display info about the current method\n"},
     {1, "  Into",                              "Step into (not over) a method call\n"},
diff --git a/sys/contrib/dev/acpica/source/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/source/components/debugger/dbmethod.c
index 076a6c8..65d88cb 100644
--- a/sys/contrib/dev/acpica/source/components/debugger/dbmethod.c
+++ b/sys/contrib/dev/acpica/source/components/debugger/dbmethod.c
@@ -55,6 +55,15 @@
 #define _COMPONENT          ACPI_CA_DEBUGGER
         ACPI_MODULE_NAME    ("dbmethod")
 
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue);
+
 
 /*******************************************************************************
  *
@@ -417,4 +426,140 @@ AcpiDbDisassembleMethod (
     return (AE_OK);
 }
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDbWalkForExecute
+ *
+ * PARAMETERS:  Callback from WalkNamespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Batch execution module. Currently only executes predefined
+ *              ACPI names.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue)
+{
+    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+    ACPI_DB_EXECUTE_WALK    *Info = (ACPI_DB_EXECUTE_WALK *) Context;
+    ACPI_BUFFER             ReturnObj;
+    ACPI_STATUS             Status;
+    char                    *Pathname;
+    UINT32                  i;
+    ACPI_DEVICE_INFO        *ObjInfo;
+    ACPI_OBJECT_LIST        ParamObjects;
+    ACPI_OBJECT             Params[ACPI_METHOD_NUM_ARGS];
+    const ACPI_PREDEFINED_INFO *Predefined;
+
+
+    Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
+    if (!Predefined)
+    {
+        return (AE_OK);
+    }
+
+    if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
+    {
+        return (AE_OK);
+    }
+
+    Pathname = AcpiNsGetExternalPathname (Node);
+    if (!Pathname)
+    {
+        return (AE_OK);
+    }
+
+    /* Get the object info for number of method parameters */
+
+    Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    ParamObjects.Pointer = NULL;
+    ParamObjects.Count   = 0;
+
+    if (ObjInfo->Type == ACPI_TYPE_METHOD)
+    {
+        /* Setup default parameters */
+
+        for (i = 0; i < ObjInfo->ParamCount; i++)
+        {
+            Params[i].Type           = ACPI_TYPE_INTEGER;
+            Params[i].Integer.Value  = 1;
+        }
+
+        ParamObjects.Pointer     = Params;
+        ParamObjects.Count       = ObjInfo->ParamCount;
+    }
+
+    ACPI_FREE (ObjInfo);
+    ReturnObj.Pointer = NULL;
+    ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+    /* Do the actual method execution */
+
+    AcpiGbl_MethodExecuting = TRUE;
+
+    Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
+
+    AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
+    AcpiGbl_MethodExecuting = FALSE;
+    ACPI_FREE (Pathname);
+
+    /* Ignore status from method execution */
+
+    Status = AE_OK;
+
+    /* Update count, check if we have executed enough methods */
+
+    Info->Count++;
+    if (Info->Count >= Info->MaxCount)
+    {
+        Status = AE_CTRL_TERMINATE;
+    }
+
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDbEvaluatePredefinedNames
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Namespace batch execution. Execute predefined names in the
+ *              namespace, up to the max count, if specified.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbEvaluatePredefinedNames (
+    void)
+{
+    ACPI_DB_EXECUTE_WALK    Info;
+
+
+    Info.Count = 0;
+    Info.MaxCount = ACPI_UINT32_MAX;
+
+    /* Search all nodes in namespace */
+
+    (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
+
+    AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count);
+}
+
 #endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c
index ca4a1aa..7cd6542 100644
--- a/sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c
+++ b/sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c
@@ -518,7 +518,7 @@ AcpiDmI2cSerialBusDescriptor (
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
         Resource->CommonSerialBus.TypeDataLength;
 
-    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
@@ -603,7 +603,7 @@ AcpiDmSpiSerialBusDescriptor (
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
         Resource->CommonSerialBus.TypeDataLength;
 
-    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
@@ -691,7 +691,7 @@ AcpiDmUartSerialBusDescriptor (
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
         Resource->CommonSerialBus.TypeDataLength;
 
-    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+    DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c
index 334dadc..4c4ff22 100644
--- a/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c
+++ b/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c
@@ -107,12 +107,15 @@ AcpiDsAutoSerializeMethod (
         "Method auto-serialization parse [%4.4s] %p\n",
         AcpiUtGetNodeName (Node), Node));
 
+    AcpiExEnterInterpreter ();
+
     /* Create/Init a root op for the method parse tree */
 
     Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
     if (!Op)
     {
-        return_ACPI_STATUS (AE_NO_MEMORY);
+        Status = AE_NO_MEMORY;
+        goto Unlock;
     }
 
     AcpiPsSetName (Op, Node->Name.Integer);
@@ -124,7 +127,8 @@ AcpiDsAutoSerializeMethod (
     if (!WalkState)
     {
         AcpiPsFreeOp (Op);
-        return_ACPI_STATUS (AE_NO_MEMORY);
+        Status = AE_NO_MEMORY;
+        goto Unlock;
     }
 
     Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
@@ -143,6 +147,8 @@ AcpiDsAutoSerializeMethod (
     Status = AcpiPsParseAml (WalkState);
 
     AcpiPsDeleteParseTree (Op);
+Unlock:
+    AcpiExExitInterpreter ();
     return_ACPI_STATUS (Status);
 }
 
@@ -810,7 +816,9 @@ AcpiDsTerminateControlMethod (
         {
             /* Delete any direct children of (created by) this method */
 
+            (void) AcpiExExitInterpreter ();
             AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode);
+            (void) AcpiExEnterInterpreter ();
 
             /*
              * Delete any objects that were created by this method
@@ -821,7 +829,9 @@ AcpiDsTerminateControlMethod (
              */
             if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE)
             {
+                (void) AcpiExExitInterpreter ();
                 AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
+                (void) AcpiExEnterInterpreter ();
                 MethodDesc->Method.InfoFlags &=
                     ~ACPI_METHOD_MODIFIED_NAMESPACE;
             }
diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dswexec.c b/sys/contrib/dev/acpica/source/components/dispatcher/dswexec.c
index 307af60..e284fca 100644
--- a/sys/contrib/dev/acpica/source/components/dispatcher/dswexec.c
+++ b/sys/contrib/dev/acpica/source/components/dispatcher/dswexec.c
@@ -144,7 +144,8 @@ AcpiDsGetPredicateValue (
      * Result of predicate evaluation must be an Integer
      * object. Implicitly convert the argument if necessary.
      */
-    Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
+    Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
+        ACPI_STRTOUL_BASE16);
     if (ACPI_FAILURE (Status))
     {
         goto Cleanup;
diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dswload2.c b/sys/contrib/dev/acpica/source/components/dispatcher/dswload2.c
index 2c099ef..ae076e2 100644
--- a/sys/contrib/dev/acpica/source/components/dispatcher/dswload2.c
+++ b/sys/contrib/dev/acpica/source/components/dispatcher/dswload2.c
@@ -624,16 +624,12 @@ AcpiDsLoad2EndOp (
                 {
                     return_ACPI_STATUS (Status);
                 }
-
-                AcpiExExitInterpreter ();
             }
 
+            AcpiExExitInterpreter ();
             Status = AcpiEvInitializeRegion (
                 AcpiNsGetAttachedObject (Node), FALSE);
-            if (WalkState->MethodNode)
-            {
-                AcpiExEnterInterpreter ();
-            }
+            AcpiExEnterInterpreter ();
 
             if (ACPI_FAILURE (Status))
             {
diff --git a/sys/contrib/dev/acpica/source/components/events/evgpe.c b/sys/contrib/dev/acpica/source/components/events/evgpe.c
index d683bfd..3122894 100644
--- a/sys/contrib/dev/acpica/source/components/events/evgpe.c
+++ b/sys/contrib/dev/acpica/source/components/events/evgpe.c
@@ -149,6 +149,70 @@ AcpiEvEnableGpe (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiEvMaskGpe
+ *
+ * PARAMETERS:  GpeEventInfo            - GPE to be blocked/unblocked
+ *              IsMasked                - Whether the GPE is masked or not
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvMaskGpe (
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
+    BOOLEAN                 IsMasked)
+{
+    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
+    UINT32                  RegisterBit;
+
+
+    ACPI_FUNCTION_TRACE (EvMaskGpe);
+
+
+    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+    if (!GpeRegisterInfo)
+    {
+        return_ACPI_STATUS (AE_NOT_EXIST);
+    }
+
+    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
+
+    /* Perform the action */
+
+    if (IsMasked)
+    {
+        if (RegisterBit & GpeRegisterInfo->MaskForRun)
+        {
+            return_ACPI_STATUS (AE_BAD_PARAMETER);
+        }
+
+        (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+        ACPI_SET_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
+    }
+    else
+    {
+        if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
+        {
+            return_ACPI_STATUS (AE_BAD_PARAMETER);
+        }
+
+        ACPI_CLEAR_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
+        if (GpeEventInfo->RuntimeCount &&
+            !GpeEventInfo->DisableForDispatch)
+        {
+            (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
+        }
+    }
+
+    return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiEvAddGpeReference
  *
  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
@@ -715,6 +779,7 @@ AcpiEvFinishGpe (
      * in the EventInfo.
      */
     (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE);
+    GpeEventInfo->DisableForDispatch = FALSE;
     return (AE_OK);
 }
 
@@ -784,6 +849,8 @@ AcpiEvGpeDispatch (
         }
     }
 
+    GpeEventInfo->DisableForDispatch = TRUE;
+
     /*
      * Dispatch the GPE to either an installed handler or the control
      * method associated with this GPE (_Lxx or _Exx). If a handler
diff --git a/sys/contrib/dev/acpica/source/components/events/evgpeinit.c b/sys/contrib/dev/acpica/source/components/events/evgpeinit.c
index 8e2fd34..0156ee2 100644
--- a/sys/contrib/dev/acpica/source/components/events/evgpeinit.c
+++ b/sys/contrib/dev/acpica/source/components/events/evgpeinit.c
@@ -336,7 +336,9 @@ AcpiEvMatchGpeMethod (
     ACPI_NAMESPACE_NODE     *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
     ACPI_GPE_WALK_INFO      *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
+    ACPI_STATUS             Status;
     UINT32                  GpeNumber;
+    UINT8                   TempGpeNumber;
     char                    Name[ACPI_NAME_SIZE + 1];
     UINT8                   Type;
 
@@ -395,8 +397,8 @@ AcpiEvMatchGpeMethod (
 
     /* 4) The last two characters of the name are the hex GPE Number */
 
-    GpeNumber = strtoul (&Name[2], NULL, 16);
-    if (GpeNumber == ACPI_UINT32_MAX)
+    Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber);
+    if (ACPI_FAILURE (Status))
     {
         /* Conversion failed; invalid method, just ignore it */
 
@@ -408,6 +410,7 @@ AcpiEvMatchGpeMethod (
 
     /* Ensure that we have a valid GPE number for this GPE block */
 
+    GpeNumber = (UINT32) TempGpeNumber;
     GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
     if (!GpeEventInfo)
     {
diff --git a/sys/contrib/dev/acpica/source/components/events/evrgnini.c b/sys/contrib/dev/acpica/source/components/events/evrgnini.c
index a9e6be0..51e3ce9 100644
--- a/sys/contrib/dev/acpica/source/components/events/evrgnini.c
+++ b/sys/contrib/dev/acpica/source/components/events/evrgnini.c
@@ -618,7 +618,8 @@ AcpiEvInitializeRegion (
                  *
                  * See AcpiNsExecModuleCode
                  */
-                if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
+                if (!AcpiGbl_ParseTableAsTermList &&
+                    ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
                 {
                     HandlerObj = ObjDesc->Method.Dispatch.Handler;
                 }
diff --git a/sys/contrib/dev/acpica/source/components/events/evxfgpe.c b/sys/contrib/dev/acpica/source/components/events/evxfgpe.c
index 1d467d9..e336703 100644
--- a/sys/contrib/dev/acpica/source/components/events/evxfgpe.c
+++ b/sys/contrib/dev/acpica/source/components/events/evxfgpe.c
@@ -271,11 +271,13 @@ AcpiSetGpe (
     case ACPI_GPE_ENABLE:
 
         Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
+        GpeEventInfo->DisableForDispatch = FALSE;
         break;
 
     case ACPI_GPE_DISABLE:
 
         Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+        GpeEventInfo->DisableForDispatch = TRUE;
         break;
 
     default:
@@ -294,6 +296,56 @@ ACPI_EXPORT_SYMBOL (AcpiSetGpe)
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiMaskGpe
+ *
+ * PARAMETERS:  GpeDevice           - Parent GPE Device. NULL for GPE0/GPE1
+ *              GpeNumber           - GPE level within the GPE block
+ *              IsMasked            - Whether the GPE is masked or not
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Unconditionally mask/unmask the an individual GPE, ex., to
+ *              prevent a GPE flooding.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiMaskGpe (
+    ACPI_HANDLE             GpeDevice,
+    UINT32                  GpeNumber,
+    BOOLEAN                 IsMasked)
+{
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo;
+    ACPI_STATUS             Status;
+    ACPI_CPU_FLAGS          Flags;
+
+
+    ACPI_FUNCTION_TRACE (AcpiMaskGpe);
+
+
+    Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+    /* Ensure that we have a valid GPE number */
+
+    GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+    if (!GpeEventInfo)
+    {
+        Status = AE_BAD_PARAMETER;
+        goto UnlockAndExit;
+    }
+
+    Status = AcpiEvMaskGpe (GpeEventInfo, IsMasked);
+
+UnlockAndExit:
+    AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+    return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiMaskGpe)
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiMarkGpeForWake
  *
  * PARAMETERS:  GpeDevice           - Parent GPE Device. NULL for GPE0/GPE1
diff --git a/sys/contrib/dev/acpica/source/components/executer/exconcat.c b/sys/contrib/dev/acpica/source/components/executer/exconcat.c
index 49b279a..22091b5 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exconcat.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exconcat.c
@@ -164,7 +164,8 @@ AcpiExDoConcatenate (
     {
     case ACPI_TYPE_INTEGER:
 
-        Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, 16);
+        Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1,
+            ACPI_STRTOUL_BASE16);
         break;
 
     case ACPI_TYPE_BUFFER:
diff --git a/sys/contrib/dev/acpica/source/components/executer/exconfig.c b/sys/contrib/dev/acpica/source/components/executer/exconfig.c
index bb0d2bb..7e2f699 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exconfig.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exconfig.c
@@ -59,7 +59,6 @@
 static ACPI_STATUS
 AcpiExAddTable (
     UINT32                  TableIndex,
-    ACPI_NAMESPACE_NODE     *ParentNode,
     ACPI_OPERAND_OBJECT     **DdbHandle);
 
 static ACPI_STATUS
@@ -87,12 +86,9 @@ AcpiExRegionRead (
 static ACPI_STATUS
 AcpiExAddTable (
     UINT32                  TableIndex,
-    ACPI_NAMESPACE_NODE     *ParentNode,
     ACPI_OPERAND_OBJECT     **DdbHandle)
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
-    ACPI_STATUS             Status;
-    ACPI_OWNER_ID           OwnerId;
 
 
     ACPI_FUNCTION_TRACE (ExAddTable);
@@ -110,42 +106,8 @@ AcpiExAddTable (
 
     ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
     ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
-    *DdbHandle = ObjDesc;
-
-    /* Install the new table into the local data structures */
-
     ObjDesc->Reference.Value = TableIndex;
-
-    /* Add the table to the namespace */
-
-    Status = AcpiNsLoadTable (TableIndex, ParentNode);
-    if (ACPI_FAILURE (Status))
-    {
-        AcpiUtRemoveReference (ObjDesc);
-        *DdbHandle = NULL;
-        return_ACPI_STATUS (Status);
-    }
-
-    /* Execute any module-level code that was found in the table */
-
-    AcpiExExitInterpreter ();
-    if (AcpiGbl_GroupModuleLevelCode)
-    {
-        AcpiNsExecModuleCodeList ();
-    }
-    AcpiExEnterInterpreter ();
-
-    /*
-     * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
-     * responsible for discovering any new wake GPEs by running _PRW methods
-     * that may have been loaded by this table.
-     */
-    Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
-    if (ACPI_SUCCESS (Status))
-    {
-        AcpiEvUpdateGpes (OwnerId);
-    }
-
+    *DdbHandle = ObjDesc;
     return_ACPI_STATUS (AE_OK);
 }
 
@@ -174,7 +136,6 @@ AcpiExLoadTableOp (
     ACPI_NAMESPACE_NODE     *StartNode;
     ACPI_NAMESPACE_NODE     *ParameterNode = NULL;
     ACPI_OPERAND_OBJECT     *DdbHandle;
-    ACPI_TABLE_HEADER       *Table;
     UINT32                  TableIndex;
 
 
@@ -183,10 +144,12 @@ AcpiExLoadTableOp (
 
     /* Find the ACPI table in the RSDT/XSDT */
 
+    AcpiExExitInterpreter ();
     Status = AcpiTbFindTable (
         Operand[0]->String.Pointer,
         Operand[1]->String.Pointer,
         Operand[2]->String.Pointer, &TableIndex);
+    AcpiExEnterInterpreter ();
     if (ACPI_FAILURE (Status))
     {
         if (Status != AE_NOT_FOUND)
@@ -219,8 +182,9 @@ AcpiExLoadTableOp (
          * Find the node referenced by the RootPathString. This is the
          * location within the namespace where the table will be loaded.
          */
-        Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
-            ACPI_NS_SEARCH_PARENT, &ParentNode);
+        Status = AcpiNsGetNodeUnlocked (StartNode,
+            Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT,
+            &ParentNode);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -243,8 +207,9 @@ AcpiExLoadTableOp (
 
         /* Find the node referenced by the ParameterPathString */
 
-        Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,
-            ACPI_NS_SEARCH_PARENT, &ParameterNode);
+        Status = AcpiNsGetNodeUnlocked (StartNode,
+            Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT,
+            &ParameterNode);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -253,7 +218,16 @@ AcpiExLoadTableOp (
 
     /* Load the table into the namespace */
 
-    Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);
+    ACPI_INFO (("Dynamic OEM Table Load:"));
+    AcpiExExitInterpreter ();
+    Status = AcpiTbLoadTable (TableIndex, ParentNode);
+    AcpiExEnterInterpreter ();
+    if (ACPI_FAILURE (Status))
+    {
+	return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiExAddTable (TableIndex, &DdbHandle);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -276,21 +250,6 @@ AcpiExLoadTableOp (
         }
     }
 
-    Status = AcpiGetTableByIndex (TableIndex, &Table);
-    if (ACPI_SUCCESS (Status))
-    {
-        ACPI_INFO (("Dynamic OEM Table Load:"));
-        AcpiTbPrintTableHeader (0, Table);
-    }
-
-    /* Invoke table handler if present */
-
-    if (AcpiGbl_TableHandler)
-    {
-        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
-            AcpiGbl_TableHandlerContext);
-    }
-
     *ReturnDesc = DdbHandle;
     return_ACPI_STATUS (Status);
 }
@@ -520,13 +479,10 @@ AcpiExLoadOp (
     /* Install the new table into the local data structures */
 
     ACPI_INFO (("Dynamic OEM Table Load:"));
-    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
-    Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
-        ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE,
-        &TableIndex);
-
-    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+    AcpiExExitInterpreter ();
+    Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table),
+        ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, &TableIndex);
+    AcpiExEnterInterpreter ();
     if (ACPI_FAILURE (Status))
     {
         /* Delete allocated table buffer */
@@ -536,24 +492,13 @@ AcpiExLoadOp (
     }
 
     /*
-     * Note: Now table is "INSTALLED", it must be validated before
-     * loading.
-     */
-    Status = AcpiTbValidateTable (
-        &AcpiGbl_RootTableList.Tables[TableIndex]);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    /*
      * Add the table to the namespace.
      *
      * Note: Load the table objects relative to the root of the namespace.
      * This appears to go against the ACPI specification, but we do it for
      * compatibility with other ACPI implementations.
      */
-    Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
+    Status = AcpiExAddTable (TableIndex, &DdbHandle);
     if (ACPI_FAILURE (Status))
     {
         /* On error, TablePtr was deallocated above */
@@ -577,15 +522,6 @@ AcpiExLoadOp (
     /* Remove the reference by added by AcpiExStore above */
 
     AcpiUtRemoveReference (DdbHandle);
-
-    /* Invoke table handler if present */
-
-    if (AcpiGbl_TableHandler)
-    {
-        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
-            AcpiGbl_TableHandlerContext);
-    }
-
     return_ACPI_STATUS (Status);
 }
 
diff --git a/sys/contrib/dev/acpica/source/components/executer/exconvrt.c b/sys/contrib/dev/acpica/source/components/executer/exconvrt.c
index ea6f826..5e0f549 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exconvrt.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exconvrt.c
@@ -137,8 +137,8 @@ AcpiExConvertToInteger (
          * of ACPI 3.0) is that the ToInteger() operator allows both decimal
          * and hexadecimal strings (hex prefixed with "0x").
          */
-        Status = AcpiUtStrtoul64 ((char *) Pointer, Flags,
-            AcpiGbl_IntegerByteWidth, &Result);
+        Status = AcpiUtStrtoul64 (ACPI_CAST_PTR (char, Pointer),
+            (AcpiGbl_IntegerByteWidth | Flags), &Result);
         if (ACPI_FAILURE (Status))
         {
             return_ACPI_STATUS (Status);
@@ -684,7 +684,8 @@ AcpiExConvertToTargetType (
              * These types require an Integer operand. We can convert
              * a Buffer or a String to an Integer if necessary.
              */
-            Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, 16);
+            Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
+                ACPI_STRTOUL_BASE16);
             break;
 
         case ACPI_TYPE_STRING:
diff --git a/sys/contrib/dev/acpica/source/components/executer/exmisc.c b/sys/contrib/dev/acpica/source/components/executer/exmisc.c
index a8e5497..21e30f0 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exmisc.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exmisc.c
@@ -360,7 +360,8 @@ AcpiExDoLogicalOp (
     {
     case ACPI_TYPE_INTEGER:
 
-        Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
+        Status = AcpiExConvertToInteger (Operand1, &LocalOperand1,
+            ACPI_STRTOUL_BASE16);
         break;
 
     case ACPI_TYPE_STRING:
diff --git a/sys/contrib/dev/acpica/source/components/executer/exoparg1.c b/sys/contrib/dev/acpica/source/components/executer/exoparg1.c
index 5a45bea..d91d8c5 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exoparg1.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exoparg1.c
@@ -550,8 +550,9 @@ AcpiExOpcode_1A_1T_1R (
 
     case AML_TO_INTEGER_OP:         /* ToInteger (Data, Result) */
 
-        Status = AcpiExConvertToInteger (
-            Operand[0], &ReturnDesc, ACPI_ANY_BASE);
+        /* Perform "explicit" conversion */
+
+        Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0);
         if (ReturnDesc == Operand[0])
         {
             /* No conversion performed, add ref to handle return value */
@@ -936,7 +937,7 @@ AcpiExOpcode_1A_0T_1R (
                  * 2) Dereference the node to an actual object. Could be a
                  *    Field, so we need to resolve the node to a value.
                  */
-                Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node,
+                Status = AcpiNsGetNodeUnlocked (WalkState->ScopeInfo->Scope.Node,
                     Operand[0]->String.Pointer,
                     ACPI_NS_SEARCH_PARENT,
                     ACPI_CAST_INDIRECT_PTR (
diff --git a/sys/contrib/dev/acpica/source/components/executer/exresop.c b/sys/contrib/dev/acpica/source/components/executer/exresop.c
index 32ceb6f..d4352e2 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exresop.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exresop.c
@@ -428,11 +428,13 @@ AcpiExResolveOperands (
         case ARGI_INTEGER:
 
             /*
-             * Need an operand of type ACPI_TYPE_INTEGER,
-             * But we can implicitly convert from a STRING or BUFFER
-             * Aka - "Implicit Source Operand Conversion"
+             * Need an operand of type ACPI_TYPE_INTEGER, but we can
+             * implicitly convert from a STRING or BUFFER.
+             *
+             * Known as "Implicit Source Operand Conversion"
              */
-            Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
+            Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
+                ACPI_STRTOUL_BASE16);
             if (ACPI_FAILURE (Status))
             {
                 if (Status == AE_TYPE)
diff --git a/sys/contrib/dev/acpica/source/components/executer/extrace.c b/sys/contrib/dev/acpica/source/components/executer/extrace.c
index 6f8a707..6eaf6e7 100644
--- a/sys/contrib/dev/acpica/source/components/executer/extrace.c
+++ b/sys/contrib/dev/acpica/source/components/executer/extrace.c
@@ -226,7 +226,6 @@ AcpiExStartTraceMethod (
     ACPI_OPERAND_OBJECT     *ObjDesc,
     ACPI_WALK_STATE         *WalkState)
 {
-    ACPI_STATUS             Status;
     char                    *Pathname = NULL;
     BOOLEAN                 Enabled = FALSE;
 
@@ -239,12 +238,6 @@ AcpiExStartTraceMethod (
         Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
     }
 
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        goto Exit;
-    }
-
     Enabled = AcpiExInterpreterTraceEnabled (Pathname);
     if (Enabled && !AcpiGbl_TraceMethodObject)
     {
@@ -265,9 +258,6 @@ AcpiExStartTraceMethod (
         }
     }
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-Exit:
     if (Enabled)
     {
         ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE,
@@ -302,7 +292,6 @@ AcpiExStopTraceMethod (
     ACPI_OPERAND_OBJECT     *ObjDesc,
     ACPI_WALK_STATE         *WalkState)
 {
-    ACPI_STATUS             Status;
     char                    *Pathname = NULL;
     BOOLEAN                 Enabled;
 
@@ -315,28 +304,14 @@ AcpiExStopTraceMethod (
         Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
     }
 
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        goto ExitPath;
-    }
-
     Enabled = AcpiExInterpreterTraceEnabled (NULL);
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
     if (Enabled)
     {
         ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE,
             ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
     }
 
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        goto ExitPath;
-    }
-
     /* Check whether the tracer should be stopped */
 
     if (AcpiGbl_TraceMethodObject == ObjDesc)
@@ -353,9 +328,6 @@ AcpiExStopTraceMethod (
         AcpiGbl_TraceMethodObject = NULL;
     }
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-ExitPath:
     if (Pathname)
     {
         ACPI_FREE (Pathname);
diff --git a/sys/contrib/dev/acpica/source/components/executer/exutils.c b/sys/contrib/dev/acpica/source/components/executer/exutils.c
index 4843a20..edaee55 100644
--- a/sys/contrib/dev/acpica/source/components/executer/exutils.c
+++ b/sys/contrib/dev/acpica/source/components/executer/exutils.c
@@ -103,6 +103,11 @@ AcpiExEnterInterpreter (
     {
         ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex"));
     }
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_ERROR ((AE_INFO, "Could not acquire AML Namespace mutex"));
+    }
 
     return_VOID;
 }
@@ -141,6 +146,11 @@ AcpiExExitInterpreter (
     ACPI_FUNCTION_TRACE (ExExitInterpreter);
 
 
+    Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_ERROR ((AE_INFO, "Could not release AML Namespace mutex"));
+    }
     Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
     if (ACPI_FAILURE (Status))
     {
diff --git a/sys/contrib/dev/acpica/source/components/hardware/hwgpe.c b/sys/contrib/dev/acpica/source/components/hardware/hwgpe.c
index 3dbf10b..ac9934d 100644
--- a/sys/contrib/dev/acpica/source/components/hardware/hwgpe.c
+++ b/sys/contrib/dev/acpica/source/components/hardware/hwgpe.c
@@ -108,7 +108,7 @@ AcpiHwLowSetGpe (
     UINT32                  Action)
 {
     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
-    ACPI_STATUS             Status;
+    ACPI_STATUS             Status = AE_OK;
     UINT32                  EnableMask;
     UINT32                  RegisterBit;
 
@@ -164,9 +164,12 @@ AcpiHwLowSetGpe (
         return (AE_BAD_PARAMETER);
     }
 
-    /* Write the updated enable mask */
+    if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
+    {
+        /* Write the updated enable mask */
 
-    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
+        Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
+    }
     return (Status);
 }
 
@@ -269,6 +272,13 @@ AcpiHwGetGpeStatus (
         LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
     }
 
+    /* GPE currently masked? (masked for runtime?) */
+
+    if (RegisterBit & GpeRegisterInfo->MaskForRun)
+    {
+        LocalEventStatus |= ACPI_EVENT_FLAG_MASKED;
+    }
+
     /* GPE enabled for wake? */
 
     if (RegisterBit & GpeRegisterInfo->EnableForWake)
@@ -440,6 +450,7 @@ AcpiHwEnableRuntimeGpeBlock (
     UINT32                  i;
     ACPI_STATUS             Status;
     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
+    UINT8                   EnableMask;
 
 
     /* NOTE: assumes that all GPEs are currently disabled */
@@ -456,8 +467,9 @@ AcpiHwEnableRuntimeGpeBlock (
 
         /* Enable all "runtime" GPEs in this register */
 
-        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun,
-            GpeRegisterInfo);
+        EnableMask = GpeRegisterInfo->EnableForRun &
+            ~GpeRegisterInfo->MaskForRun;
+        Status = AcpiHwGpeEnableWrite (EnableMask, GpeRegisterInfo);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsconvert.c b/sys/contrib/dev/acpica/source/components/namespace/nsconvert.c
index 2fa182e..7ce98a5 100644
--- a/sys/contrib/dev/acpica/source/components/namespace/nsconvert.c
+++ b/sys/contrib/dev/acpica/source/components/namespace/nsconvert.c
@@ -84,7 +84,7 @@ AcpiNsConvertToInteger (
         /* String-to-Integer conversion */
 
         Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
-            ACPI_ANY_BASE, AcpiGbl_IntegerByteWidth, &Value);
+            AcpiGbl_IntegerByteWidth, &Value);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsload.c b/sys/contrib/dev/acpica/source/components/namespace/nsload.c
index 9c899e7..6e11d6b 100644
--- a/sys/contrib/dev/acpica/source/components/namespace/nsload.c
+++ b/sys/contrib/dev/acpica/source/components/namespace/nsload.c
@@ -46,6 +46,7 @@
 #include "acnamesp.h"
 #include "acdispat.h"
 #include "actables.h"
+#include "acinterp.h"
 
 
 #define _COMPONENT          ACPI_NAMESPACE
@@ -89,21 +90,6 @@ AcpiNsLoadTable (
     ACPI_FUNCTION_TRACE (NsLoadTable);
 
 
-    /*
-     * Parse the table and load the namespace with all named
-     * objects found within. Control methods are NOT parsed
-     * at this time. In fact, the control methods cannot be
-     * parsed until the entire namespace is loaded, because
-     * if a control method makes a forward reference (call)
-     * to another control method, we can't continue parsing
-     * because we don't know how many arguments to parse next!
-     */
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
     /* If table already loaded into namespace, just return */
 
     if (AcpiTbIsTableLoaded (TableIndex))
@@ -121,6 +107,15 @@ AcpiNsLoadTable (
         goto Unlock;
     }
 
+    /*
+     * Parse the table and load the namespace with all named
+     * objects found within. Control methods are NOT parsed
+     * at this time. In fact, the control methods cannot be
+     * parsed until the entire namespace is loaded, because
+     * if a control method makes a forward reference (call)
+     * to another control method, we can't continue parsing
+     * because we don't know how many arguments to parse next!
+     */
     Status = AcpiNsParseTable (TableIndex, Node);
     if (ACPI_SUCCESS (Status))
     {
@@ -137,7 +132,6 @@ AcpiNsLoadTable (
          * exist. This target of Scope must already exist in the
          * namespace, as per the ACPI specification.
          */
-        (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
         AcpiNsDeleteNamespaceByOwner (
             AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
 
@@ -146,8 +140,6 @@ AcpiNsLoadTable (
     }
 
 Unlock:
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -180,7 +172,7 @@ Unlock:
      * other ACPI implementations. Optionally, the execution can be deferred
      * until later, see AcpiInitializeObjects.
      */
-    if (!AcpiGbl_GroupModuleLevelCode)
+    if (!AcpiGbl_ParseTableAsTermList && !AcpiGbl_GroupModuleLevelCode)
     {
         AcpiNsExecModuleCodeList ();
     }
diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsparse.c b/sys/contrib/dev/acpica/source/components/namespace/nsparse.c
index 1ff3336..95f6da6 100644
--- a/sys/contrib/dev/acpica/source/components/namespace/nsparse.c
+++ b/sys/contrib/dev/acpica/source/components/namespace/nsparse.c
@@ -47,6 +47,7 @@
 #include "acparser.h"
 #include "acdispat.h"
 #include "actables.h"
+#include "acinterp.h"
 
 
 #define _COMPONENT          ACPI_NAMESPACE
@@ -55,6 +56,109 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    NsExecuteTable
+ *
+ * PARAMETERS:  TableDesc       - An ACPI table descriptor for table to parse
+ *              StartNode       - Where to enter the table into the namespace
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load ACPI/AML table by executing the entire table as a
+ *              TermList.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsExecuteTable (
+    UINT32                  TableIndex,
+    ACPI_NAMESPACE_NODE     *StartNode)
+{
+    ACPI_STATUS             Status;
+    ACPI_TABLE_HEADER       *Table;
+    ACPI_OWNER_ID           OwnerId;
+    ACPI_EVALUATE_INFO      *Info = NULL;
+    UINT32                  AmlLength;
+    UINT8                   *AmlStart;
+    ACPI_OPERAND_OBJECT     *MethodObj = NULL;
+
+
+    ACPI_FUNCTION_TRACE (NsExecuteTable);
+
+
+    Status = AcpiGetTableByIndex (TableIndex, &Table);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Table must consist of at least a complete header */
+
+    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+    {
+        return_ACPI_STATUS (AE_BAD_HEADER);
+    }
+
+    AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+
+    Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    /* Create, initialize, and link a new temporary method object */
+
+    MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+    if (!MethodObj)
+    {
+        return_ACPI_STATUS (AE_NO_MEMORY);
+    }
+
+    /* Allocate the evaluation information block */
+
+    Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+    if (!Info)
+    {
+        Status = AE_NO_MEMORY;
+        goto Cleanup;
+    }
+
+    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+        "Create table code block: %p\n", MethodObj));
+
+    MethodObj->Method.AmlStart = AmlStart;
+    MethodObj->Method.AmlLength = AmlLength;
+    MethodObj->Method.OwnerId = OwnerId;
+    MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL;
+
+    Info->PassNumber = ACPI_IMODE_EXECUTE;
+    Info->Node = StartNode;
+    Info->ObjDesc = MethodObj;
+    Info->NodeFlags = Info->Node->Flags;
+    Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
+    if (!Info->FullPathname)
+    {
+        Status = AE_NO_MEMORY;
+        goto Cleanup;
+    }
+
+    Status = AcpiPsExecuteTable (Info);
+
+Cleanup:
+    if (Info)
+    {
+        ACPI_FREE (Info->FullPathname);
+        Info->FullPathname = NULL;
+    }
+    ACPI_FREE (Info);
+    AcpiUtRemoveReference (MethodObj);
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    NsOneCompleteParse
  *
  * PARAMETERS:  PassNumber              - 1 or 2
@@ -156,7 +260,9 @@ AcpiNsOneCompleteParse (
 
     ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
         "*PARSE* pass %u parse\n", PassNumber));
+    AcpiExEnterInterpreter ();
     Status = AcpiPsParseAml (WalkState);
+    AcpiExExitInterpreter ();
 
 Cleanup:
     AcpiPsDeleteParseTree (ParseRoot);
@@ -188,40 +294,53 @@ AcpiNsParseTable (
     ACPI_FUNCTION_TRACE (NsParseTable);
 
 
-    /*
-     * AML Parse, pass 1
-     *
-     * In this pass, we load most of the namespace. Control methods
-     * are not parsed until later. A parse tree is not created. Instead,
-     * each Parser Op subtree is deleted when it is finished. This saves
-     * a great deal of memory, and allows a small cache of parse objects
-     * 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 (ACPI_IMODE_LOAD_PASS1,
-        TableIndex, StartNode);
-    if (ACPI_FAILURE (Status))
+    if (AcpiGbl_ParseTableAsTermList)
     {
-        return_ACPI_STATUS (Status);
-    }
+        ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start load pass\n"));
 
-    /*
-     * AML Parse, pass 2
-     *
-     * In this pass, we resolve forward references and other things
-     * that could not be completed during the first pass.
-     * Another complete parse of the AML is performed, but the
-     * 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 (ACPI_IMODE_LOAD_PASS2,
-        TableIndex, StartNode);
-    if (ACPI_FAILURE (Status))
+        Status = AcpiNsExecuteTable (TableIndex, StartNode);
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
+    }
+    else
     {
-        return_ACPI_STATUS (Status);
+        /*
+         * AML Parse, pass 1
+         *
+         * In this pass, we load most of the namespace. Control methods
+         * are not parsed until later. A parse tree is not created.
+         * Instead, each Parser Op subtree is deleted when it is finished.
+         * This saves a great deal of memory, and allows a small cache of
+         * parse objects 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 (ACPI_IMODE_LOAD_PASS1,
+            TableIndex, StartNode);
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
+
+        /*
+         * AML Parse, pass 2
+         *
+         * In this pass, we resolve forward references and other things
+         * that could not be completed during the first pass.
+         * Another complete parse of the AML is performed, but the
+         * 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 (ACPI_IMODE_LOAD_PASS2,
+            TableIndex, StartNode);
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
     }
 
     return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsutils.c b/sys/contrib/dev/acpica/source/components/namespace/nsutils.c
index 72f9105..2dafae4 100644
--- a/sys/contrib/dev/acpica/source/components/namespace/nsutils.c
+++ b/sys/contrib/dev/acpica/source/components/namespace/nsutils.c
@@ -771,7 +771,7 @@ AcpiNsOpensScope (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiNsGetNode
+ * FUNCTION:    AcpiNsGetNodeUnlocked
  *
  * PARAMETERS:  *Pathname   - Name to be found, in external (ASL) format. The
  *                            \ (backslash) and ^ (carat) prefixes, and the
@@ -787,12 +787,12 @@ AcpiNsOpensScope (
  * DESCRIPTION: Look up a name relative to a given scope and return the
  *              corresponding Node. NOTE: Scope can be null.
  *
- * MUTEX:       Locks namespace
+ * MUTEX:       Doesn't locks namespace
  *
  ******************************************************************************/
 
 ACPI_STATUS
-AcpiNsGetNode (
+AcpiNsGetNodeUnlocked (
     ACPI_NAMESPACE_NODE     *PrefixNode,
     const char              *Pathname,
     UINT32                  Flags,
@@ -803,7 +803,7 @@ AcpiNsGetNode (
     char                    *InternalPath;
 
 
-    ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
+    ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname));
 
 
     /* Simplest case is a null pathname */
@@ -835,14 +835,6 @@ AcpiNsGetNode (
         return_ACPI_STATUS (Status);
     }
 
-    /* Must lock namespace during lookup */
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        goto Cleanup;
-    }
-
     /* Setup lookup scope (search starting point) */
 
     ScopeInfo.Scope.Node = PrefixNode;
@@ -858,9 +850,55 @@ AcpiNsGetNode (
             Pathname, AcpiFormatException (Status)));
     }
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-Cleanup:
     ACPI_FREE (InternalPath);
     return_ACPI_STATUS (Status);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiNsGetNode
+ *
+ * PARAMETERS:  *Pathname   - Name to be found, in external (ASL) format. The
+ *                            \ (backslash) and ^ (carat) prefixes, and the
+ *                            . (period) to separate segments are supported.
+ *              PrefixNode   - Root of subtree to be searched, or NS_ALL for the
+ *                            root of the name space. If Name is fully
+ *                            qualified (first INT8 is '\'), the passed value
+ *                            of Scope will not be accessed.
+ *              Flags       - Used to indicate whether to perform upsearch or
+ *                            not.
+ *              ReturnNode  - Where the Node is returned
+ *
+ * DESCRIPTION: Look up a name relative to a given scope and return the
+ *              corresponding Node. NOTE: Scope can be null.
+ *
+ * MUTEX:       Locks namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsGetNode (
+    ACPI_NAMESPACE_NODE     *PrefixNode,
+    const char              *Pathname,
+    UINT32                  Flags,
+    ACPI_NAMESPACE_NODE     **ReturnNode)
+{
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
+
+
+    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname,
+        Flags, ReturnNode);
+
+    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+    return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/source/components/parser/psparse.c b/sys/contrib/dev/acpica/source/components/parser/psparse.c
index 810d97e..8f23032 100644
--- a/sys/contrib/dev/acpica/source/components/parser/psparse.c
+++ b/sys/contrib/dev/acpica/source/components/parser/psparse.c
@@ -555,8 +555,10 @@ AcpiPsParseAml (
         {
             /* Either the method parse or actual execution failed */
 
+            AcpiExExitInterpreter ();
             ACPI_ERROR_METHOD ("Method parse/execution failed",
                 WalkState->MethodNode, NULL, Status);
+            AcpiExEnterInterpreter ();
 
             /* Check for possible multi-thread reentrancy problem */
 
@@ -589,7 +591,8 @@ AcpiPsParseAml (
          * cleanup to do
          */
         if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
-            ACPI_PARSE_EXECUTE) ||
+            ACPI_PARSE_EXECUTE &&
+            !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) ||
             (ACPI_FAILURE (Status)))
         {
             AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
diff --git a/sys/contrib/dev/acpica/source/components/parser/psxface.c b/sys/contrib/dev/acpica/source/components/parser/psxface.c
index a6fe316..c85f0e9 100644
--- a/sys/contrib/dev/acpica/source/components/parser/psxface.c
+++ b/sys/contrib/dev/acpica/source/components/parser/psxface.c
@@ -275,6 +275,88 @@ Cleanup:
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiPsExecuteTable
+ *
+ * PARAMETERS:  Info            - Method info block, contains:
+ *              Node            - Node to where the is entered into the
+ *                                namespace
+ *              ObjDesc         - Pseudo method object describing the AML
+ *                                code of the entire table
+ *              PassNumber      - Parse or execute pass
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Execute a table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsExecuteTable (
+    ACPI_EVALUATE_INFO      *Info)
+{
+    ACPI_STATUS             Status;
+    ACPI_PARSE_OBJECT       *Op = NULL;
+    ACPI_WALK_STATE         *WalkState = NULL;
+
+
+    ACPI_FUNCTION_TRACE (PsExecuteTable);
+
+
+    /* Create and init a Root Node */
+
+    Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
+    if (!Op)
+    {
+        Status = AE_NO_MEMORY;
+        goto Cleanup;
+    }
+
+    /* Create and initialize a new walk state */
+
+    WalkState = AcpiDsCreateWalkState (
+        Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
+    if (!WalkState)
+    {
+        Status = AE_NO_MEMORY;
+        goto Cleanup;
+    }
+
+    Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
+        Info->ObjDesc->Method.AmlStart,
+        Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
+    if (ACPI_FAILURE (Status))
+    {
+        goto Cleanup;
+    }
+
+    if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
+    {
+        WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
+    }
+
+    /*
+     * Parse the AML, WalkState will be deleted by ParseAml
+     */
+    AcpiExEnterInterpreter ();
+    Status = AcpiPsParseAml (WalkState);
+    AcpiExExitInterpreter ();
+    WalkState = NULL;
+
+Cleanup:
+    if (WalkState)
+    {
+        AcpiDsDeleteWalkState (WalkState);
+    }
+    if (Op)
+    {
+        AcpiPsDeleteParseTree (Op);
+    }
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiPsUpdateParameterList
  *
  * PARAMETERS:  Info            - See ACPI_EVALUATE_INFO
diff --git a/sys/contrib/dev/acpica/source/components/tables/tbdata.c b/sys/contrib/dev/acpica/source/components/tables/tbdata.c
index 31fa25b..11164e2 100644
--- a/sys/contrib/dev/acpica/source/components/tables/tbdata.c
+++ b/sys/contrib/dev/acpica/source/components/tables/tbdata.c
@@ -45,6 +45,7 @@
 #include "accommon.h"
 #include "acnamesp.h"
 #include "actables.h"
+#include "acevents.h"
 
 #define _COMPONENT          ACPI_TABLES
         ACPI_MODULE_NAME    ("tbdata")
@@ -867,3 +868,160 @@ AcpiTbSetTableLoadedFlag (
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiTbLoadTable
+ *
+ * PARAMETERS:  TableIndex              - Table index
+ *              ParentNode              - Where table index is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Load an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbLoadTable (
+    UINT32                  TableIndex,
+    ACPI_NAMESPACE_NODE     *ParentNode)
+{
+    ACPI_TABLE_HEADER       *Table;
+    ACPI_STATUS             Status;
+    ACPI_OWNER_ID           OwnerId;
+
+
+    ACPI_FUNCTION_TRACE (TbLoadTable);
+
+
+    /*
+     * Note: Now table is "INSTALLED", it must be validated before
+     * using.
+     */
+    Status = AcpiGetTableByIndex (TableIndex, &Table);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
+    Status = AcpiNsLoadTable (TableIndex, ParentNode);
+
+    /* Execute any module-level code that was found in the table */
+
+    if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
+    {
+        AcpiNsExecModuleCodeList ();
+    }
+
+    /*
+     * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
+     * responsible for discovering any new wake GPEs by running _PRW methods
+     * that may have been loaded by this table.
+     */
+    Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+    if (ACPI_SUCCESS (Status))
+    {
+        AcpiEvUpdateGpes (OwnerId);
+    }
+
+    /* Invoke table handler if present */
+
+    if (AcpiGbl_TableHandler)
+    {
+        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
+            AcpiGbl_TableHandlerContext);
+    }
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiTbInstallAndLoadTable
+ *
+ * PARAMETERS:  Table                   - Pointer to the table
+ *              Address                 - Physical address of the table
+ *              Flags                   - Allocation flags of the table
+ *              TableIndex              - Where table index is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Install and load an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbInstallAndLoadTable (
+    ACPI_TABLE_HEADER       *Table,
+    ACPI_PHYSICAL_ADDRESS   Address,
+    UINT8                   Flags,
+    BOOLEAN                 Override,
+    UINT32                  *TableIndex)
+{
+    ACPI_STATUS             Status;
+    UINT32                  i;
+    ACPI_OWNER_ID           OwnerId;
+
+
+    ACPI_FUNCTION_TRACE (AcpiLoadTable);
+
+
+    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+    /* Install the table and load it into the namespace */
+
+    Status = AcpiTbInstallStandardTable (Address, Flags, TRUE,
+        Override, &i);
+    if (ACPI_FAILURE (Status))
+    {
+        goto UnlockAndExit;
+    }
+
+    /*
+     * Note: Now table is "INSTALLED", it must be validated before
+     * using.
+     */
+    Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
+    if (ACPI_FAILURE (Status))
+    {
+        goto UnlockAndExit;
+    }
+
+    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+    Status = AcpiNsLoadTable (i, AcpiGbl_RootNode);
+
+    /* Execute any module-level code that was found in the table */
+
+    if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
+    {
+        AcpiNsExecModuleCodeList ();
+    }
+
+    /*
+     * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
+     * responsible for discovering any new wake GPEs by running _PRW methods
+     * that may have been loaded by this table.
+     */
+    Status = AcpiTbGetOwnerId (i, &OwnerId);
+    if (ACPI_SUCCESS (Status))
+    {
+        AcpiEvUpdateGpes (OwnerId);
+    }
+
+    /* Invoke table handler if present */
+
+    if (AcpiGbl_TableHandler)
+    {
+        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
+            AcpiGbl_TableHandlerContext);
+    }
+    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+UnlockAndExit:
+    *TableIndex = i;
+    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+    return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/source/components/tables/tbfadt.c b/sys/contrib/dev/acpica/source/components/tables/tbfadt.c
index ba49633..b75b52d 100644
--- a/sys/contrib/dev/acpica/source/components/tables/tbfadt.c
+++ b/sys/contrib/dev/acpica/source/components/tables/tbfadt.c
@@ -375,8 +375,10 @@ AcpiTbParseFadt (
 
     /* Obtain the DSDT and FACS tables via their addresses within the FADT */
 
-    AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
-        ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex);
+    AcpiTbInstallStandardTable (
+        (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
+        ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+        &AcpiGbl_DsdtIndex);
 
     /* If Hardware Reduced flag is set, there is no FACS */
 
@@ -384,13 +386,17 @@ AcpiTbParseFadt (
     {
         if (AcpiGbl_FADT.Facs)
         {
-            AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
-                ACPI_SIG_FACS, &AcpiGbl_FacsIndex);
+            AcpiTbInstallStandardTable (
+                (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
+                ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+                &AcpiGbl_FacsIndex);
         }
         if (AcpiGbl_FADT.XFacs)
         {
-            AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
-                ACPI_SIG_FACS, &AcpiGbl_XFacsIndex);
+            AcpiTbInstallStandardTable (
+                (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
+                ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+                &AcpiGbl_XFacsIndex);
         }
     }
 }
@@ -593,65 +599,67 @@ AcpiTbConvertFadt (
          *
          * Address32 zero, Address64 [don't care]   - Use Address64
          *
+         * No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and:
          * Address32 non-zero, Address64 zero       - Copy/use Address32
          * Address32 non-zero == Address64 non-zero - Use Address64
          * Address32 non-zero != Address64 non-zero - Warning, use Address64
          *
          * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
+         * Address32 non-zero, Address64 zero       - Copy/use Address32
+         * Address32 non-zero == Address64 non-zero - Copy/use Address32
          * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
          *
          * Note: SpaceId is always I/O for 32-bit legacy address fields
          */
         if (Address32)
         {
-            if (!Address64->Address)
-            {
-                /* 64-bit address is zero, use 32-bit address */
-
-                AcpiTbInitGenericAddress (Address64,
-                    ACPI_ADR_SPACE_SYSTEM_IO,
-                    *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
-                        FadtInfoTable[i].Length),
-                    (UINT64) Address32, Name, Flags);
-            }
-            else if (Address64->Address != (UINT64) Address32)
+            if (Address64->Address)
             {
-                /* Address mismatch */
-
-                ACPI_BIOS_WARNING ((AE_INFO,
-                    "32/64X address mismatch in FADT/%s: "
-                    "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
-                    Name, Address32,
-                    ACPI_FORMAT_UINT64 (Address64->Address),
-                    AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
-
-                if (AcpiGbl_Use32BitFadtAddresses)
+                if (Address64->Address != (UINT64) Address32)
                 {
-                    /* 32-bit address override */
+                    /* Address mismatch */
+
+                    ACPI_BIOS_WARNING ((AE_INFO,
+                        "32/64X address mismatch in FADT/%s: "
+                        "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
+                        Name, Address32,
+                        ACPI_FORMAT_UINT64 (Address64->Address),
+                        AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
+                }
 
-                    AcpiTbInitGenericAddress (Address64,
-                        ACPI_ADR_SPACE_SYSTEM_IO,
-                        *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
-                            FadtInfoTable[i].Length),
-                        (UINT64) Address32, Name, Flags);
+                /*
+                 * For each extended field, check for length mismatch
+                 * between the legacy length field and the corresponding
+                 * 64-bit X length field.
+                 * Note: If the legacy length field is > 0xFF bits, ignore
+                 * this check. (GPE registers can be larger than the
+                 * 64-bit GAS structure can accomodate, 0xFF bits).
+                 */
+                if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
+                    (Address64->BitWidth != ACPI_MUL_8 (Length)))
+                {
+                    ACPI_BIOS_WARNING ((AE_INFO,
+                        "32/64X length mismatch in FADT/%s: %u/%u",
+                        Name, ACPI_MUL_8 (Length), Address64->BitWidth));
                 }
             }
-        }
 
-        /*
-         * For each extended field, check for length mismatch between the
-         * legacy length field and the corresponding 64-bit X length field.
-         * Note: If the legacy length field is > 0xFF bits, ignore this
-         * check. (GPE registers can be larger than the 64-bit GAS structure
-         * can accomodate, 0xFF bits).
-         */
-        if (Address64->Address &&
-           (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
-           (Address64->BitWidth != ACPI_MUL_8 (Length)))
-        {
-            ACPI_BIOS_WARNING ((AE_INFO,
-                "32/64X length mismatch in FADT/%s: %u/%u",
-                Name, ACPI_MUL_8 (Length), Address64->BitWidth));
+            /*
+             * Hardware register access code always uses the 64-bit fields.
+             * So if the 64-bit field is zero or is to be overridden,
+             * initialize it with the 32-bit fields.
+             * Note that when the 32-bit address favor is specified, the
+             * 64-bit fields are always re-initialized so that
+             * AccessSize/BitWidth/BitOffset fields can be correctly
+             * configured to the values to trigger a 32-bit compatible
+             * access mode in the hardware register access code.
+             */
+            if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
+            {
+                AcpiTbInitGenericAddress (Address64,
+                    ACPI_ADR_SPACE_SYSTEM_IO, Length,
+                    (UINT64) Address32, Name, Flags);
+            }
         }
 
         if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED)
diff --git a/sys/contrib/dev/acpica/source/components/tables/tbfind.c b/sys/contrib/dev/acpica/source/components/tables/tbfind.c
index 32839a3..663e852 100644
--- a/sys/contrib/dev/acpica/source/components/tables/tbfind.c
+++ b/sys/contrib/dev/acpica/source/components/tables/tbfind.c
@@ -73,7 +73,7 @@ AcpiTbFindTable (
     char                    *OemTableId,
     UINT32                  *TableIndex)
 {
-    ACPI_STATUS             Status;
+    ACPI_STATUS             Status = AE_OK;
     ACPI_TABLE_HEADER       Header;
     UINT32                  i;
 
@@ -105,6 +105,7 @@ AcpiTbFindTable (
 
     /* Search for the table */
 
+    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
     {
         if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
@@ -124,7 +125,7 @@ AcpiTbFindTable (
             Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
             if (ACPI_FAILURE (Status))
             {
-                return_ACPI_STATUS (Status);
+                goto UnlockAndExit;
             }
 
             if (!AcpiGbl_RootTableList.Tables[i].Pointer)
@@ -148,9 +149,12 @@ AcpiTbFindTable (
 
             ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
                 Header.Signature));
-            return_ACPI_STATUS (AE_OK);
+            goto UnlockAndExit;
         }
     }
+    Status = AE_NOT_FOUND;
 
+UnlockAndExit:
+    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
     return_ACPI_STATUS (AE_NOT_FOUND);
 }
diff --git a/sys/contrib/dev/acpica/source/components/tables/tbinstal.c b/sys/contrib/dev/acpica/source/components/tables/tbinstal.c
index 78e8b4e..bb8f127 100644
--- a/sys/contrib/dev/acpica/source/components/tables/tbinstal.c
+++ b/sys/contrib/dev/acpica/source/components/tables/tbinstal.c
@@ -169,74 +169,6 @@ AcpiTbInstallTableWithOverride (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiTbInstallFixedTable
- *
- * PARAMETERS:  Address                 - Physical address of DSDT or FACS
- *              Signature               - Table signature, NULL if no need to
- *                                        match
- *              TableIndex              - Where the table index is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data
- *              structure.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbInstallFixedTable (
-    ACPI_PHYSICAL_ADDRESS   Address,
-    char                    *Signature,
-    UINT32                  *TableIndex)
-{
-    ACPI_TABLE_DESC         NewTableDesc;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (TbInstallFixedTable);
-
-
-    if (!Address)
-    {
-        ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
-            Signature));
-        return (AE_NO_MEMORY);
-    }
-
-    /* Fill a table descriptor for validation */
-
-    Status = AcpiTbAcquireTempTable (&NewTableDesc, Address,
-        ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X",
-            ACPI_FORMAT_UINT64 (Address)));
-        return_ACPI_STATUS (Status);
-    }
-
-    /* Validate and verify a table before installation */
-
-    Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature);
-    if (ACPI_FAILURE (Status))
-    {
-        goto ReleaseAndExit;
-    }
-
-    /* Add the table to the global root table list */
-
-    AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex);
-
-ReleaseAndExit:
-
-    /* Release the temporary table descriptor */
-
-    AcpiTbReleaseTempTable (&NewTableDesc);
-    return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
  * FUNCTION:    AcpiTbInstallStandardTable
  *
  * PARAMETERS:  Address             - Address of the table (might be a virtual
@@ -248,8 +180,7 @@ ReleaseAndExit:
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to install an ACPI table that is
- *              neither DSDT nor FACS (a "standard" table.)
+ * DESCRIPTION: This function is called to verify and install an ACPI table.
  *              When this function is called by "Load" or "LoadTable" opcodes,
  *              or by AcpiLoadTable() API, the "Reload" parameter is set.
  *              After sucessfully returning from this function, table is
@@ -390,6 +321,14 @@ AcpiTbInstallStandardTable (
 
     AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
 
+    /* Invoke table handler if present */
+
+    if (AcpiGbl_TableHandler)
+    {
+        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_INSTALL,
+            NewTableDesc.Pointer, AcpiGbl_TableHandlerContext);
+    }
+
 ReleaseAndExit:
 
     /* Release the temporary table descriptor */
diff --git a/sys/contrib/dev/acpica/source/components/tables/tbxfload.c b/sys/contrib/dev/acpica/source/components/tables/tbxfload.c
index dff97e3..de88f0a 100644
--- a/sys/contrib/dev/acpica/source/components/tables/tbxfload.c
+++ b/sys/contrib/dev/acpica/source/components/tables/tbxfload.c
@@ -111,7 +111,7 @@ AcpiLoadTables (
             "While loading namespace from ACPI tables"));
     }
 
-    if (!AcpiGbl_GroupModuleLevelCode)
+    if (AcpiGbl_ParseTableAsTermList || !AcpiGbl_GroupModuleLevelCode)
     {
         /*
          * Initialize the objects that remain uninitialized. This
@@ -207,11 +207,11 @@ AcpiTbLoadNamespace (
     memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
         sizeof (ACPI_TABLE_HEADER));
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
     /* Load and parse tables */
 
+    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
     Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
+    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
@@ -224,7 +224,6 @@ AcpiTbLoadNamespace (
 
     /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
 
-    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
     {
         Table = &AcpiGbl_RootTableList.Tables[i];
@@ -242,6 +241,7 @@ AcpiTbLoadNamespace (
 
         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
         Status =  AcpiNsLoadTable (i, AcpiGbl_RootNode);
+        (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
         if (ACPI_FAILURE (Status))
         {
             ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
@@ -257,8 +257,6 @@ AcpiTbLoadNamespace (
         {
             TablesLoaded++;
         }
-
-        (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     }
 
     if (!TablesFailed)
@@ -366,52 +364,11 @@ AcpiLoadTable (
         return_ACPI_STATUS (AE_BAD_PARAMETER);
     }
 
-    /* Must acquire the interpreter lock during this operation */
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
     /* Install the table and load it into the namespace */
 
     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
-    (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
-    Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
-        ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE,
-        &TableIndex);
-
-    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-    if (ACPI_FAILURE (Status))
-    {
-        goto UnlockAndExit;
-    }
-
-    /*
-     * Note: Now table is "INSTALLED", it must be validated before
-     * using.
-     */
-    Status = AcpiTbValidateTable (
-        &AcpiGbl_RootTableList.Tables[TableIndex]);
-    if (ACPI_FAILURE (Status))
-    {
-        goto UnlockAndExit;
-    }
-
-    Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode);
-
-    /* Invoke table handler if present */
-
-    if (AcpiGbl_TableHandler)
-    {
-        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
-            AcpiGbl_TableHandlerContext);
-    }
-
-UnlockAndExit:
-    (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
+    Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table),
+        ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
     return_ACPI_STATUS (Status);
 }
 
diff --git a/sys/contrib/dev/acpica/source/components/utilities/utaddress.c b/sys/contrib/dev/acpica/source/components/utilities/utaddress.c
index 4b36391..2bf313f 100644
--- a/sys/contrib/dev/acpica/source/components/utilities/utaddress.c
+++ b/sys/contrib/dev/acpica/source/components/utilities/utaddress.c
@@ -82,7 +82,6 @@ AcpiUtAddAddressRange (
     ACPI_NAMESPACE_NODE     *RegionNode)
 {
     ACPI_ADDRESS_RANGE      *RangeInfo;
-    ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_TRACE (UtAddAddressRange);
@@ -106,13 +105,6 @@ AcpiUtAddAddressRange (
     RangeInfo->EndAddress = (Address + Length - 1);
     RangeInfo->RegionNode = RegionNode;
 
-    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
-    if (ACPI_FAILURE (Status))
-    {
-        ACPI_FREE (RangeInfo);
-        return_ACPI_STATUS (Status);
-    }
-
     RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId];
     AcpiGbl_AddressRangeList[SpaceId] = RangeInfo;
 
@@ -122,7 +114,6 @@ AcpiUtAddAddressRange (
         ACPI_FORMAT_UINT64 (Address),
         ACPI_FORMAT_UINT64 (RangeInfo->EndAddress)));
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
     return_ACPI_STATUS (AE_OK);
 }
 
diff --git a/sys/contrib/dev/acpica/source/components/utilities/uthex.c b/sys/contrib/dev/acpica/source/components/utilities/uthex.c
index b93013b..94f6a7f 100644
--- a/sys/contrib/dev/acpica/source/components/utilities/uthex.c
+++ b/sys/contrib/dev/acpica/source/components/utilities/uthex.c
@@ -82,9 +82,46 @@ AcpiUtHexToAsciiChar (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiUtAsciiToHexByte
+ *
+ * PARAMETERS:  TwoAsciiChars               - Pointer to two ASCII characters
+ *              ReturnByte                  - Where converted byte is returned
+ *
+ * RETURN:      Status and converted hex byte
+ *
+ * DESCRIPTION: Perform ascii-to-hex translation, exactly two ASCII characters
+ *              to a single converted byte value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAsciiToHexByte (
+    char                    *TwoAsciiChars,
+    UINT8                   *ReturnByte)
+{
+
+    /* Both ASCII characters must be valid hex digits */
+
+    if (!isxdigit ((int) TwoAsciiChars[0]) ||
+        !isxdigit ((int) TwoAsciiChars[1]))
+    {
+        return (AE_BAD_HEX_CONSTANT);
+    }
+
+    *ReturnByte =
+        AcpiUtAsciiCharToHex (TwoAsciiChars[1]) |
+        (AcpiUtAsciiCharToHex (TwoAsciiChars[0]) << 4);
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiUtAsciiCharToHex
  *
- * PARAMETERS:  HexChar                 - Hex character in Ascii
+ * PARAMETERS:  HexChar                 - Hex character in Ascii. Must be:
+ *                                        0-9 or A-F or a-f
  *
  * RETURN:      The binary value of the ascii/hex character
  *
@@ -97,15 +134,21 @@ AcpiUtAsciiCharToHex (
     int                     HexChar)
 {
 
-    if (HexChar <= 0x39)
+    /* Values 0-9 */
+
+    if (HexChar <= '9')
     {
-        return ((UINT8) (HexChar - 0x30));
+        return ((UINT8) (HexChar - '0'));
     }
 
-    if (HexChar <= 0x46)
+    /* Upper case A-F */
+
+    if (HexChar <= 'F')
     {
         return ((UINT8) (HexChar - 0x37));
     }
 
+    /* Lower case a-f */
+
     return ((UINT8) (HexChar - 0x57));
 }
diff --git a/sys/contrib/dev/acpica/source/components/utilities/utnonansi.c b/sys/contrib/dev/acpica/source/components/utilities/utnonansi.c
index 70fb33e..4cddcf1 100644
--- a/sys/contrib/dev/acpica/source/components/utilities/utnonansi.c
+++ b/sys/contrib/dev/acpica/source/components/utilities/utnonansi.c
@@ -48,10 +48,9 @@
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utnonansi")
 
-
 /*
- * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
- * version of strtoul.
+ * Non-ANSI C library functions - strlwr, strupr, stricmp, and "safe"
+ * string functions.
  */
 
 /*******************************************************************************
@@ -238,430 +237,3 @@ AcpiUtSafeStrncat (
     return (FALSE);
 }
 #endif
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrtoul64
- *
- * PARAMETERS:  String                  - Null terminated string
- *              Base                    - Radix of the string: 16 or 10 or
- *                                        ACPI_ANY_BASE
- *              MaxIntegerByteWidth     - Maximum allowable integer,in bytes:
- *                                        4 or 8 (32 or 64 bits)
- *              RetInteger              - Where the converted integer is
- *                                        returned
- *
- * RETURN:      Status and Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- *              32-bit or 64-bit conversion, depending on the input integer
- *              size (often the current mode of the interpreter).
- *
- * NOTES:       Negative numbers are not supported, as they are not supported
- *              by ACPI.
- *
- *              AcpiGbl_IntegerByteWidth should be set to the proper width.
- *              For the core ACPICA code, this width depends on the DSDT
- *              version. For iASL, the default byte width is always 8 for the
- *              parser, but error checking is performed later to flag cases
- *              where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
- *
- *              Does not support Octal strings, not needed at this time.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtStrtoul64 (
-    char                    *String,
-    UINT32                  Base,
-    UINT32                  MaxIntegerByteWidth,
-    UINT64                  *RetInteger)
-{
-    UINT32                  ThisDigit = 0;
-    UINT64                  ReturnValue = 0;
-    UINT64                  Quotient;
-    UINT64                  Dividend;
-    UINT8                   ValidDigits = 0;
-    UINT8                   SignOf0x = 0;
-    UINT8                   Term = 0;
-
-
-    ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
-
-
-    switch (Base)
-    {
-    case ACPI_ANY_BASE:
-    case 10:
-    case 16:
-
-        break;
-
-    default:
-
-        /* Invalid Base */
-
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    if (!String)
-    {
-        goto ErrorExit;
-    }
-
-    /* Skip over any white space in the buffer */
-
-    while ((*String) && (isspace ((int) *String) || *String == '\t'))
-    {
-        String++;
-    }
-
-    if (Base == ACPI_ANY_BASE)
-    {
-        /*
-         * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
-         * We need to determine if it is decimal or hexadecimal.
-         */
-        if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
-        {
-            SignOf0x = 1;
-            Base = 16;
-
-            /* Skip over the leading '0x' */
-            String += 2;
-        }
-        else
-        {
-            Base = 10;
-        }
-    }
-
-    /* Any string left? Check that '0x' is not followed by white space. */
-
-    if (!(*String) || isspace ((int) *String) || *String == '\t')
-    {
-        if (Base == ACPI_ANY_BASE)
-        {
-            goto ErrorExit;
-        }
-        else
-        {
-            goto AllDone;
-        }
-    }
-
-    /*
-     * Perform a 32-bit or 64-bit conversion, depending upon the input
-     * byte width
-     */
-    Dividend = (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH) ?
-        ACPI_UINT32_MAX : ACPI_UINT64_MAX;
-
-    /* Main loop: convert the string to a 32- or 64-bit integer */
-
-    while (*String)
-    {
-        if (isdigit ((int) *String))
-        {
-            /* Convert ASCII 0-9 to Decimal value */
-
-            ThisDigit = ((UINT8) *String) - '0';
-        }
-        else if (Base == 10)
-        {
-            /* Digit is out of range; possible in ToInteger case only */
-
-            Term = 1;
-        }
-        else
-        {
-            ThisDigit = (UINT8) toupper ((int) *String);
-            if (isxdigit ((int) ThisDigit))
-            {
-                /* Convert ASCII Hex char to value */
-
-                ThisDigit = ThisDigit - 'A' + 10;
-            }
-            else
-            {
-                Term = 1;
-            }
-        }
-
-        if (Term)
-        {
-            if (Base == ACPI_ANY_BASE)
-            {
-                goto ErrorExit;
-            }
-            else
-            {
-                break;
-            }
-        }
-        else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
-        {
-            /* Skip zeros */
-            String++;
-            continue;
-        }
-
-        ValidDigits++;
-
-        if (SignOf0x && ((ValidDigits > 16) ||
-            ((ValidDigits > 8) && (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH))))
-        {
-            /*
-             * This is ToInteger operation case.
-             * No restrictions for string-to-integer conversion,
-             * see ACPI spec.
-             */
-            goto ErrorExit;
-        }
-
-        /* Divide the digit into the correct position */
-
-        (void) AcpiUtShortDivide (
-            (Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL);
-
-        if (ReturnValue > Quotient)
-        {
-            if (Base == ACPI_ANY_BASE)
-            {
-                goto ErrorExit;
-            }
-            else
-            {
-                break;
-            }
-        }
-
-        ReturnValue *= Base;
-        ReturnValue += ThisDigit;
-        String++;
-    }
-
-    /* All done, normal exit */
-
-AllDone:
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
-        ACPI_FORMAT_UINT64 (ReturnValue)));
-
-    *RetInteger = ReturnValue;
-    return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
-
-    /* Base was set/validated above (10 or 16) */
-
-    if (Base == 10)
-    {
-        return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
-    }
-    else
-    {
-        return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
-    }
-}
-
-
-#ifdef _OBSOLETE_FUNCTIONS
-/* Removed: 01/2016 */
-
-/*******************************************************************************
- *
- * FUNCTION:    strtoul64
- *
- * PARAMETERS:  String              - Null terminated string
- *              Terminater          - Where a pointer to the terminating byte
- *                                    is returned
- *              Base                - Radix of the string
- *
- * RETURN:      Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-strtoul64 (
-    char                    *String,
-    UINT32                  Base,
-    UINT64                  *RetInteger)
-{
-    UINT32                  Index;
-    UINT32                  Sign;
-    UINT64                  ReturnValue = 0;
-    ACPI_STATUS             Status = AE_OK;
-
-
-    *RetInteger = 0;
-
-    switch (Base)
-    {
-    case 0:
-    case 8:
-    case 10:
-    case 16:
-
-        break;
-
-    default:
-        /*
-         * The specified Base parameter is not in the domain of
-         * this function:
-         */
-        return (AE_BAD_PARAMETER);
-    }
-
-    /* Skip over any white space in the buffer: */
-
-    while (isspace ((int) *String) || *String == '\t')
-    {
-        ++String;
-    }
-
-    /*
-     * The buffer may contain an optional plus or minus sign.
-     * If it does, then skip over it but remember what is was:
-     */
-    if (*String == '-')
-    {
-        Sign = ACPI_SIGN_NEGATIVE;
-        ++String;
-    }
-    else if (*String == '+')
-    {
-        ++String;
-        Sign = ACPI_SIGN_POSITIVE;
-    }
-    else
-    {
-        Sign = ACPI_SIGN_POSITIVE;
-    }
-
-    /*
-     * If the input parameter Base is zero, then we need to
-     * determine if it is octal, decimal, or hexadecimal:
-     */
-    if (Base == 0)
-    {
-        if (*String == '0')
-        {
-            if (tolower ((int) *(++String)) == 'x')
-            {
-                Base = 16;
-                ++String;
-            }
-            else
-            {
-                Base = 8;
-            }
-        }
-        else
-        {
-            Base = 10;
-        }
-    }
-
-    /*
-     * For octal and hexadecimal bases, skip over the leading
-     * 0 or 0x, if they are present.
-     */
-    if (Base == 8 && *String == '0')
-    {
-        String++;
-    }
-
-    if (Base == 16 &&
-        *String == '0' &&
-        tolower ((int) *(++String)) == 'x')
-    {
-        String++;
-    }
-
-    /* Main loop: convert the string to an unsigned long */
-
-    while (*String)
-    {
-        if (isdigit ((int) *String))
-        {
-            Index = ((UINT8) *String) - '0';
-        }
-        else
-        {
-            Index = (UINT8) toupper ((int) *String);
-            if (isupper ((int) Index))
-            {
-                Index = Index - 'A' + 10;
-            }
-            else
-            {
-                goto ErrorExit;
-            }
-        }
-
-        if (Index >= Base)
-        {
-            goto ErrorExit;
-        }
-
-        /* Check to see if value is out of range: */
-
-        if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) /
-            (UINT64) Base))
-        {
-            goto ErrorExit;
-        }
-        else
-        {
-            ReturnValue *= Base;
-            ReturnValue += Index;
-        }
-
-        ++String;
-    }
-
-
-    /* If a minus sign was present, then "the conversion is negated": */
-
-    if (Sign == ACPI_SIGN_NEGATIVE)
-    {
-        ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
-    }
-
-    *RetInteger = ReturnValue;
-    return (Status);
-
-
-ErrorExit:
-    switch (Base)
-    {
-    case 8:
-
-        Status = AE_BAD_OCTAL_CONSTANT;
-        break;
-
-    case 10:
-
-        Status = AE_BAD_DECIMAL_CONSTANT;
-        break;
-
-    case 16:
-
-        Status = AE_BAD_HEX_CONSTANT;
-        break;
-
-    default:
-
-        /* Base validated above */
-
-        break;
-    }
-
-    return (Status);
-}
-#endif
diff --git a/sys/contrib/dev/acpica/source/components/utilities/utosi.c b/sys/contrib/dev/acpica/source/components/utilities/utosi.c
index 674fe36..5193af5 100644
--- a/sys/contrib/dev/acpica/source/components/utilities/utosi.c
+++ b/sys/contrib/dev/acpica/source/components/utilities/utosi.c
@@ -442,11 +442,22 @@ AcpiUtGetInterface (
  * PARAMETERS:  WalkState           - Current walk state
  *
  * RETURN:      Status
+ *              Integer: TRUE (0) if input string is matched
+ *                       FALSE (-1) if string is not matched
  *
  * DESCRIPTION: Implementation of the _OSI predefined control method. When
  *              an invocation of _OSI is encountered in the system AML,
  *              control is transferred to this function.
  *
+ * (August 2016)
+ * Note:  _OSI is now defined to return "Ones" to indicate a match, for
+ * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones
+ * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF
+ * (ACPI_UINT64_MAX).
+ *
+ * This function always returns ACPI_UINT64_MAX for TRUE, and later code
+ * will truncate this to 32 bits if necessary.
+ *
  ******************************************************************************/
 
 ACPI_STATUS
@@ -458,7 +469,7 @@ AcpiUtOsiImplementation (
     ACPI_INTERFACE_INFO     *InterfaceInfo;
     ACPI_INTERFACE_HANDLER  InterfaceHandler;
     ACPI_STATUS             Status;
-    UINT32                  ReturnValue;
+    UINT64                  ReturnValue;
 
 
     ACPI_FUNCTION_TRACE (UtOsiImplementation);
@@ -507,7 +518,7 @@ AcpiUtOsiImplementation (
             AcpiGbl_OsiData = InterfaceInfo->Value;
         }
 
-        ReturnValue = ACPI_UINT32_MAX;
+        ReturnValue = ACPI_UINT64_MAX;
     }
 
     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
@@ -520,8 +531,11 @@ AcpiUtOsiImplementation (
     InterfaceHandler = AcpiGbl_InterfaceHandler;
     if (InterfaceHandler)
     {
-        ReturnValue = InterfaceHandler (
-            StringDesc->String.Pointer, ReturnValue);
+        if (InterfaceHandler (
+            StringDesc->String.Pointer, (UINT32) ReturnValue))
+        {
+            ReturnValue = ACPI_UINT64_MAX;
+        }
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
diff --git a/sys/contrib/dev/acpica/source/components/utilities/utstrtoul64.c b/sys/contrib/dev/acpica/source/components/utilities/utstrtoul64.c
new file mode 100644
index 0000000..96cf112
--- /dev/null
+++ b/sys/contrib/dev/acpica/source/components/utilities/utstrtoul64.c
@@ -0,0 +1,390 @@
+/*******************************************************************************
+ *
+ * Module Name: utstrtoul64 - string to 64-bit integer support
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+
+
+/*******************************************************************************
+ *
+ * The functions in this module satisfy the need for 64-bit string-to-integer
+ * conversions on both 32-bit and 64-bit platforms.
+ *
+ ******************************************************************************/
+
+#define _COMPONENT          ACPI_UTILITIES
+        ACPI_MODULE_NAME    ("utstrtoul64")
+
+/* Local prototypes */
+
+static UINT64
+AcpiUtStrtoulBase10 (
+    char                    *String,
+    UINT32                  Flags);
+
+static UINT64
+AcpiUtStrtoulBase16 (
+    char                    *String,
+    UINT32                  Flags);
+
+
+/*******************************************************************************
+ *
+ * String conversion rules as written in the ACPI specification. The error
+ * conditions and behavior are different depending on the type of conversion.
+ *
+ *
+ * Implicit data type conversion: string-to-integer
+ * --------------------------------------------------
+ *
+ * Base is always 16. This is the ACPI_STRTOUL_BASE16 case.
+ *
+ * Example:
+ *      Add ("BA98", Arg0, Local0)
+ *
+ * The integer is initialized to the value zero.
+ * The ASCII string is interpreted as a hexadecimal constant.
+ *
+ *  1)  A “0x” prefix is not allowed. However, ACPICA allows this for
+ *      compatibility with previous ACPICA. (NO ERROR)
+ *
+ *  2)  Terminates when the size of an integer is reached (32 or 64 bits).
+ *      (NO ERROR)
+ *
+ *  3)  The first non-hex character terminates the conversion without error.
+ *      (NO ERROR)
+ *
+ *  4)  Conversion of a null (zero-length) string to an integer is not
+ *      allowed. However, ACPICA allows this for compatibility with previous
+ *      ACPICA. This conversion returns the value 0. (NO ERROR)
+ *
+ *
+ * Explicit data type conversion:  ToInteger() with string operand
+ * ---------------------------------------------------------------
+ *
+ * Base is either 10 (default) or 16 (with 0x prefix)
+ *
+ * Examples:
+ *      ToInteger ("1000")
+ *      ToInteger ("0xABCD")
+ *
+ *  1)  Can be (must be) either a decimal or hexadecimal numeric string.
+ *      A hex value must be prefixed by "0x" or it is interpreted as a decimal.
+ *
+ *  2)  The value must not exceed the maximum of an integer value. ACPI spec
+ *      states the behavior is "unpredictable", so ACPICA matches the behavior
+ *      of the implicit conversion case.(NO ERROR)
+ *
+ *  3)  Behavior on the first non-hex character is not specified by the ACPI
+ *      spec, so ACPICA matches the behavior of the implicit conversion case
+ *      and terminates. (NO ERROR)
+ *
+ *  4)  A null (zero-length) string is illegal.
+ *      However, ACPICA allows this for compatibility with previous ACPICA.
+ *      This conversion returns the value 0. (NO ERROR)
+ *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrtoul64
+ *
+ * PARAMETERS:  String                  - Null terminated input string
+ *              Flags                   - Conversion info, see below
+ *              ReturnValue             - Where the converted integer is
+ *                                        returned
+ *
+ * RETURN:      Status and Converted value
+ *
+ * DESCRIPTION: Convert a string into an unsigned value. Performs either a
+ *              32-bit or 64-bit conversion, depending on the input integer
+ *              size in Flags (often the current mode of the interpreter).
+ *
+ * Values for Flags:
+ *      ACPI_STRTOUL_32BIT      - Max integer value is 32 bits
+ *      ACPI_STRTOUL_64BIT      - Max integer value is 64 bits
+ *      ACPI_STRTOUL_BASE16     - Input string is hexadecimal. Default
+ *                                is 10/16 based on string prefix (0x).
+ *
+ * NOTES:
+ *   Negative numbers are not supported, as they are not supported by ACPI.
+ *
+ *   Supports only base 16 or base 10 strings/values. Does not
+ *   support Octal strings, as these are not supported by ACPI.
+ *
+ * Current users of this support:
+ *
+ *  Interpreter - Implicit and explicit conversions, GPE method names
+ *  Debugger    - Command line input string conversion
+ *  iASL        - Main parser, conversion of constants to integers
+ *  iASL        - Data Table Compiler parser (constant math expressions)
+ *  iASL        - Preprocessor (constant math expressions)
+ *  AcpiDump    - Input table addresses
+ *  AcpiExec    - Testing of the AcpiUtStrtoul64 function
+ *
+ * Note concerning callers:
+ *   AcpiGbl_IntegerByteWidth can be used to set the 32/64 limit. If used,
+ *   this global should be set to the proper width. For the core ACPICA code,
+ *   this width depends on the DSDT version. For iASL, the default byte
+ *   width is always 8 for the parser, but error checking is performed later
+ *   to flag cases where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+    char                    *String,
+    UINT32                  Flags,
+    UINT64                  *ReturnValue)
+{
+    ACPI_STATUS             Status = AE_OK;
+    UINT32                  Base;
+
+
+    ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
+
+
+    /* Parameter validation */
+
+    if (!String || !ReturnValue)
+    {
+        return_ACPI_STATUS (AE_BAD_PARAMETER);
+    }
+
+    *ReturnValue = 0;
+
+    /* Check for zero-length string, returns 0 */
+
+    if (*String == 0)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
+
+    /* Skip over any white space at start of string */
+
+    while (isspace ((int) *String))
+    {
+        String++;
+    }
+
+    /* End of string? return 0 */
+
+    if (*String == 0)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
+
+    /*
+     * 1) The "0x" prefix indicates base 16. Per the ACPI specification,
+     * the "0x" prefix is only allowed for implicit (non-strict) conversions.
+     * However, we always allow it for compatibility with older ACPICA.
+     */
+    if ((*String == ACPI_ASCII_ZERO) &&
+        (tolower ((int) *(String + 1)) == 'x'))
+    {
+        String += 2;    /* Go past the 0x */
+        if (*String == 0)
+        {
+            return_ACPI_STATUS (AE_OK);     /* Return value 0 */
+        }
+
+        Base = 16;
+    }
+
+    /* 2) Force to base 16 (implicit conversion case) */
+
+    else if (Flags & ACPI_STRTOUL_BASE16)
+    {
+        Base = 16;
+    }
+
+    /* 3) Default fallback is to Base 10 */
+
+    else
+    {
+        Base = 10;
+    }
+
+    /* Skip all leading zeros */
+
+    while (*String == ACPI_ASCII_ZERO)
+    {
+        String++;
+        if (*String == 0)
+        {
+            return_ACPI_STATUS (AE_OK);     /* Return value 0 */
+        }
+    }
+
+    /* Perform the base 16 or 10 conversion */
+
+    if (Base == 16)
+    {
+        *ReturnValue = AcpiUtStrtoulBase16 (String, Flags);
+    }
+    else
+    {
+        *ReturnValue = AcpiUtStrtoulBase10 (String, Flags);
+    }
+
+    return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrtoulBase10
+ *
+ * PARAMETERS:  String                  - Null terminated input string
+ *              Flags                   - Conversion info
+ *
+ * RETURN:      64-bit converted integer
+ *
+ * DESCRIPTION: Performs a base 10 conversion of the input string to an
+ *              integer value, either 32 or 64 bits.
+ *              Note: String must be valid and non-null.
+ *
+ ******************************************************************************/
+
+static UINT64
+AcpiUtStrtoulBase10 (
+    char                    *String,
+    UINT32                  Flags)
+{
+    int                     AsciiDigit;
+    UINT64                  NextValue;
+    UINT64                  ReturnValue = 0;
+
+
+    /* Main loop: convert each ASCII byte in the input string */
+
+    while (*String)
+    {
+        AsciiDigit = *String;
+        if (!isdigit (AsciiDigit))
+        {
+            /* Not ASCII 0-9, terminate */
+
+            goto Exit;
+        }
+
+        /* Convert and insert (add) the decimal digit */
+
+        NextValue =
+            (ReturnValue * 10) + (AsciiDigit - ACPI_ASCII_ZERO);
+
+        /* Check for overflow (32 or 64 bit) - return current converted value */
+
+        if (((Flags & ACPI_STRTOUL_32BIT) && (NextValue > ACPI_UINT32_MAX)) ||
+            (NextValue < ReturnValue)) /* 64-bit overflow case */
+        {
+            goto Exit;
+        }
+
+        ReturnValue = NextValue;
+        String++;
+    }
+
+Exit:
+    return (ReturnValue);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrtoulBase16
+ *
+ * PARAMETERS:  String                  - Null terminated input string
+ *              Flags                   - conversion info
+ *
+ * RETURN:      64-bit converted integer
+ *
+ * DESCRIPTION: Performs a base 16 conversion of the input string to an
+ *              integer value, either 32 or 64 bits.
+ *              Note: String must be valid and non-null.
+ *
+ ******************************************************************************/
+
+static UINT64
+AcpiUtStrtoulBase16 (
+    char                    *String,
+    UINT32                  Flags)
+{
+    int                     AsciiDigit;
+    UINT32                  ValidDigits = 1;
+    UINT64                  ReturnValue = 0;
+
+
+    /* Main loop: convert each ASCII byte in the input string */
+
+    while (*String)
+    {
+        /* Check for overflow (32 or 64 bit) - return current converted value */
+
+        if ((ValidDigits > 16) ||
+            ((ValidDigits > 8) && (Flags & ACPI_STRTOUL_32BIT)))
+        {
+            goto Exit;
+        }
+
+        AsciiDigit = *String;
+        if (!isxdigit (AsciiDigit))
+        {
+            /* Not Hex ASCII A-F, a-f, or 0-9, terminate */
+
+            goto Exit;
+        }
+
+        /* Convert and insert the hex digit */
+
+        ReturnValue =
+            (ReturnValue << 4) | AcpiUtAsciiCharToHex (AsciiDigit);
+
+        String++;
+        ValidDigits++;
+    }
+
+Exit:
+    return (ReturnValue);
+}
diff --git a/sys/contrib/dev/acpica/source/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/source/components/utilities/utxfinit.c
index 7d77588..6b79e08 100644
--- a/sys/contrib/dev/acpica/source/components/utilities/utxfinit.c
+++ b/sys/contrib/dev/acpica/source/components/utilities/utxfinit.c
@@ -293,7 +293,7 @@ AcpiInitializeObjects (
      * all of the tables have been loaded. It is a legacy option and is
      * not compatible with other ACPI implementations. See AcpiNsLoadTable.
      */
-    if (AcpiGbl_GroupModuleLevelCode)
+    if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
     {
         AcpiNsExecModuleCodeList ();
 
diff --git a/sys/contrib/dev/acpica/source/include/acdebug.h b/sys/contrib/dev/acpica/source/include/acdebug.h
index 8f3f471..6dfa8a2 100644
--- a/sys/contrib/dev/acpica/source/include/acdebug.h
+++ b/sys/contrib/dev/acpica/source/include/acdebug.h
@@ -233,8 +233,8 @@ AcpiDbDisassembleAml (
     ACPI_PARSE_OBJECT       *Op);
 
 void
-AcpiDbBatchExecute (
-    char                    *CountArg);
+AcpiDbEvaluatePredefinedNames (
+    void);
 
 
 /*
diff --git a/sys/contrib/dev/acpica/source/include/acevents.h b/sys/contrib/dev/acpica/source/include/acevents.h
index a14dbe5..14f2b79 100644
--- a/sys/contrib/dev/acpica/source/include/acevents.h
+++ b/sys/contrib/dev/acpica/source/include/acevents.h
@@ -116,6 +116,11 @@ AcpiEvEnableGpe (
     ACPI_GPE_EVENT_INFO     *GpeEventInfo);
 
 ACPI_STATUS
+AcpiEvMaskGpe (
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
+    BOOLEAN                 IsMasked);
+
+ACPI_STATUS
 AcpiEvAddGpeReference (
     ACPI_GPE_EVENT_INFO     *GpeEventInfo);
 
diff --git a/sys/contrib/dev/acpica/source/include/aclocal.h b/sys/contrib/dev/acpica/source/include/aclocal.h
index e7a0d37..9820a89 100644
--- a/sys/contrib/dev/acpica/source/include/aclocal.h
+++ b/sys/contrib/dev/acpica/source/include/aclocal.h
@@ -550,11 +550,12 @@ typedef union acpi_gpe_dispatch_info
  */
 typedef struct acpi_gpe_event_info
 {
-    union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
-    struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
-    UINT8                           Flags;          /* Misc info about this GPE */
-    UINT8                           GpeNumber;      /* This GPE */
-    UINT8                           RuntimeCount;   /* References to a run GPE */
+    union acpi_gpe_dispatch_info    Dispatch;           /* Either Method, Handler, or NotifyList */
+    struct acpi_gpe_register_info   *RegisterInfo;      /* Backpointer to register info */
+    UINT8                           Flags;              /* Misc info about this GPE */
+    UINT8                           GpeNumber;          /* This GPE */
+    UINT8                           RuntimeCount;       /* References to a run GPE */
+    BOOLEAN                         DisableForDispatch; /* Masked during dispatching */
 
 } ACPI_GPE_EVENT_INFO;
 
@@ -567,6 +568,7 @@ typedef struct acpi_gpe_register_info
     UINT16                          BaseGpeNumber;  /* Base GPE number for this register */
     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
+    UINT8                           MaskForRun;     /* GPEs to keep masked when running */
     UINT8                           EnableMask;     /* Current mask of enabled GPEs */
 
 } ACPI_GPE_REGISTER_INFO;
diff --git a/sys/contrib/dev/acpica/source/include/acnamesp.h b/sys/contrib/dev/acpica/source/include/acnamesp.h
index 11ee70d..440ff5b 100644
--- a/sys/contrib/dev/acpica/source/include/acnamesp.h
+++ b/sys/contrib/dev/acpica/source/include/acnamesp.h
@@ -144,6 +144,11 @@ AcpiNsParseTable (
     ACPI_NAMESPACE_NODE     *StartNode);
 
 ACPI_STATUS
+AcpiNsExecuteTable (
+    UINT32                  TableIndex,
+    ACPI_NAMESPACE_NODE     *StartNode);
+
+ACPI_STATUS
 AcpiNsOneCompleteParse (
     UINT32                  PassNumber,
     UINT32                  TableIndex,
@@ -391,6 +396,13 @@ AcpiNsPatternMatch (
     char                    *SearchFor);
 
 ACPI_STATUS
+AcpiNsGetNodeUnlocked (
+    ACPI_NAMESPACE_NODE     *PrefixNode,
+    const char              *ExternalPathname,
+    UINT32                  Flags,
+    ACPI_NAMESPACE_NODE     **OutNode);
+
+ACPI_STATUS
 AcpiNsGetNode (
     ACPI_NAMESPACE_NODE     *PrefixNode,
     const char              *ExternalPathname,
diff --git a/sys/contrib/dev/acpica/source/include/acparser.h b/sys/contrib/dev/acpica/source/include/acparser.h
index dd27821..4137981 100644
--- a/sys/contrib/dev/acpica/source/include/acparser.h
+++ b/sys/contrib/dev/acpica/source/include/acparser.h
@@ -83,6 +83,10 @@ ACPI_STATUS
 AcpiPsExecuteMethod (
     ACPI_EVALUATE_INFO      *Info);
 
+ACPI_STATUS
+AcpiPsExecuteTable (
+    ACPI_EVALUATE_INFO      *Info);
+
 
 /*
  * psargs - Parse AML opcode arguments
diff --git a/sys/contrib/dev/acpica/source/include/acpixf.h b/sys/contrib/dev/acpica/source/include/acpixf.h
index 33f000f..17bab19 100644
--- a/sys/contrib/dev/acpica/source/include/acpixf.h
+++ b/sys/contrib/dev/acpica/source/include/acpixf.h
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20160729
+#define ACPI_CA_VERSION                 0x20160831
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -197,6 +197,13 @@ ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DoNotUseXsdt, FALSE);
 ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_GroupModuleLevelCode, FALSE);
 
 /*
+ * Optionally support module level code by parsing the entire table as
+ * a TermList. Default is FALSE, do not execute entire table until some
+ * lock order issues are fixed.
+ */
+ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_ParseTableAsTermList, FALSE);
+
+/*
  * Optionally use 32-bit FADT addresses if and when there is a conflict
  * (address mismatch) between the 32-bit and 64-bit versions of the
  * address. Although ACPICA adheres to the ACPI specification which
@@ -909,6 +916,13 @@ AcpiFinishGpe (
 
 ACPI_HW_DEPENDENT_RETURN_STATUS (
 ACPI_STATUS
+AcpiMaskGpe (
+    ACPI_HANDLE             GpeDevice,
+    UINT32                  GpeNumber,
+    BOOLEAN                 IsMasked))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
 AcpiMarkGpeForWake (
     ACPI_HANDLE             GpeDevice,
     UINT32                  GpeNumber))
diff --git a/sys/contrib/dev/acpica/source/include/actables.h b/sys/contrib/dev/acpica/source/include/actables.h
index 6abb14c..3325f19 100644
--- a/sys/contrib/dev/acpica/source/include/actables.h
+++ b/sys/contrib/dev/acpica/source/include/actables.h
@@ -178,6 +178,19 @@ void
 AcpiTbUninstallTable (
     ACPI_TABLE_DESC        *TableDesc);
 
+ACPI_STATUS
+AcpiTbLoadTable (
+    UINT32                  TableIndex,
+    ACPI_NAMESPACE_NODE     *ParentNode);
+
+ACPI_STATUS
+AcpiTbInstallAndLoadTable (
+    ACPI_TABLE_HEADER       *Table,
+    ACPI_PHYSICAL_ADDRESS   Address,
+    UINT8                   Flags,
+    BOOLEAN                 Override,
+    UINT32                  *TableIndex);
+
 void
 AcpiTbTerminate (
     void);
@@ -237,12 +250,6 @@ AcpiTbInstallTableWithOverride (
     UINT32                  *TableIndex);
 
 ACPI_STATUS
-AcpiTbInstallFixedTable (
-    ACPI_PHYSICAL_ADDRESS   Address,
-    char                    *Signature,
-    UINT32                  *TableIndex);
-
-ACPI_STATUS ACPI_INIT_FUNCTION
 AcpiTbParseRootTable (
     ACPI_PHYSICAL_ADDRESS   RsdpAddress);
 
diff --git a/sys/contrib/dev/acpica/source/include/actypes.h b/sys/contrib/dev/acpica/source/include/actypes.h
index 3861f12..0d2ab4c 100644
--- a/sys/contrib/dev/acpica/source/include/actypes.h
+++ b/sys/contrib/dev/acpica/source/include/actypes.h
@@ -745,16 +745,17 @@ typedef UINT32                          ACPI_EVENT_TYPE;
  * The encoding of ACPI_EVENT_STATUS is illustrated below.
  * Note that a set bit (1) indicates the property is TRUE
  * (e.g. if bit 0 is set then the event is enabled).
- * +-------------+-+-+-+-+-+
- * |   Bits 31:5 |4|3|2|1|0|
- * +-------------+-+-+-+-+-+
- *          |     | | | | |
- *          |     | | | | +- Enabled?
- *          |     | | | +--- Enabled for wake?
- *          |     | | +----- Status bit set?
- *          |     | +------- Enable bit set?
- *          |     +--------- Has a handler?
- *          +--------------- <Reserved>
+ * +-------------+-+-+-+-+-+-+
+ * |   Bits 31:6 |5|4|3|2|1|0|
+ * +-------------+-+-+-+-+-+-+
+ *          |     | | | | | |
+ *          |     | | | | | +- Enabled?
+ *          |     | | | | +--- Enabled for wake?
+ *          |     | | | +----- Status bit set?
+ *          |     | | +------- Enable bit set?
+ *          |     | +--------- Has a handler?
+ *          |     +----------- Masked?
+ *          +----------------- <Reserved>
  */
 typedef UINT32                          ACPI_EVENT_STATUS;
 
@@ -764,6 +765,7 @@ typedef UINT32                          ACPI_EVENT_STATUS;
 #define ACPI_EVENT_FLAG_STATUS_SET      (ACPI_EVENT_STATUS) 0x04
 #define ACPI_EVENT_FLAG_ENABLE_SET      (ACPI_EVENT_STATUS) 0x08
 #define ACPI_EVENT_FLAG_HAS_HANDLER     (ACPI_EVENT_STATUS) 0x10
+#define ACPI_EVENT_FLAG_MASKED          (ACPI_EVENT_STATUS) 0x20
 #define ACPI_EVENT_FLAG_SET             ACPI_EVENT_FLAG_STATUS_SET
 
 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
@@ -774,14 +776,15 @@ typedef UINT32                          ACPI_EVENT_STATUS;
 
 /*
  * GPE info flags - Per GPE
- * +-------+-+-+---+
- * |  7:5  |4|3|2:0|
- * +-------+-+-+---+
- *     |    | |  |
- *     |    | |  +-- Type of dispatch:to method, handler, notify, or none
- *     |    | +----- Interrupt type: edge or level triggered
- *     |    +------- Is a Wake GPE
- *     +------------ <Reserved>
+ * +---+-+-+-+---+
+ * |7:6|5|4|3|2:0|
+ * +---+-+-+-+---+
+ *   |  | | |  |
+ *   |  | | |  +-- Type of dispatch:to method, handler, notify, or none
+ *   |  | | +----- Interrupt type: edge or level triggered
+ *   |  | +------- Is a Wake GPE
+ *   |  +--------- Is GPE masked by the software GPE masking machanism
+ *   +------------ <Reserved>
  */
 #define ACPI_GPE_DISPATCH_NONE          (UINT8) 0x00
 #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x01
@@ -1079,13 +1082,6 @@ typedef struct acpi_statistics
 } ACPI_STATISTICS;
 
 
-/* Table Event Types */
-
-#define ACPI_TABLE_EVENT_LOAD           0x0
-#define ACPI_TABLE_EVENT_UNLOAD         0x1
-#define ACPI_NUM_TABLE_EVENTS           2
-
-
 /*
  * Types specific to the OS service interfaces
  */
@@ -1158,9 +1154,14 @@ ACPI_STATUS (*ACPI_TABLE_HANDLER) (
     void                            *Table,
     void                            *Context);
 
-#define ACPI_TABLE_LOAD             0x0
-#define ACPI_TABLE_UNLOAD           0x1
-#define ACPI_NUM_TABLE_EVENTS       2
+
+/* Table Event Types */
+
+#define ACPI_TABLE_EVENT_LOAD           0x0
+#define ACPI_TABLE_EVENT_UNLOAD         0x1
+#define ACPI_TABLE_EVENT_INSTALL        0x2
+#define ACPI_TABLE_EVENT_UNINSTALL      0x3
+#define ACPI_NUM_TABLE_EVENTS           4
 
 
 /* Address Spaces (For Operation Regions) */
diff --git a/sys/contrib/dev/acpica/source/include/acutils.h b/sys/contrib/dev/acpica/source/include/acutils.h
index 0def019..32c5c6e 100644
--- a/sys/contrib/dev/acpica/source/include/acutils.h
+++ b/sys/contrib/dev/acpica/source/include/acutils.h
@@ -224,14 +224,16 @@ AcpiUtStricmp (
 ACPI_STATUS
 AcpiUtStrtoul64 (
     char                    *String,
-    UINT32                  Base,
-    UINT32                  MaxIntegerByteWidth,
+    UINT32                  Flags,
     UINT64                  *RetInteger);
 
-/* Values for MaxIntegerByteWidth above */
-
-#define ACPI_MAX32_BYTE_WIDTH       4
-#define ACPI_MAX64_BYTE_WIDTH       8
+/*
+ * Values for Flags above
+ * Note: LIMIT values correspond to AcpiGbl_IntegerByteWidth values (4/8)
+ */
+#define ACPI_STRTOUL_32BIT          0x04    /* 4 bytes */
+#define ACPI_STRTOUL_64BIT          0x08    /* 8 bytes */
+#define ACPI_STRTOUL_BASE16         0x10    /* Default: Base10/16 */
 
 
 /*
@@ -286,6 +288,11 @@ AcpiUtHexToAsciiChar (
     UINT64                  Integer,
     UINT32                  Position);
 
+ACPI_STATUS
+AcpiUtAsciiToHexByte (
+    char                    *TwoAsciiChars,
+    UINT8                   *ReturnByte);
+
 UINT8
 AcpiUtAsciiCharToHex (
     int                     HexChar);
diff --git a/sys/contrib/dev/acpica/source/include/platform/acefi.h b/sys/contrib/dev/acpica/source/include/platform/acefi.h
index 56c4b0a..af3df6c 100644
--- a/sys/contrib/dev/acpica/source/include/platform/acefi.h
+++ b/sys/contrib/dev/acpica/source/include/platform/acefi.h
@@ -246,12 +246,14 @@ struct _ACPI_EFI_FILE_IO_INTERFACE;
 struct _ACPI_EFI_FILE_HANDLE;
 struct _ACPI_EFI_BOOT_SERVICES;
 struct _ACPI_EFI_SYSTEM_TABLE;
+struct _ACPI_EFI_PCI_IO;
 
 extern struct _ACPI_EFI_SYSTEM_TABLE        *ST;
 extern struct _ACPI_EFI_BOOT_SERVICES       *BS;
 
 #define FILE                struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE
-#define stdout              ST->ConOut
-#define stderr              ST->ConOut
+
+extern FILE                 *stdout;
+extern FILE                 *stderr;
 
 #endif /* __ACEFI_H__ */
diff --git a/sys/contrib/dev/acpica/source/include/platform/acefiex.h b/sys/contrib/dev/acpica/source/include/platform/acefiex.h
index 8f98a62..4ae0c66 100644
--- a/sys/contrib/dev/acpica/source/include/platform/acefiex.h
+++ b/sys/contrib/dev/acpica/source/include/platform/acefiex.h
@@ -831,6 +831,71 @@ typedef struct _ACPI_EFI_SYSTEM_TABLE {
 } ACPI_EFI_SYSTEM_TABLE;
 
 
+/*
+ * EFI PCI I/O Protocol
+ */
+#define ACPI_EFI_PCI_IO_PROTOCOL \
+    { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }
+
+typedef enum {
+    AcpiEfiPciIoWidthUint8 = 0,
+    AcpiEfiPciIoWidthUint16,
+    AcpiEfiPciIoWidthUint32,
+    AcpiEfiPciIoWidthUint64,
+    AcpiEfiPciIoWidthFifoUint8,
+    AcpiEfiPciIoWidthFifoUint16,
+    AcpiEfiPciIoWidthFifoUint32,
+    AcpiEfiPciIoWidthFifoUint64,
+    AcpiEfiPciIoWidthFillUint8,
+    AcpiEfiPciIoWidthFillUint16,
+    AcpiEfiPciIoWidthFillUint32,
+    AcpiEfiPciIoWidthFillUint64,
+    AcpiEfiPciIoWidthMaximum
+} ACPI_EFI_PCI_IO_PROTOCOL_WIDTH;
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_CONFIG)(
+    struct _ACPI_EFI_PCI_IO             *This,
+    ACPI_EFI_PCI_IO_PROTOCOL_WIDTH      Width,
+    UINT32                              Offset,
+    UINTN                               Count,
+    VOID                                *Buffer);
+
+typedef struct {
+    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Read;
+    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG     Write;
+} ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
+
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
+    struct _ACPI_EFI_PCI_IO             *This,
+    UINTN                               *SegmentNumber,
+    UINTN                               *BusNumber,
+    UINTN                               *DeviceNumber,
+    UINTN                               *FunctionNumber);
+
+typedef struct _ACPI_EFI_PCI_IO {
+    ACPI_EFI_UNKNOWN_INTERFACE          PollMem;
+    ACPI_EFI_UNKNOWN_INTERFACE          PollIo;
+    ACPI_EFI_UNKNOWN_INTERFACE          Mem;
+    ACPI_EFI_UNKNOWN_INTERFACE          Io;
+    ACPI_EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
+    ACPI_EFI_UNKNOWN_INTERFACE          CopyMem;
+    ACPI_EFI_UNKNOWN_INTERFACE          Map;
+    ACPI_EFI_UNKNOWN_INTERFACE          Unmap;
+    ACPI_EFI_UNKNOWN_INTERFACE          AllocateBuffer;
+    ACPI_EFI_UNKNOWN_INTERFACE          FreeBuffer;
+    ACPI_EFI_UNKNOWN_INTERFACE          Flush;
+    ACPI_EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
+    ACPI_EFI_UNKNOWN_INTERFACE          Attributes;
+    ACPI_EFI_UNKNOWN_INTERFACE          GetBarAttributes;
+    ACPI_EFI_UNKNOWN_INTERFACE          SetBarAttributes;
+    UINT64                              RomSize;
+    VOID                                *RomImage;
+} ACPI_EFI_PCI_IO;
+
 /* GNU EFI definitions */
 
 #if defined(_GNU_EFI)
diff --git a/sys/contrib/dev/acpica/source/tools/acpidump/apdump.c b/sys/contrib/dev/acpica/source/tools/acpidump/apdump.c
index 98ca3b6..4941c0e 100644
--- a/sys/contrib/dev/acpica/source/tools/acpidump/apdump.c
+++ b/sys/contrib/dev/acpica/source/tools/acpidump/apdump.c
@@ -326,8 +326,8 @@ ApDumpTableByAddress (
 
     /* Convert argument to an integer physical address */
 
-    Status = AcpiUtStrtoul64 (AsciiAddress, ACPI_ANY_BASE,
-        ACPI_MAX64_BYTE_WIDTH, &LongAddress);
+    Status = AcpiUtStrtoul64 (AsciiAddress, ACPI_STRTOUL_64BIT,
+        &LongAddress);
     if (ACPI_FAILURE (Status))
     {
         fprintf (stderr, "%s: Could not convert to a physical address\n",
diff --git a/sys/contrib/dev/acpica/source/tools/acpidump/apmain.c b/sys/contrib/dev/acpica/source/tools/acpidump/apmain.c
index 26a956e..9f7f3ef 100644
--- a/sys/contrib/dev/acpica/source/tools/acpidump/apmain.c
+++ b/sys/contrib/dev/acpica/source/tools/acpidump/apmain.c
@@ -236,8 +236,8 @@ ApDoOptions (
 
     case 'r':   /* Dump tables from specified RSDP */
 
-        Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_ANY_BASE,
-            ACPI_MAX64_BYTE_WIDTH, &Gbl_RsdpBase);
+        Status = AcpiUtStrtoul64 (AcpiGbl_Optarg, ACPI_STRTOUL_64BIT,
+            &Gbl_RsdpBase);
         if (ACPI_FAILURE (Status))
         {
             fprintf (stderr, "%s: Could not convert to a physical address\n",
diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c
index 9fc8007..5953e36 100644
--- a/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c
+++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c
@@ -70,7 +70,7 @@ AeGetDevices (
 static ACPI_STATUS
 ExecuteOSI (
     char                    *OsiString,
-    UINT32                  ExpectedResult);
+    UINT64                  ExpectedResult);
 
 static void
 AeMutexInterfaces (
@@ -328,7 +328,7 @@ AeGetDevices (
  * FUNCTION:    ExecuteOSI
  *
  * PARAMETERS:  OsiString           - String passed to _OSI method
- *              ExpectedResult      - 0 (FALSE) or 0xFFFFFFFF (TRUE)
+ *              ExpectedResult      - 0 (FALSE) or ACPI_UINT64_MAX (TRUE)
  *
  * RETURN:      Status
  *
@@ -339,7 +339,7 @@ AeGetDevices (
 static ACPI_STATUS
 ExecuteOSI (
     char                    *OsiString,
-    UINT32                  ExpectedResult)
+    UINT64                  ExpectedResult)
 {
     ACPI_STATUS             Status;
     ACPI_OBJECT_LIST        ArgList;
@@ -392,8 +392,9 @@ ExecuteOSI (
     if (Obj->Integer.Value != ExpectedResult)
     {
         AcpiOsPrintf (
-            "Invalid return value from _OSI, expected %.8X found %.8X\n",
-            ExpectedResult, (UINT32) Obj->Integer.Value);
+            "Invalid return value from _OSI, expected %8.8X%8.8X found %8.8X%8.8X\n",
+            ACPI_FORMAT_UINT64 (ExpectedResult),
+            ACPI_FORMAT_UINT64 (Obj->Integer.Value));
         goto ErrorExit;
     }
 
@@ -697,10 +698,10 @@ AeMiscellaneousTests (
 
     /* Test _OSI execution */
 
-    Status = ExecuteOSI ("Extended Address Space Descriptor", 0xFFFFFFFF);
+    Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
     ACPI_CHECK_OK (ExecuteOSI, Status);
 
-    Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
+    Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
     ACPI_CHECK_OK (ExecuteOSI, Status);
 
     Status = ExecuteOSI ("MichiganTerminalSystem", 0);
diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c
index 811e41e..1fa2d37 100644
--- a/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c
+++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c
@@ -115,6 +115,8 @@ static char                *TableEvents[] =
 {
     "LOAD",
     "UNLOAD",
+    "INSTALL",
+    "UNINSTALL",
     "UNKNOWN"
 };
 #endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aeinitfile.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aeinitfile.c
index d41ba14..8151435 100644
--- a/sys/contrib/dev/acpica/source/tools/acpiexec/aeinitfile.c
+++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aeinitfile.c
@@ -172,7 +172,7 @@ CleanupAndExit:
  *
  * RETURN:      None
  *
- * DESCRIPTION: Perform an overrided for a single namespace object
+ * DESCRIPTION: Perform an override for a single namespace object
  *
  *****************************************************************************/
 
@@ -203,8 +203,8 @@ AeDoOneOverride (
 
     /* Extract the 64-bit integer */
 
-    Status = AcpiUtStrtoul64 (ValueString, ACPI_ANY_BASE,
-        ACPI_MAX64_BYTE_WIDTH, &Value);
+    Status = AcpiUtStrtoul64 (ValueString,
+        (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value);
     if (ACPI_FAILURE (Status))
     {
         AcpiOsPrintf ("%s %s\n", ValueString,
diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
index d2c9d51..d4bf335 100644
--- a/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
+++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
@@ -92,6 +92,8 @@ BOOLEAN                     AcpiGbl_LoadTestTables = FALSE;
 BOOLEAN                     AcpiGbl_AeLoadOnly = FALSE;
 static UINT8                AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP;
 static char                 BatchBuffer[AE_BUFFER_SIZE];    /* Batch command buffer */
+static char                 AeBuildDate[] = __DATE__;
+static char                 AeBuildTime[] = __TIME__;
 
 #define ACPIEXEC_NAME               "AML Execution/Debug Utility"
 #define AE_SUPPORTED_OPTIONS        "?b:d:e:f^ghi:lm^rv^:x:"
@@ -155,6 +157,7 @@ usage (
     ACPI_OPTION ("-ei",                 "Enable additional tests for ACPICA interfaces");
     ACPI_OPTION ("-el",                 "Enable loading of additional test tables");
     ACPI_OPTION ("-em",                 "Enable grouping of module-level code");
+    ACPI_OPTION ("-ep",                 "Enable TermList parsing for scope objects");
     ACPI_OPTION ("-es",                 "Enable Interpreter Slack Mode");
     ACPI_OPTION ("-et",                 "Enable debug semaphore timeout");
     printf ("\n");
@@ -167,6 +170,7 @@ usage (
     ACPI_OPTION ("-l",                  "Load tables and namespace only");
     ACPI_OPTION ("-r",                  "Use hardware-reduced FADT V5");
     ACPI_OPTION ("-v",                  "Display version information");
+    ACPI_OPTION ("-vd",                 "Display build date and time");
     ACPI_OPTION ("-vi",                 "Verbose initialization output");
     ACPI_OPTION ("-vr",                 "Verbose region handler output");
     ACPI_OPTION ("-x <DebugLevel>",     "Debug output level");
@@ -285,6 +289,11 @@ AeDoOptions (
             AcpiGbl_GroupModuleLevelCode = TRUE;
             break;
 
+        case 'p':
+
+            AcpiGbl_ParseTableAsTermList = TRUE;
+            break;
+
         case 's':
 
             AcpiGbl_EnableInterpreterSlack = TRUE;
@@ -399,6 +408,11 @@ AeDoOptions (
             (void) AcpiOsTerminate ();
             return (1);
 
+        case 'd':
+
+            printf ("Build date/time: %s %s\n", AeBuildDate, AeBuildTime);
+            return (1);
+
         case 'i':
 
             AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
@@ -464,8 +478,13 @@ main (
     AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
     AcpiDbgLayer = 0xFFFFFFFF;
 
-    /* Init ACPICA and start debugger thread */
-
+    /*
+     * Initialize ACPICA and start debugger thread.
+     *
+     * NOTE: After ACPICA initialization, AcpiTerminate MUST be called
+     * before this procedure exits -- otherwise, the console may be
+     * left in an incorrect state.
+     */
     Status = AcpiInitializeSubsystem ();
     ACPI_CHECK_OK (AcpiInitializeSubsystem, Status);
     if (ACPI_FAILURE (Status))
@@ -491,8 +510,7 @@ main (
     if (argc < 2)
     {
         usage ();
-        (void) AcpiOsTerminate ();
-        return (0);
+        goto NormalExit;
     }
 
     /* Get the command line options */
@@ -547,7 +565,6 @@ main (
     /* Install all of the ACPI tables */
 
     Status = AeInstallTables ();
-
     if (ACPI_FAILURE (Status))
     {
         printf ("**** Could not install ACPI tables, %s\n",
@@ -576,7 +593,13 @@ main (
 
     /*
      * Main initialization for ACPICA subsystem
-     * TBD: Need a way to call this after the ACPI table "LOAD" command
+     * TBD: Need a way to call this after the ACPI table "LOAD" command?
+     *
+     * NOTE: This initialization does not match the _Lxx and _Exx methods
+     * to individual GPEs, as there are no real GPEs when the hardware
+     * is simulated - because there is no namespace until AeLoadTables is
+     * executed. This may have to change if AcpiExec is ever run natively
+     * on actual hardware (such as under UEFI).
      */
     Status = AcpiEnableSubsystem (InitFlags);
     if (ACPI_FAILURE (Status))
@@ -660,14 +683,14 @@ EnterDebugger:
 
     /* Temporarily removed */
     AcpiTerminateDebugger ();
-    Status = AcpiTerminate ();
+    (void) AcpiTerminate ();
 #endif
 
-    Status = AcpiOsTerminate ();
-    return (0);
-
+NormalExit:
+    ExitCode = 0;
 
 ErrorExit:
+    (void) AcpiOsTerminate ();
     return (ExitCode);
 }
 
diff --git a/sys/dev/acpica/Makefile b/sys/dev/acpica/Makefile
index ae50d5f..fba63fb 100644
--- a/sys/dev/acpica/Makefile
+++ b/sys/dev/acpica/Makefile
@@ -63,7 +63,7 @@ SRCS+=	utdebug.c utdecode.c utdelete.c uterror.c uteval.c utexcep.c
 SRCS+=	utglobal.c uthex.c utids.c utinit.c utlock.c
 SRCS+=	utmath.c utmisc.c utmutex.c utnonansi.c
 SRCS+=	utobject.c utosi.c utownerid.c utpredef.c
-SRCS+=	utresrc.c utstate.c utstring.c utuuid.c utxface.c
+SRCS+=	utresrc.c utstate.c utstring.c utstrtoul64.c utuuid.c utxface.c
 SRCS+=	utxferror.c utxfinit.c
 
 # OSD layer
diff --git a/usr.sbin/acpi/acpidump/Makefile b/usr.sbin/acpi/acpidump/Makefile
index 9068441..44f01ae 100644
--- a/usr.sbin/acpi/acpidump/Makefile
+++ b/usr.sbin/acpi/acpidump/Makefile
@@ -27,9 +27,11 @@ SRCS+=	\
 	utdebug.c \
 	utexcep.c \
 	utglobal.c \
+	uthex.c \
 	utmath.c \
 	utnonansi.c \
 	utstring.c \
+	utstrtoul64.c \
 	utxferror.c
 
 SRCS+=	\
diff --git a/usr.sbin/acpi/acpiexec/Makefile b/usr.sbin/acpi/acpiexec/Makefile
index 4258ec6..9161918 100644
--- a/usr.sbin/acpi/acpiexec/Makefile
+++ b/usr.sbin/acpi/acpiexec/Makefile
@@ -200,6 +200,7 @@ SRCS+=	\
 	utresrc.c \
 	utstate.c \
 	utstring.c \
+	utstrtoul64.c \
 	uttrack.c \
 	utuuid.c \
 	utxface.c \
diff --git a/usr.sbin/acpi/acpiexec/acpiexec.8 b/usr.sbin/acpi/acpiexec/acpiexec.8
index 0b5ff3c..10d1681 100644
--- a/usr.sbin/acpi/acpiexec/acpiexec.8
+++ b/usr.sbin/acpi/acpiexec/acpiexec.8
@@ -28,7 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 6, 2016
+.Dd September 1, 2016
 .Dt ACPIEXEC 8
 .Os
 .Sh NAME
@@ -65,6 +65,8 @@ Enable additional tests for ACPICA interfaces.
 Enable loading of additional test tables.
 .It Fl em
 Enable grouping of module-level code.
+.It Fl ep
+Enable TermList parsing for scope objects.
 .It Fl es
 Enable Interpreter Slack Mode.
 .It Fl et
@@ -90,6 +92,8 @@ The default method is
 Use hardware-reduced FADT V5.
 .It Fl v
 Display version information.
+.It Fl vd
+Display build date and time.
 .It Fl vi
 Verbose initialization output.
 .It Fl vr
diff --git a/usr.sbin/acpi/acpixtract/Makefile b/usr.sbin/acpi/acpixtract/Makefile
index 35d5996..a55cf11 100644
--- a/usr.sbin/acpi/acpixtract/Makefile
+++ b/usr.sbin/acpi/acpixtract/Makefile
@@ -21,6 +21,7 @@ SRCS+=	\
 	utdebug.c \
 	utexcep.c \
 	utglobal.c \
+	uthex.c \
 	utmath.c \
 	utnonansi.c \
 	utxferror.c
diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile
index 6506dec..59c2fcb 100644
--- a/usr.sbin/acpi/iasl/Makefile
+++ b/usr.sbin/acpi/iasl/Makefile
@@ -40,6 +40,7 @@ SRCS=	\
 	aslfiles.c \
 	aslfileio.c \
 	aslfold.c \
+	aslhelp.c \
 	aslhex.c \
 	asllength.c \
 	asllisting.c \
@@ -200,6 +201,7 @@ SRCS=	\
 	utresrc.c \
 	utstate.c \
 	utstring.c \
+	utstrtoul64.c \
 	utuuid.c \
 	utxface.c \
 	utxferror.c
diff --git a/usr.sbin/acpi/iasl/iasl.8 b/usr.sbin/acpi/iasl/iasl.8
index 58966fb..c1bf63f 100644
--- a/usr.sbin/acpi/iasl/iasl.8
+++ b/usr.sbin/acpi/iasl/iasl.8
@@ -28,7 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 13, 2016
+.Dd September 1, 2016
 .Dt IASL 8
 .Os
 .Sh NAME
@@ -87,6 +87,8 @@ Compile custom table that contains generic operators.
 Display the help message.
 .It Fl hc
 Display operators allowed in constant expressions.
+.It Fl hd
+Info for obtaining and disassembling binary ACPI tables.
 .It Fl hf
 Display help for output filename generation.
 .It Fl hr
@@ -161,6 +163,8 @@ Create hex AML table in ASL (*.hex).
 Display compiler version.
 .It Fl va
 Disable all errors/warnings/remarks.
+.It Fl vd
+Display compiler build date and time.
 .It Fl ve
 Report only errors (ignore warnings and remarks).
 .It Fl vi
-- 
2.9.2

