[Midnightbsd-cvs] src [12108] trunk: ACPICA 20161222

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Oct 21 11:50:23 EDT 2018


Revision: 12108
          http://svnweb.midnightbsd.org/src/?rev=12108
Author:   laffer1
Date:     2018-10-21 11:50:05 -0400 (Sun, 21 Oct 2018)
Log Message:
-----------
ACPICA 20161222

Modified Paths:
--------------
    trunk/sys/conf/files
    trunk/sys/contrib/dev/acpica/acpica_prep.sh
    trunk/sys/contrib/dev/acpica/changes.txt
    trunk/sys/contrib/dev/acpica/common/acfileio.c
    trunk/sys/contrib/dev/acpica/common/ahtable.c
    trunk/sys/contrib/dev/acpica/common/ahuuids.c
    trunk/sys/contrib/dev/acpica/compiler/aslutils.c
    trunk/sys/contrib/dev/acpica/components/debugger/dbinput.c
    trunk/sys/contrib/dev/acpica/components/debugger/dbxface.c
    trunk/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
    trunk/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
    trunk/sys/contrib/dev/acpica/components/executer/exconfig.c
    trunk/sys/contrib/dev/acpica/components/executer/exfldio.c
    trunk/sys/contrib/dev/acpica/components/hardware/hwesleep.c
    trunk/sys/contrib/dev/acpica/components/hardware/hwregs.c
    trunk/sys/contrib/dev/acpica/components/hardware/hwsleep.c
    trunk/sys/contrib/dev/acpica/components/parser/psargs.c
    trunk/sys/contrib/dev/acpica/components/parser/pstree.c
    trunk/sys/contrib/dev/acpica/components/utilities/utdecode.c
    trunk/sys/contrib/dev/acpica/components/utilities/utdelete.c
    trunk/sys/contrib/dev/acpica/components/utilities/utmutex.c
    trunk/sys/contrib/dev/acpica/components/utilities/utresrc.c
    trunk/sys/contrib/dev/acpica/include/acclib.h
    trunk/sys/contrib/dev/acpica/include/acdebug.h
    trunk/sys/contrib/dev/acpica/include/acdisasm.h
    trunk/sys/contrib/dev/acpica/include/acexcep.h
    trunk/sys/contrib/dev/acpica/include/acglobal.h
    trunk/sys/contrib/dev/acpica/include/aclocal.h
    trunk/sys/contrib/dev/acpica/include/acmacros.h
    trunk/sys/contrib/dev/acpica/include/acpiosxf.h
    trunk/sys/contrib/dev/acpica/include/acpixf.h
    trunk/sys/contrib/dev/acpica/include/platform/acenv.h
    trunk/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
    trunk/sys/dev/acpica/Osd/OsdDebug.c
    trunk/sys/dev/acpica/Osd/OsdHardware.c
    trunk/usr.sbin/acpi/acpidb/Makefile
    trunk/usr.sbin/acpi/acpidb/acpidb.c

Added Paths:
-----------
    trunk/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c

Modified: trunk/sys/conf/files
===================================================================
--- trunk/sys/conf/files	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/conf/files	2018-10-21 15:50:05 UTC (rev 12108)
@@ -444,7 +444,7 @@
 contrib/dev/acpica/components/utilities/utxface.c	optional acpi
 contrib/dev/acpica/components/utilities/utxferror.c	optional acpi
 contrib/dev/acpica/components/utilities/utxfinit.c	optional acpi
-#contrib/dev/acpica/components/utilities/utxfmutex.c	optional acpi
+contrib/dev/acpica/os_specific/service_layers/osgendbg.c	optional acpi acpi_debug
 contrib/ipfilter/netinet/fil.c	optional ipfilter inet \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \

Modified: trunk/sys/contrib/dev/acpica/acpica_prep.sh
===================================================================
--- trunk/sys/contrib/dev/acpica/acpica_prep.sh	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/acpica_prep.sh	2018-10-21 15:50:05 UTC (rev 12108)
@@ -17,7 +17,7 @@
 fulldirs="common compiler components include os_specific"
 
 # files to remove
-stripdirs="generate libraries tests tools"
+stripdirs="generate libraries parsers preprocessor tests tools"
 stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h	\
 	acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h	\
 	acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h	\

Modified: trunk/sys/contrib/dev/acpica/changes.txt
===================================================================
--- trunk/sys/contrib/dev/acpica/changes.txt	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/changes.txt	2018-10-21 15:50:05 UTC (rev 12108)
@@ -1,4 +1,93 @@
 ----------------------------------------
+22 December 2016. Summary of changes for version 20161222:
+
+
+1) ACPICA kernel-resident subsystem:
+
+AML Debugger: Implemented a new mechanism to simplify and enhance 
+debugger integration into all environments, including kernel debuggers 
+and user-space utilities, as well as remote debug services. This 
+mechanism essentially consists of new OSL interfaces to support debugger 
+initialization/termination, as well as wait/notify interfaces to perform 
+the debugger handshake with the host. Lv Zheng.
+
+    New OSL interfaces:
+        AcpiOsInitializeDebugger (void)
+        AcpiOsTerminateDebugger (void)
+        AcpiOsWaitCommandReady (void)
+        AcpiOsNotifyCommandComplete (void)
+
+    New OS services layer:
+        osgendbg.c -- Example implementation, and used for AcpiExec
+
+Update for Generic Address Space (GAS) support: Although the AccessWidth 
+and/or BitOffset fields of the GAS are not often used, this change now 
+fully supports these fields. This affects the internal support for FADT 
+registers, registers in other ACPI data tables, and the AcpiRead and 
+AcpiWrite public interfaces. Lv Zheng.
+
+Sleep support: In order to simplify integration of ACPI sleep for the 
+various host operating systems, a new OSL interface has been introduced. 
+AcpiOsEnterSleep allows the host to perform any required operations 
+before the final write to the sleep control register(s) is performed by 
+ACPICA. Lv Zheng.
+
+    New OSL interface:
+        AcpiOsEnterSleep(SleepState, RegisterAValue, RegisterBValue)
+
+    Called from these internal interfaces:
+        AcpiHwLegacySleep
+        AcpiHwExtendedSleep
+
+EFI support: Added a very small EFI/ACPICA example application. Provides 
+a simple demo for EFI integration, as well as assisting with resolution 
+of issues related to customer ACPICA/EFI integration. Lv Zheng. See:
+
+    source/tools/efihello/efihello.c
+
+Local C library: Implemented several new functions to enhance ACPICA 
+portability, for environments where these clib functions are not 
+available (such as EFI). Lv Zheng:
+    putchar
+    getchar
+    strpbrk
+    strtok
+    memmove
+
+Fixed a regression where occasionally a valid resource descriptor was 
+incorrectly detected as invalid at runtime, and a 
+AE_AML_NO_RESOURCE_END_TAG was returned.
+
+Fixed a problem with the recently implemented support that enables 
+control method invocations as Target operands to many ASL operators. 
+Warnings of this form: "Needed type [Reference], found [Processor]" were 
+seen at runtime for some method invocations.
+
+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: 141.5K Code, 58.5K Data, 200.0K Total
+    Debug Version:     201.7K Code, 82.7K Data, 284.4K Total
+  Previous Release:
+    Non-Debug Version: 140.5K Code, 58.5K Data, 198.9K Total
+    Debug Version:     201.3K Code, 82.7K Data, 284.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Enhanced output by adding the capability to detect and 
+disassemble ASL Switch/Case statements back to the original ASL source 
+code instead of if/else blocks. David Box.
+
+AcpiHelp: Split a large file into separate files based upon 
+functionality/purpose. New files are:
+    ahaml.c
+    ahasl.c
+
+----------------------------------------
 17 November 2016. Summary of changes for version 20161117:
 
 

Modified: trunk/sys/contrib/dev/acpica/common/acfileio.c
===================================================================
--- trunk/sys/contrib/dev/acpica/common/acfileio.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/common/acfileio.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -404,7 +404,7 @@
     UINT32                  i;
 
 
-    ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
+    ACPI_FUNCTION_TRACE (AcValidateTableHeader);
 
 
     /* Read a potential table header */

Modified: trunk/sys/contrib/dev/acpica/common/ahtable.c
===================================================================
--- trunk/sys/contrib/dev/acpica/common/ahtable.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/common/ahtable.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -52,7 +52,7 @@
 AcpiAhGetTableInfo (
     char                    *Signature);
 
-extern const AH_TABLE      AcpiSupportedTables[];
+extern const AH_TABLE      Gbl_AcpiSupportedTables[];
 
 
 /*******************************************************************************
@@ -74,7 +74,7 @@
     const AH_TABLE      *Info;
 
 
-    for (Info = AcpiSupportedTables; Info->Signature; Info++)
+    for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++)
     {
         if (ACPI_COMPARE_NAME (Signature, Info->Signature))
         {
@@ -90,7 +90,7 @@
  * Note: Any tables added here should be duplicated within AcpiDmTableData
  * in the file common/dmtable.c
  */
-const AH_TABLE      AcpiSupportedTables[] =
+const AH_TABLE      Gbl_AcpiSupportedTables[] =
 {
     {ACPI_SIG_ASF,  "Alert Standard Format table"},
     {ACPI_SIG_BERT, "Boot Error Record Table"},

Modified: trunk/sys/contrib/dev/acpica/common/ahuuids.c
===================================================================
--- trunk/sys/contrib/dev/acpica/common/ahuuids.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/common/ahuuids.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -53,7 +53,7 @@
 /*
  * Table of "known" (ACPI-related) UUIDs
  */
-const AH_UUID  AcpiUuids[] =
+const AH_UUID  Gbl_AcpiUuids[] =
 {
     {"[Controllers]",               NULL},
     {"GPIO Controller",             UUID_GPIO_CONTROLLER},
@@ -113,7 +113,7 @@
 
     /* Walk the table of known ACPI-related UUIDs */
 
-    for (Info = AcpiUuids; Info->Description; Info++)
+    for (Info = Gbl_AcpiUuids; Info->Description; Info++)
     {
         /* Null string means desciption is a UUID class */
 

Modified: trunk/sys/contrib/dev/acpica/compiler/aslutils.c
===================================================================
--- trunk/sys/contrib/dev/acpica/compiler/aslutils.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/compiler/aslutils.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -156,7 +156,7 @@
     /* All ACPI tables with the common table header */
 
     printf ("\n  Supported ACPI tables:\n");
-    for (TableData = AcpiSupportedTables, i = 1;
+    for (TableData = Gbl_AcpiSupportedTables, i = 1;
          TableData->Signature; TableData++, i++)
     {
         printf ("%8u) %s    %s\n", i,

Modified: trunk/sys/contrib/dev/acpica/components/debugger/dbinput.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/debugger/dbinput.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/debugger/dbinput.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -65,10 +65,6 @@
     char                    *UserCommand);
 
 static void
-AcpiDbSingleThread (
-    void);
-
-static void
 AcpiDbDisplayCommandInfo (
     const char              *Command,
     BOOLEAN                 DisplayAll);
@@ -1232,26 +1228,8 @@
 AcpiDbExecuteThread (
     void                    *Context)
 {
-    ACPI_STATUS             Status = AE_OK;
-    ACPI_STATUS             MStatus;
 
-
-    while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
-    {
-        AcpiGbl_MethodExecuting = FALSE;
-        AcpiGbl_StepToNextCall = FALSE;
-
-        MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
-            ACPI_WAIT_FOREVER);
-        if (ACPI_FAILURE (MStatus))
-        {
-            return;
-        }
-
-        Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-
-        AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
-    }
+    (void) AcpiDbUserCommands ();
     AcpiGbl_DbThreadsTerminated = TRUE;
 }
 
@@ -1258,38 +1236,12 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiDbSingleThread
+ * FUNCTION:    AcpiDbUserCommands
  *
  * PARAMETERS:  None
  *
  * RETURN:      None
  *
- * DESCRIPTION: Debugger execute thread. Waits for a command line, then
- *              simply dispatches it.
- *
- ******************************************************************************/
-
-static void
-AcpiDbSingleThread (
-    void)
-{
-
-    AcpiGbl_MethodExecuting = FALSE;
-    AcpiGbl_StepToNextCall = FALSE;
-
-    (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiDbUserCommands
- *
- * PARAMETERS:  Prompt              - User prompt (depends on mode)
- *              Op                  - Current executing parse op
- *
- * RETURN:      None
- *
  * DESCRIPTION: Command line execution for the AML debugger. Commands are
  *              matched and dispatched here.
  *
@@ -1297,8 +1249,7 @@
 
 ACPI_STATUS
 AcpiDbUserCommands (
-    char                    Prompt,
-    ACPI_PARSE_OBJECT       *Op)
+    void)
 {
     ACPI_STATUS             Status = AE_OK;
 
@@ -1309,55 +1260,33 @@
 
     while (!AcpiGbl_DbTerminateLoop)
     {
-        /* Force output to console until a command is entered */
+        /* Wait the readiness of the command */
 
-        AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
-        /* Different prompt if method is executing */
-
-        if (!AcpiGbl_MethodExecuting)
+        Status = AcpiOsWaitCommandReady ();
+        if (ACPI_FAILURE (Status))
         {
-            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+            break;
         }
-        else
-        {
-            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
-        }
 
-        /* Get the user input line */
+        /* Just call to the command line interpreter */
 
-        Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
-            ACPI_DB_LINE_BUFFER_SIZE, NULL);
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
-            return (Status);
-        }
+        AcpiGbl_MethodExecuting = FALSE;
+        AcpiGbl_StepToNextCall = FALSE;
 
-        /* Check for single or multithreaded debug */
+        (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
 
-        if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
-        {
-            /*
-             * Signal the debug thread that we have a command to execute,
-             * and wait for the command to complete.
-             */
-            AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
+        /* Notify the completion of the command */
 
-            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
-                ACPI_WAIT_FOREVER);
-            if (ACPI_FAILURE (Status))
-            {
-                return (Status);
-            }
-        }
-        else
+        Status = AcpiOsNotifyCommandComplete ();
+        if (ACPI_FAILURE (Status))
         {
-            /* Just call to the command line interpreter */
-
-            AcpiDbSingleThread ();
+            break;
         }
     }
 
+    if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
+    }
     return (Status);
 }

Modified: trunk/sys/contrib/dev/acpica/components/debugger/dbxface.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/debugger/dbxface.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/debugger/dbxface.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -96,50 +96,23 @@
 
     AcpiGbl_MethodExecuting = TRUE;
     Status = AE_CTRL_TRUE;
+
     while (Status == AE_CTRL_TRUE)
     {
-        if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+        /* Notify the completion of the command */
+
+        Status = AcpiOsNotifyCommandComplete ();
+        if (ACPI_FAILURE (Status))
         {
-            /* Handshake with the front-end that gets user command lines */
+            goto ErrorExit;
+        }
 
-            AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
+        /* Wait the readiness of the command */
 
-            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
-                ACPI_WAIT_FOREVER);
-            if (ACPI_FAILURE (Status))
-            {
-                return (Status);
-            }
-        }
-        else
+        Status = AcpiOsWaitCommandReady ();
+        if (ACPI_FAILURE (Status))
         {
-            /* Single threaded, we must get a command line ourselves */
-
-            /* Force output to console until a command is entered */
-
-            AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
-            /* Different prompt if method is executing */
-
-            if (!AcpiGbl_MethodExecuting)
-            {
-                AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
-            }
-            else
-            {
-                AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
-            }
-
-            /* Get the user input line */
-
-            Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
-                ACPI_DB_LINE_BUFFER_SIZE, NULL);
-            if (ACPI_FAILURE (Status))
-            {
-                ACPI_EXCEPTION ((AE_INFO, Status,
-                    "While parsing command line"));
-                return (Status);
-            }
+            goto ErrorExit;
         }
 
         Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op);
@@ -147,6 +120,12 @@
 
     /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */
 
+ErrorExit:
+    if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "While parsing/handling command line"));
+    }
     return (Status);
 }
 
@@ -494,8 +473,7 @@
     {
         /* These were created with one unit, grab it */
 
-        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
-            ACPI_WAIT_FOREVER);
+        Status = AcpiOsInitializeDebugger ();
         if (ACPI_FAILURE (Status))
         {
             AcpiOsPrintf ("Could not get debugger mutex\n");
@@ -502,14 +480,6 @@
             return_ACPI_STATUS (Status);
         }
 
-        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
-            ACPI_WAIT_FOREVER);
-        if (ACPI_FAILURE (Status))
-        {
-            AcpiOsPrintf ("Could not get debugger mutex\n");
-            return_ACPI_STATUS (Status);
-        }
-
         /* Create the debug execution thread to execute commands */
 
         AcpiGbl_DbThreadsTerminated = FALSE;
@@ -557,8 +527,6 @@
 
     if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
     {
-        AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
-
         /* Wait the AML Debugger threads */
 
         while (!AcpiGbl_DbThreadsTerminated)
@@ -565,6 +533,8 @@
         {
             AcpiOsSleep (100);
         }
+
+        AcpiOsTerminateDebugger ();
     }
 
     if (AcpiGbl_DbBuffer)

Modified: trunk/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/disassembler/dmopcode.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/disassembler/dmopcode.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -69,7 +69,14 @@
 AcpiDmPromoteSubtree (
     ACPI_PARSE_OBJECT       *StartOp);
 
+static BOOLEAN
+AcpiDmIsSwitchBlock (
+    ACPI_PARSE_OBJECT       *Op);
 
+static BOOLEAN
+AcpiDmIsCaseBlock (
+    ACPI_PARSE_OBJECT       *Op);
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDmDisplayTargetPathname
@@ -969,6 +976,28 @@
         AcpiDmNamestring (Op->Common.Value.Name);
         break;
 
+    case AML_WHILE_OP:
+
+        if (AcpiDmIsSwitchBlock(Op))
+        {
+            AcpiOsPrintf ("%s", "Switch");
+            break;
+        }
+
+        AcpiOsPrintf ("%s", OpInfo->Name);
+        break;
+
+    case AML_IF_OP:
+
+        if (Op->Common.DisasmOpcode == ACPI_DASM_CASE)
+        {
+            AcpiOsPrintf ("%s", "Case");
+            break;
+        }
+
+        AcpiOsPrintf ("%s", OpInfo->Name);
+        break;
+
     case AML_ELSE_OP:
 
         AcpiDmConvertToElseIf (Op);
@@ -1079,6 +1108,12 @@
     {
         /* Not a proper Else..If sequence, cannot convert to ElseIf */
 
+        if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+        {
+            AcpiOsPrintf ("%s", "Default");
+            return;
+        }
+
         AcpiOsPrintf ("%s", "Else");
         return;
     }
@@ -1088,13 +1123,42 @@
     ElseOp = IfOp->Common.Next;
     if (ElseOp && ElseOp->Common.Next)
     {
+        if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+        {
+            AcpiOsPrintf ("%s", "Default");
+            return;
+        }
+
         AcpiOsPrintf ("%s", "Else");
         return;
     }
 
-    /* Emit ElseIf, mark the IF as now an ELSEIF */
+    if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+    {
+        /*
+         * There is an ElseIf but in this case the Else is actually
+         * a Default block for a Switch/Case statement. No conversion.
+         */
+        AcpiOsPrintf ("%s", "Default");
+        return;
+    }
 
-    AcpiOsPrintf ("%s", "ElseIf");
+    if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_CASE)
+    {
+        /*
+         * This ElseIf is actually a Case block for a Switch/Case
+         * statement. Print Case but do not return so that we can
+         * promote the subtree and keep the indentation level.
+         */
+        AcpiOsPrintf ("%s", "Case");
+    }
+    else
+    {
+       /* Emit ElseIf, mark the IF as now an ELSEIF */
+
+        AcpiOsPrintf ("%s", "ElseIf");
+    }
+
     IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
 
     /* The IF parent will now be the same as the original ELSE parent */
@@ -1185,3 +1249,400 @@
         Op = Op->Common.Next;
     }
 }
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmIsTempName
+ *
+ * PARAMETERS:  Op              - Object to be examined
+ *
+ * RETURN:      TRUE if object is a temporary (_T_x) name
+ *
+ * DESCRIPTION: Determine if an object is a temporary name and ignore it.
+ *              Temporary names are only used for Switch statements. This
+ *              function depends on this restriced usage.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmIsTempName (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    char                    *Temp;
+
+    if (Op->Common.AmlOpcode != AML_NAME_OP)
+    {
+        return (FALSE);
+    }
+
+    Temp = (char *)(Op->Common.Aml);
+    ++Temp;
+
+    if (strncmp(Temp, "_T_", 3))
+    {
+        return (FALSE);
+    }
+
+    /* Ignore Op */
+
+    Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+    return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmIsSwitchBlock
+ *
+ * PARAMETERS:  Op              - While Object
+ *
+ * RETURN:      TRUE if While block can be converted to a Switch/Case block
+ *
+ * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies
+ *              parse tree to allow for Switch/Case disassembly during walk.
+ *
+ * EXAMPLE: Example of parse tree to be converted
+ *
+ *    While
+ *        One
+ *        Store
+ *            ByteConst
+ *             -NamePath-
+ *        If
+ *            LEqual
+ *                -NamePath-
+ *                Zero
+ *            Return
+ *                One
+ *        Else
+ *            Return
+ *                WordConst
+ *        Break
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiDmIsSwitchBlock (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *OneOp;
+    ACPI_PARSE_OBJECT       *StoreOp;
+    ACPI_PARSE_OBJECT       *NamePathOp;
+    ACPI_PARSE_OBJECT       *PredicateOp;
+    ACPI_PARSE_OBJECT       *CurrentOp;
+    ACPI_PARSE_OBJECT       *TempOp;
+
+    /* Check for One Op Predicate */
+
+    OneOp = AcpiPsGetArg (Op, 0);
+    if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP))
+    {
+        return (FALSE);
+    }
+
+    /* Check for Store Op */
+
+    StoreOp = OneOp->Common.Next;
+    if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP))
+    {
+        return (FALSE);
+    }
+
+    /* Check for Name Op with _T_ string */
+
+    NamePathOp = AcpiPsGetArg (StoreOp, 1);
+    if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+    {
+        return (FALSE);
+    }
+
+    if (strncmp((char *)(NamePathOp->Common.Aml), "_T_", 3))
+    {
+        return (FALSE);
+    }
+
+    /* This is a Switch/Case control block */
+
+    /* Ignore the One Op Predicate */
+
+    OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+    /* Ignore the Store Op, but not the children */
+
+    StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
+
+    /*
+     * First arg of Store Op is the Switch condition.
+     * Mark it as a Switch predicate and as a parameter list for paren
+     * closing and correct indentation.
+     */
+    PredicateOp = AcpiPsGetArg (StoreOp, 0);
+    PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
+    PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+    /* Ignore the Name Op */
+
+    NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
+
+    /* Remaining opcodes are the Case statements (If/ElseIf's) */
+
+    CurrentOp = StoreOp->Common.Next;
+    while (AcpiDmIsCaseBlock (CurrentOp))
+    {
+        /* Block is a Case structure */
+
+        if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+        {
+            /* ElseIf */
+
+            CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
+            CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+        }
+
+        /* If */
+
+        CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
+
+        /*
+         * Mark the parse tree for Case disassembly. There are two
+         * types of Case statements. The first type of statement begins with
+         * an LEqual. The second starts with an LNot and uses a Match statement
+         * on a Package of constants.
+         */
+        TempOp = AcpiPsGetArg (CurrentOp, 0);
+        switch (TempOp->Common.AmlOpcode)
+        {
+            case (AML_LEQUAL_OP):
+
+                /* Ignore just the LEqual Op */
+
+                TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
+
+                /* Ignore the NamePath Op */
+
+                TempOp = AcpiPsGetArg (TempOp, 0);
+                TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
+
+                /*
+                 * Second arg of LEqual will be the Case predicate.
+                 * Mark it as a predicate and also as a parameter list for paren
+                 * closing and correct indentation.
+                 */
+                PredicateOp = TempOp->Common.Next;
+                PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
+                PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+                break;
+
+            case (AML_LNOT_OP):
+
+                /*
+                 * The Package will be the predicate of the Case statement.
+                 * It's under:
+                 *            LNOT
+                 *                LEQUAL
+                 *                    MATCH
+                 *                        PACKAGE
+                 */
+
+                /* Get the LEqual Op from LNot */
+
+                TempOp = AcpiPsGetArg (TempOp, 0);
+
+                /* Get the Match Op from LEqual */
+
+                TempOp = AcpiPsGetArg (TempOp, 0);
+
+                /* Get the Package Op from Match */
+
+                PredicateOp = AcpiPsGetArg (TempOp, 0);
+
+                /* Mark as parameter list for paren closing */
+
+                PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+                /*
+                 * The Package list would be too deeply indented if we
+                 * chose to simply ignore the all the parent opcodes, so
+                 * we rearrange the parse tree instead.
+                 */
+
+                /*
+                 * Save the second arg of the If/Else Op which is the
+                 * block code of code for this Case statement.
+                 */
+                TempOp = AcpiPsGetArg (CurrentOp, 1);
+
+                /*
+                 * Move the Package Op to the child (predicate) of the
+                 * Case statement.
+                 */
+                CurrentOp->Common.Value.Arg = PredicateOp;
+                PredicateOp->Common.Parent = CurrentOp;
+
+                /* Add the block code */
+
+                PredicateOp->Common.Next = TempOp;
+
+                break;
+
+            default:
+
+                /* Should never get here */
+
+                break;
+        }
+
+        /* Advance to next Case block */
+
+        CurrentOp = CurrentOp->Common.Next;
+    }
+
+    /* If CurrentOp is now an Else, then this is a Default block */
+
+    if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+    {
+        CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT;
+    }
+
+    /*
+     * From the first If advance to the Break op. It's possible to
+     * have an Else (Default) op here when there is only one Case
+     * statement, so check for it.
+     */
+    CurrentOp = StoreOp->Common.Next->Common.Next;
+    if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+    {
+        CurrentOp = CurrentOp->Common.Next;
+    }
+
+    /* Ignore the Break Op */
+
+    CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+    return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmIsCaseBlock
+ *
+ * PARAMETERS:  Op              - Object to test
+ *
+ * RETURN:      TRUE if Object is beginning of a Case block.
+ *
+ * DESCRIPTION: Determines if an Object is the beginning of a Case block for a
+ *              Switch/Case statement. Parse tree must be one of the following
+ *              forms:
+ *
+ *              Else (Optional)
+ *                  If
+ *                      LEqual
+ *                          -NamePath- _T_x
+ *
+ *              Else (Optional)
+ *                  If
+ *                      LNot
+ *                          LEqual
+ *                              Match
+ *                                  Package
+ *                                      ByteConst
+ *                                      -NamePath- _T_x
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiDmIsCaseBlock (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *CurrentOp;
+
+    if (!Op)
+    {
+        return (FALSE);
+    }
+
+    /* Look for an If or ElseIf */
+
+    CurrentOp = Op;
+    if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+    {
+        CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+        if (!CurrentOp)
+        {
+            return (FALSE);
+        }
+    }
+
+    if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP)
+    {
+        return (FALSE);
+    }
+
+    /* Child must be LEqual or LNot */
+
+    CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+    if (!CurrentOp)
+    {
+        return (FALSE);
+    }
+
+    switch (CurrentOp->Common.AmlOpcode)
+    {
+        case (AML_LEQUAL_OP):
+
+            /* Next child must be NamePath with string _T_ */
+
+            CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+            if (!CurrentOp || !CurrentOp->Common.Value.Name ||
+                strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
+            {
+                return (FALSE);
+            }
+
+            break;
+
+        case (AML_LNOT_OP):
+
+            /* Child of LNot must be LEqual op */
+
+            CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+            if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LEQUAL_OP))
+            {
+                return (FALSE);
+            }
+
+            /* Child of LNot must be Match op */
+
+            CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+            if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP))
+            {
+                return (FALSE);
+            }
+
+            /* First child of Match must be Package op */
+
+            CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+            if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP))
+            {
+                return (FALSE);
+            }
+
+            /* Third child of Match must be NamePath with string _T_ */
+
+            CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2);
+            if (!CurrentOp || !CurrentOp->Common.Value.Name ||
+                strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
+            {
+                return (FALSE);
+            }
+
+            break;
+
+        default:
+
+            return (FALSE);
+    }
+
+    return (TRUE);
+}

Modified: trunk/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/disassembler/dmwalk.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/disassembler/dmwalk.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -456,6 +456,20 @@
         return (AE_CTRL_DEPTH);
     }
 
+    if (AcpiDmIsTempName(Op))
+    {
+        /* Ignore compiler generated temporary names */
+
+        return (AE_CTRL_DEPTH);
+    }
+
+    if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
+    {
+        /* Ignore this op, but not it's children */
+
+        return (AE_OK);
+    }
+
     if (Op->Common.AmlOpcode == AML_IF_OP)
     {
         NextOp = AcpiPsGetDepthNext (NULL, Op);
@@ -890,7 +904,8 @@
     ACPI_PARSE_OBJECT       *ParentOp;
 
 
-    if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
+    if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE ||
+        Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
     {
         /* Ignore this op -- it was handled elsewhere */
 
@@ -1050,9 +1065,12 @@
 
         /*
          * Just completed a parameter node for something like "Buffer (param)".
-         * Close the paren and open up the term list block with a brace
+         * Close the paren and open up the term list block with a brace.
+         *
+         * Switch predicates don't have a Next node but require a closing paren
+         * and opening brace.
          */
-        if (Op->Common.Next)
+        if (Op->Common.Next || Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
         {
             AcpiOsPrintf (")");
 
@@ -1067,6 +1085,13 @@
                 AcpiDmPredefinedDescription (ParentOp);
             }
 
+            /* Correct the indentation level for Switch and Case predicates */
+
+            if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
+            {
+                --Level;
+            }
+
             AcpiOsPrintf ("\n");
             AcpiDmIndent (Level - 1);
             AcpiOsPrintf ("{\n");

Modified: trunk/sys/contrib/dev/acpica/components/executer/exconfig.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/executer/exconfig.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/executer/exconfig.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -225,7 +225,7 @@
     AcpiExEnterInterpreter ();
     if (ACPI_FAILURE (Status))
     {
-	return_ACPI_STATUS (Status);
+        return_ACPI_STATUS (Status);
     }
 
     Status = AcpiExAddTable (TableIndex, &DdbHandle);

Modified: trunk/sys/contrib/dev/acpica/components/executer/exfldio.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/executer/exfldio.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/executer/exfldio.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -947,20 +947,9 @@
 
     AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
 
-    /*
-     * Create the bitmasks used for bit insertion.
-     * Note: This if/else is used to bypass compiler differences with the
-     * shift operator
-     */
-    if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
-    {
-        WidthMask = ACPI_UINT64_MAX;
-    }
-    else
-    {
-        WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth);
-    }
+    /* Create the bitmasks used for bit insertion */
 
+    WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth);
     Mask = WidthMask &
         ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
 

Modified: trunk/sys/contrib/dev/acpica/components/hardware/hwesleep.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/hardware/hwesleep.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/hardware/hwesleep.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -114,7 +114,7 @@
     UINT8                   SleepState)
 {
     ACPI_STATUS             Status;
-    UINT8                   SleepTypeValue;
+    UINT8                   SleepControl;
     UINT64                  SleepStatus;
 
 
@@ -140,10 +140,6 @@
 
     AcpiGbl_SystemAwakeAndRunning = FALSE;
 
-    /* Flush caches, as per ACPI specification */
-
-    ACPI_FLUSH_CPU_CACHE ();
-
     /*
      * Set the SLP_TYP and SLP_EN bits.
      *
@@ -153,16 +149,29 @@
     ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
         "Entering sleep state [S%u]\n", SleepState));
 
-    SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
-        ACPI_X_SLEEP_TYPE_MASK);
+    SleepControl = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
+        ACPI_X_SLEEP_TYPE_MASK) | ACPI_X_SLEEP_ENABLE;
 
-    Status = AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
-        &AcpiGbl_FADT.SleepControl);
+    /* Flush caches, as per ACPI specification */
+
+    ACPI_FLUSH_CPU_CACHE ();
+
+    Status = AcpiOsEnterSleep (SleepState, SleepControl, 0);
+    if (Status == AE_CTRL_TERMINATE)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
 
+    Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl);
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
     /* Wait for transition back to Working State */
 
     do

Modified: trunk/sys/contrib/dev/acpica/components/hardware/hwregs.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/hardware/hwregs.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/hardware/hwregs.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -55,6 +55,12 @@
 
 /* Local Prototypes */
 
+static UINT8
+AcpiHwGetAccessBitWidth (
+    UINT64                  Address,
+    ACPI_GENERIC_ADDRESS    *Reg,
+    UINT8                   MaxBitWidth);
+
 static ACPI_STATUS
 AcpiHwReadMultiple (
     UINT32                  *Value,
@@ -72,6 +78,90 @@
 
 /******************************************************************************
  *
+ * FUNCTION:    AcpiHwGetAccessBitWidth
+ *
+ * PARAMETERS:  Address             - GAS register address
+ *              Reg                 - GAS register structure
+ *              MaxBitWidth         - Max BitWidth supported (32 or 64)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Obtain optimal access bit width
+ *
+ ******************************************************************************/
+
+static UINT8
+AcpiHwGetAccessBitWidth (
+    UINT64                  Address,
+    ACPI_GENERIC_ADDRESS    *Reg,
+    UINT8                   MaxBitWidth)
+{
+    UINT8                   AccessBitWidth;
+
+
+    /*
+     * GAS format "register", used by FADT:
+     *  1. Detected if BitOffset is 0 and BitWidth is 8/16/32/64;
+     *  2. AccessSize field is ignored and BitWidth field is used for
+     *     determining the boundary of the IO accesses.
+     * GAS format "region", used by APEI registers:
+     *  1. Detected if BitOffset is not 0 or BitWidth is not 8/16/32/64;
+     *  2. AccessSize field is used for determining the boundary of the
+     *     IO accesses;
+     *  3. BitOffset/BitWidth fields are used to describe the "region".
+     *
+     * Note: This algorithm assumes that the "Address" fields should always
+     *       contain aligned values.
+     */
+    if (!Reg->BitOffset && Reg->BitWidth &&
+        ACPI_IS_POWER_OF_TWO (Reg->BitWidth) &&
+        ACPI_IS_ALIGNED (Reg->BitWidth, 8))
+    {
+        AccessBitWidth = Reg->BitWidth;
+    }
+    else if (Reg->AccessWidth)
+    {
+        AccessBitWidth = (1 << (Reg->AccessWidth + 2));
+    }
+    else
+    {
+        AccessBitWidth = ACPI_ROUND_UP_POWER_OF_TWO_8 (
+            Reg->BitOffset + Reg->BitWidth);
+        if (AccessBitWidth <= 8)
+        {
+            AccessBitWidth = 8;
+        }
+        else
+        {
+            while (!ACPI_IS_ALIGNED (Address, AccessBitWidth >> 3))
+            {
+                AccessBitWidth >>= 1;
+            }
+        }
+    }
+
+    /* Maximum IO port access bit width is 32 */
+
+    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO)
+    {
+        MaxBitWidth = 32;
+    }
+
+    /*
+     * Return access width according to the requested maximum access bit width,
+     * as the caller should know the format of the register and may enforce
+     * a 32-bit accesses.
+     */
+    if (AccessBitWidth < MaxBitWidth)
+    {
+        return (AccessBitWidth);
+    }
+    return (MaxBitWidth);
+}
+
+
+/******************************************************************************
+ *
  * FUNCTION:    AcpiHwValidateRegister
  *
  * PARAMETERS:  Reg                 - GAS register structure
@@ -92,7 +182,10 @@
     UINT8                   MaxBitWidth,
     UINT64                  *Address)
 {
+    UINT8                   BitWidth;
+    UINT8                   AccessWidth;
 
+
     /* Must have a valid pointer to a GAS structure */
 
     if (!Reg)
@@ -121,24 +214,25 @@
         return (AE_SUPPORT);
     }
 
-    /* Validate the BitWidth */
+    /* Validate the AccessWidth */
 
-    if ((Reg->BitWidth != 8) &&
-        (Reg->BitWidth != 16) &&
-        (Reg->BitWidth != 32) &&
-        (Reg->BitWidth != MaxBitWidth))
+    if (Reg->AccessWidth > 4)
     {
         ACPI_ERROR ((AE_INFO,
-            "Unsupported register bit width: 0x%X", Reg->BitWidth));
+            "Unsupported register access width: 0x%X", Reg->AccessWidth));
         return (AE_SUPPORT);
     }
 
-    /* Validate the BitOffset. Just a warning for now. */
+    /* Validate the BitWidth, convert AccessWidth into number of bits */
 
-    if (Reg->BitOffset != 0)
+    AccessWidth = AcpiHwGetAccessBitWidth (*Address, Reg, MaxBitWidth);
+    BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+    if (MaxBitWidth < BitWidth)
     {
         ACPI_WARNING ((AE_INFO,
-            "Unsupported register bit offset: 0x%X", Reg->BitOffset));
+            "Requested bit width 0x%X is smaller than register bit width 0x%X",
+            MaxBitWidth, BitWidth));
+        return (AE_SUPPORT);
     }
 
     return (AE_OK);
@@ -159,10 +253,7 @@
  *              64-bit values is not needed.
  *
  * LIMITATIONS: <These limitations also apply to AcpiHwWrite>
- *      BitWidth must be exactly 8, 16, or 32.
  *      SpaceID must be SystemMemory or SystemIO.
- *      BitOffset and AccessWidth are currently ignored, as there has
- *          not been a need to implement these.
  *
  ******************************************************************************/
 
@@ -172,7 +263,12 @@
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
     UINT64                  Value64;
+    UINT32                  Value32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -187,30 +283,58 @@
         return (Status);
     }
 
-    /* Initialize entire 32-bit return value to zero */
-
+    /*
+     * Initialize entire 32-bit return value to zero, convert AccessWidth
+     * into number of bits based
+     */
     *Value = 0;
+    AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32);
+    BitWidth = Reg->BitOffset + Reg->BitWidth;
+    BitOffset = Reg->BitOffset;
 
     /*
      * Two address spaces supported: Memory or IO. PCI_Config is
      * not supported here because the GAS structure is insufficient
      */
-    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+    Index = 0;
+    while (BitWidth)
     {
-        Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
-            Address, &Value64, Reg->BitWidth);
+        if (BitOffset >= AccessWidth)
+        {
+            Value32 = 0;
+            BitOffset -= AccessWidth;
+        }
+        else
+        {
+            if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+            {
+                Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    &Value64, AccessWidth);
+                Value32 = (UINT32) Value64;
+            }
+            else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+            {
+                Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    &Value32, AccessWidth);
+            }
+        }
 
-        *Value = (UINT32) Value64;
+        /*
+         * Use offset style bit writes because "Index * AccessWidth" is
+         * ensured to be less than 32-bits by AcpiHwValidateRegister().
+         */
+        ACPI_SET_BITS (Value, Index * AccessWidth,
+            ACPI_MASK_BITS_ABOVE_32 (AccessWidth), Value32);
+
+        BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+        Index++;
     }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
-            Address, Value, Reg->BitWidth);
-    }
 
     ACPI_DEBUG_PRINT ((ACPI_DB_IO,
         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-        *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+        *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
         AcpiUtGetRegionName (Reg->SpaceId)));
 
     return (Status);
@@ -238,6 +362,12 @@
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
+    UINT64                  Value64;
+    UINT32                  Value32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -252,24 +382,58 @@
         return (Status);
     }
 
+    /* Convert AccessWidth into number of bits based */
+
+    AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32);
+    BitWidth = Reg->BitOffset + Reg->BitWidth;
+    BitOffset = Reg->BitOffset;
+
     /*
      * Two address spaces supported: Memory or IO. PCI_Config is
      * not supported here because the GAS structure is insufficient
      */
-    if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+    Index = 0;
+    while (BitWidth)
     {
-        Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
-            Address, (UINT64) Value, Reg->BitWidth);
+        /*
+         * Use offset style bit reads because "Index * AccessWidth" is
+         * ensured to be less than 32-bits by AcpiHwValidateRegister().
+         */
+        Value32 = ACPI_GET_BITS (&Value, Index * AccessWidth,
+            ACPI_MASK_BITS_ABOVE_32 (AccessWidth));
+
+        if (BitOffset >= AccessWidth)
+        {
+            BitOffset -= AccessWidth;
+        }
+        else
+        {
+            if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+            {
+                Value64 = (UINT64) Value32;
+                Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    Value64, AccessWidth);
+            }
+            else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+            {
+                Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
+                    Address + Index * ACPI_DIV_8 (AccessWidth),
+                    Value32, AccessWidth);
+            }
+        }
+
+        /*
+         * Index * AccessWidth is ensured to be less than 32-bits by
+         * AcpiHwValidateRegister().
+         */
+        BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+        Index++;
     }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
-            Address, Value, Reg->BitWidth);
-    }
 
     ACPI_DEBUG_PRINT ((ACPI_DB_IO,
         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-        Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+        Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
         AcpiUtGetRegionName (Reg->SpaceId)));
 
     return (Status);

Modified: trunk/sys/contrib/dev/acpica/components/hardware/hwsleep.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/hardware/hwsleep.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/hardware/hwsleep.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -160,6 +160,16 @@
 
     ACPI_FLUSH_CPU_CACHE ();
 
+    Status = AcpiOsEnterSleep (SleepState, Pm1aControl, Pm1bControl);
+    if (Status == AE_CTRL_TERMINATE)
+    {
+        return_ACPI_STATUS (AE_OK);
+    }
+    if (ACPI_FAILURE (Status))
+    {
+        return_ACPI_STATUS (Status);
+    }
+
     /* Write #2: Write both SLP_TYP + SLP_EN */
 
     Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl);

Modified: trunk/sys/contrib/dev/acpica/components/parser/psargs.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/parser/psargs.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/parser/psargs.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -299,6 +299,20 @@
         PossibleMethodCall &&
         (Node->Type == ACPI_TYPE_METHOD))
     {
+        if ((GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) ||
+            (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_TARGET))
+        {
+            /*
+             * AcpiPsGetNextNamestring has increased the AML pointer past
+             * the method invocation namestring, so we need to restore the
+             * saved AML pointer back to the original method invocation
+             * namestring.
+             */
+            WalkState->ParserState.Aml = Start;
+            WalkState->ArgCount = 1;
+            AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+        }
+
         /* This name is actually a control method invocation */
 
         MethodDesc = AcpiNsGetAttachedObject (Node);
@@ -888,7 +902,10 @@
             AcpiUtGetArgumentTypeName (ArgType), ArgType));
 
         Subop = AcpiPsPeekOpcode (ParserState);
-        if (Subop == 0)
+        if (Subop == 0                  ||
+            AcpiPsIsLeadingChar (Subop) ||
+            ACPI_IS_ROOT_PREFIX (Subop) ||
+            ACPI_IS_PARENT_PREFIX (Subop))
         {
             /* NULL target (zero). Convert to a NULL namepath */
 
@@ -900,6 +917,13 @@
 
             Status = AcpiPsGetNextNamepath (WalkState, ParserState,
                 Arg, ACPI_POSSIBLE_METHOD_CALL);
+
+            if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP)
+            {
+                AcpiPsFreeOp (Arg);
+                Arg = NULL;
+                WalkState->ArgCount = 1;
+            }
         }
         else
         {

Modified: trunk/sys/contrib/dev/acpica/components/parser/pstree.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/parser/pstree.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/parser/pstree.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -143,7 +143,7 @@
     const ACPI_OPCODE_INFO  *OpInfo;
 
 
-    ACPI_FUNCTION_TRACE ("PsAppendArg");
+    ACPI_FUNCTION_TRACE (PsAppendArg);
 
 
     if (!Op)

Modified: trunk/sys/contrib/dev/acpica/components/utilities/utdecode.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/utilities/utdecode.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/utilities/utdecode.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -270,7 +270,7 @@
     if (!ObjDesc)
     {
         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
-        return_PTR ("[NULL Object Descriptor]");
+        return_STR ("[NULL Object Descriptor]");
     }
 
     /* These descriptor types share a common area */
@@ -283,7 +283,7 @@
             ACPI_GET_DESCRIPTOR_TYPE (ObjDesc),
             AcpiUtGetDescriptorName (ObjDesc), ObjDesc));
 
-        return_PTR ("Invalid object");
+        return_STR ("Invalid object");
     }
 
     return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type));

Modified: trunk/sys/contrib/dev/acpica/components/utilities/utdelete.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/utilities/utdelete.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/utilities/utdelete.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -450,8 +450,9 @@
         }
 
         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-            "Obj %p Type %.2X Refs %.2X [Incremented]\n",
-            Object, Object->Common.Type, NewCount));
+            "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n",
+            Object, Object->Common.Type,
+            AcpiUtGetObjectTypeName (Object), NewCount));
         break;
 
     case REF_DECREMENT:

Modified: trunk/sys/contrib/dev/acpica/components/utilities/utmutex.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/utilities/utmutex.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/utilities/utmutex.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -130,19 +130,6 @@
         return_ACPI_STATUS (Status);
     }
 
-#ifdef ACPI_DEBUGGER
-
-    /* Debugger Support */
-
-    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
-#endif
-
     return_ACPI_STATUS (Status);
 }
 
@@ -188,12 +175,6 @@
     /* Delete the reader/writer lock */
 
     AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
-
-#ifdef ACPI_DEBUGGER
-    AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
-    AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
-#endif
-
     return_VOID;
 }
 

Modified: trunk/sys/contrib/dev/acpica/components/utilities/utresrc.c
===================================================================
--- trunk/sys/contrib/dev/acpica/components/utilities/utresrc.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/components/utilities/utresrc.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -473,7 +473,7 @@
      * The absolute minimum resource template is one EndTag descriptor.
      * However, we will treat a lone EndTag as just a simple buffer.
      */
-    if (AmlLength <= sizeof (AML_RESOURCE_END_TAG))
+    if (AmlLength < sizeof (AML_RESOURCE_END_TAG))
     {
         return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
     }

Modified: trunk/sys/contrib/dev/acpica/include/acclib.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acclib.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acclib.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -105,6 +105,16 @@
     int                     ch);
 
 char *
+strpbrk (
+    const char              *String,
+    const char              *Delimiters);
+
+char *
+strtok (
+    char                    *String,
+    const char              *Delimiters);
+
+char *
 strcpy (
     char                    *DstString,
     const char              *SrcString);
@@ -166,6 +176,12 @@
     ACPI_SIZE               Count);
 
 void *
+memmove (
+    void                    *Dest,
+    const void              *Src,
+    ACPI_SIZE               Count);
+
+void *
 memset (
     void                    *Dest,
     int                     Value,
@@ -227,6 +243,13 @@
  */
 extern int errno;
 
+#ifndef EOF
+#define EOF                 (-1)
+#endif
+
+#define putchar(c)          fputc(stdout, c)
+#define getchar(c)          fgetc(stdin)
+
 int
 vprintf (
     const char              *Format,
@@ -281,6 +304,21 @@
 long
 ftell (
     FILE                    *File);
+
+int
+fgetc (
+    FILE                    *File);
+
+int
+fputc (
+    FILE                    *File,
+    char                    c);
+
+char *
+fgets (
+    char                    *s,
+    ACPI_SIZE               Size,
+    FILE                    *File);
 #endif
 
 #endif /* _ACCLIB_H */

Modified: trunk/sys/contrib/dev/acpica/include/acdebug.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acdebug.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acdebug.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -422,8 +422,7 @@
 
 ACPI_STATUS
 AcpiDbUserCommands (
-    char                    Prompt,
-    ACPI_PARSE_OBJECT       *Op);
+    void);
 
 char *
 AcpiDbGetNextToken (

Modified: trunk/sys/contrib/dev/acpica/include/acdisasm.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acdisasm.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acdisasm.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -430,7 +430,7 @@
  * dmtable and ahtable
  */
 extern const ACPI_DMTABLE_DATA  AcpiDmTableData[];
-extern const AH_TABLE           AcpiSupportedTables[];
+extern const AH_TABLE           Gbl_AcpiSupportedTables[];
 
 UINT8
 AcpiDmGenerateChecksum (
@@ -652,6 +652,10 @@
     ACPI_OP_WALK_INFO       *Info,
     ACPI_PARSE_OBJECT       *Op);
 
+BOOLEAN
+AcpiDmIsTempName (
+    ACPI_PARSE_OBJECT       *Op);
+
 UINT32
 AcpiDmListType (
     ACPI_PARSE_OBJECT       *Op);

Modified: trunk/sys/contrib/dev/acpica/include/acexcep.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acexcep.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acexcep.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -218,11 +218,10 @@
 #define AE_CTRL_TRANSFER                EXCEP_CTL (0x0008)
 #define AE_CTRL_BREAK                   EXCEP_CTL (0x0009)
 #define AE_CTRL_CONTINUE                EXCEP_CTL (0x000A)
-#define AE_CTRL_SKIP                    EXCEP_CTL (0x000B)
-#define AE_CTRL_PARSE_CONTINUE          EXCEP_CTL (0x000C)
-#define AE_CTRL_PARSE_PENDING           EXCEP_CTL (0x000D)
+#define AE_CTRL_PARSE_CONTINUE          EXCEP_CTL (0x000B)
+#define AE_CTRL_PARSE_PENDING           EXCEP_CTL (0x000C)
 
-#define AE_CODE_CTRL_MAX                0x000D
+#define AE_CODE_CTRL_MAX                0x000C
 
 
 /* Exception strings for AcpiFormatException */
@@ -345,7 +344,6 @@
     EXCEP_TXT ("AE_CTRL_TRANSFER",              "Transfer control to called method"),
     EXCEP_TXT ("AE_CTRL_BREAK",                 "A Break has been executed"),
     EXCEP_TXT ("AE_CTRL_CONTINUE",              "A Continue has been executed"),
-    EXCEP_TXT ("AE_CTRL_SKIP",                  "Not currently used"),
     EXCEP_TXT ("AE_CTRL_PARSE_CONTINUE",        "Used to skip over bad opcodes"),
     EXCEP_TXT ("AE_CTRL_PARSE_PENDING",         "Used to implement AML While loops")
 };

Modified: trunk/sys/contrib/dev/acpica/include/acglobal.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acglobal.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acglobal.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -332,7 +332,6 @@
 #ifdef ACPI_DEBUGGER
 
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_AbortMethod, FALSE);
-ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_MethodExecuting, FALSE);
 ACPI_INIT_GLOBAL (ACPI_THREAD_ID,       AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID);
 
 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_NoIniMethods);
@@ -351,7 +350,6 @@
 
 /* These buffers should all be the same size */
 
-ACPI_GLOBAL (char,                      AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
 ACPI_GLOBAL (char,                      AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]);
 ACPI_GLOBAL (char,                      AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]);
 ACPI_GLOBAL (char,                      AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]);
@@ -366,9 +364,6 @@
 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumNodes);
 ACPI_GLOBAL (UINT32,                    AcpiGbl_NumObjects);
 
-ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_DbCommandReady);
-ACPI_GLOBAL (ACPI_MUTEX,                AcpiGbl_DbCommandComplete);
-
 #endif /* ACPI_DEBUGGER */
 
 #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)

Modified: trunk/sys/contrib/dev/acpica/include/aclocal.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/aclocal.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/aclocal.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -924,7 +924,7 @@
     char                            AmlOpName[16])  /* Op name (debug only) */
 
 
-/* Flags for DisasmFlags field  above */
+/* Internal opcodes for DisasmOpcode field above */
 
 #define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
 #define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
@@ -937,7 +937,10 @@
 #define ACPI_DASM_LNOT_PREFIX           0x08        /* Start of a LNotEqual (etc.) pair of opcodes */
 #define ACPI_DASM_LNOT_SUFFIX           0x09        /* End  of a LNotEqual (etc.) pair of opcodes */
 #define ACPI_DASM_HID_STRING            0x0A        /* String is a _HID or _CID */
-#define ACPI_DASM_IGNORE                0x0B        /* Not used at this time */
+#define ACPI_DASM_IGNORE_SINGLE         0x0B        /* Ignore the opcode but not it's children */
+#define ACPI_DASM_SWITCH_PREDICATE      0x0C        /* Object is a predicate for a Switch or Case block */
+#define ACPI_DASM_CASE                  0x0D        /* If/Else is a Case in a Switch/Case block */
+#define ACPI_DASM_DEFAULT               0x0E        /* Else is a Default in a Switch/Case block */
 
 /*
  * Generic operation (for example:  If, While, Store)

Modified: trunk/sys/contrib/dev/acpica/include/acmacros.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acmacros.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acmacros.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -48,7 +48,7 @@
 
 /*
  * Extract data using a pointer. Any more than a byte and we
- * get into potential aligment issues -- see the STORE macros below.
+ * get into potential alignment issues -- see the STORE macros below.
  * Use with care.
  */
 #define ACPI_CAST8(ptr)                 ACPI_CAST_PTR (UINT8, (ptr))
@@ -65,7 +65,7 @@
 #define ACPI_SET64(ptr, val)            (*ACPI_CAST64 (ptr) = (UINT64) (val))
 
 /*
- * printf() format helper. This macros is a workaround for the difficulties
+ * printf() format helper. This macro is a workaround for the difficulties
  * with emitting 64-bit integers and 64-bit pointers with the same code
  * for both 32-bit and 64-bit hosts.
  */
@@ -265,14 +265,93 @@
 
 #define ACPI_IS_MISALIGNED(value)           (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1))
 
+/* Generic bit manipulation */
+
+#ifndef ACPI_USE_NATIVE_BIT_FINDER
+
+#define __ACPI_FIND_LAST_BIT_2(a, r)        ((((UINT8)  (a)) & 0x02) ? (r)+1 : (r))
+#define __ACPI_FIND_LAST_BIT_4(a, r)        ((((UINT8)  (a)) & 0x0C) ? \
+                                             __ACPI_FIND_LAST_BIT_2  ((a)>>2,  (r)+2) : \
+                                             __ACPI_FIND_LAST_BIT_2  ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_8(a, r)        ((((UINT8)  (a)) & 0xF0) ? \
+                                             __ACPI_FIND_LAST_BIT_4  ((a)>>4,  (r)+4) : \
+                                             __ACPI_FIND_LAST_BIT_4  ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_16(a, r)       ((((UINT16) (a)) & 0xFF00) ? \
+                                             __ACPI_FIND_LAST_BIT_8  ((a)>>8,  (r)+8) : \
+                                             __ACPI_FIND_LAST_BIT_8  ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_32(a, r)       ((((UINT32) (a)) & 0xFFFF0000) ? \
+                                             __ACPI_FIND_LAST_BIT_16 ((a)>>16, (r)+16) : \
+                                             __ACPI_FIND_LAST_BIT_16 ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_64(a, r)       ((((UINT64) (a)) & 0xFFFFFFFF00000000) ? \
+                                             __ACPI_FIND_LAST_BIT_32 ((a)>>32, (r)+32) : \
+                                             __ACPI_FIND_LAST_BIT_32 ((a), (r)))
+
+#define ACPI_FIND_LAST_BIT_8(a)             ((a) ? __ACPI_FIND_LAST_BIT_8 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_16(a)            ((a) ? __ACPI_FIND_LAST_BIT_16 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_32(a)            ((a) ? __ACPI_FIND_LAST_BIT_32 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_64(a)            ((a) ? __ACPI_FIND_LAST_BIT_64 (a, 1) : 0)
+
+#define __ACPI_FIND_FIRST_BIT_2(a, r)       ((((UINT8) (a)) & 0x01) ? (r) : (r)+1)
+#define __ACPI_FIND_FIRST_BIT_4(a, r)       ((((UINT8) (a)) & 0x03) ? \
+                                             __ACPI_FIND_FIRST_BIT_2  ((a), (r)) : \
+                                             __ACPI_FIND_FIRST_BIT_2  ((a)>>2, (r)+2))
+#define __ACPI_FIND_FIRST_BIT_8(a, r)       ((((UINT8) (a)) & 0x0F) ? \
+                                             __ACPI_FIND_FIRST_BIT_4  ((a), (r)) : \
+                                             __ACPI_FIND_FIRST_BIT_4  ((a)>>4, (r)+4))
+#define __ACPI_FIND_FIRST_BIT_16(a, r)      ((((UINT16) (a)) & 0x00FF) ? \
+                                             __ACPI_FIND_FIRST_BIT_8  ((a), (r)) : \
+                                             __ACPI_FIND_FIRST_BIT_8  ((a)>>8, (r)+8))
+#define __ACPI_FIND_FIRST_BIT_32(a, r)      ((((UINT32) (a)) & 0x0000FFFF) ? \
+                                             __ACPI_FIND_FIRST_BIT_16 ((a), (r)) : \
+                                             __ACPI_FIND_FIRST_BIT_16 ((a)>>16, (r)+16))
+#define __ACPI_FIND_FIRST_BIT_64(a, r)      ((((UINT64) (a)) & 0x00000000FFFFFFFF) ? \
+                                             __ACPI_FIND_FIRST_BIT_32 ((a), (r)) : \
+                                             __ACPI_FIND_FIRST_BIT_32 ((a)>>32, (r)+32))
+
+#define ACPI_FIND_FIRST_BIT_8(a)            ((a) ? __ACPI_FIND_FIRST_BIT_8 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_16(a)           ((a) ? __ACPI_FIND_FIRST_BIT_16 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_32(a)           ((a) ? __ACPI_FIND_FIRST_BIT_32 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_64(a)           ((a) ? __ACPI_FIND_FIRST_BIT_64 (a, 1) : 0)
+
+#endif /* ACPI_USE_NATIVE_BIT_FINDER */
+
+/* Generic (power-of-two) rounding */
+
+#define ACPI_ROUND_UP_POWER_OF_TWO_8(a)     ((UINT8) \
+                                            (((UINT16) 1) <<  ACPI_FIND_LAST_BIT_8  ((a)  - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_8(a)   ((UINT8) \
+                                            (((UINT16) 1) << (ACPI_FIND_LAST_BIT_8  ((a)) - 1)))
+#define ACPI_ROUND_UP_POWER_OF_TWO_16(a)    ((UINT16) \
+                                            (((UINT32) 1) <<  ACPI_FIND_LAST_BIT_16 ((a)  - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_16(a)  ((UINT16) \
+                                            (((UINT32) 1) << (ACPI_FIND_LAST_BIT_16 ((a)) - 1)))
+#define ACPI_ROUND_UP_POWER_OF_TWO_32(a)    ((UINT32) \
+                                            (((UINT64) 1) <<  ACPI_FIND_LAST_BIT_32 ((a)  - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_32(a)  ((UINT32) \
+                                            (((UINT64) 1) << (ACPI_FIND_LAST_BIT_32 ((a)) - 1)))
+#define ACPI_IS_ALIGNED(a, s)               (((a) & ((s) - 1)) == 0)
+#define ACPI_IS_POWER_OF_TWO(a)             ACPI_IS_ALIGNED(a, a)
+
 /*
  * Bitmask creation
  * Bit positions start at zero.
  * MASK_BITS_ABOVE creates a mask starting AT the position and above
  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ * MASK_BITS_ABOVE/BELOW accepts a bit offset to create a mask
+ * MASK_BITS_ABOVE/BELOW_32/64 accepts a bit width to create a mask
+ * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
+ * differences with the shift operator
  */
 #define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_UINT64_MAX) << ((UINT32) (position))))
 #define ACPI_MASK_BITS_BELOW(position)      ((ACPI_UINT64_MAX) << ((UINT32) (position)))
+#define ACPI_MASK_BITS_ABOVE_32(width)      ((UINT32) ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_32(width)      ((UINT32) ACPI_MASK_BITS_BELOW(width))
+#define ACPI_MASK_BITS_ABOVE_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
+                                                ACPI_UINT64_MAX : \
+                                                ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
+                                                (UINT64) 0 : \
+                                                ACPI_MASK_BITS_BELOW(width))
 
 /* Bitfields within ACPI registers */
 
@@ -377,7 +456,7 @@
  */
 #ifndef ACPI_NO_ERROR_MESSAGES
 /*
- * Error reporting. Callers module and line number are inserted by AE_INFO,
+ * Error reporting. The callers module and line number are inserted by AE_INFO,
  * the plist contains a set of parens to allow variable-length lists.
  * These macros are used for both the debug and non-debug versions of the code.
  */

Modified: trunk/sys/contrib/dev/acpica/include/acpiosxf.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acpiosxf.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acpiosxf.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -457,7 +457,15 @@
     void                    *Info);
 #endif
 
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep
+ACPI_STATUS
+AcpiOsEnterSleep (
+    UINT8                   SleepState,
+    UINT32                  RegaValue,
+    UINT32                  RegbValue);
+#endif
 
+
 /*
  * Debug print routines
  */
@@ -483,7 +491,7 @@
 
 
 /*
- * Debug input
+ * Debug IO
  */
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
 ACPI_STATUS
@@ -493,6 +501,30 @@
     UINT32                  *BytesRead);
 #endif
 
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
+ACPI_STATUS
+AcpiOsInitializeDebugger (
+    void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
+void
+AcpiOsTerminateDebugger (
+    void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitCommandReady
+ACPI_STATUS
+AcpiOsWaitCommandReady (
+    void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsNotifyCommandComplete
+ACPI_STATUS
+AcpiOsNotifyCommandComplete (
+    void);
+#endif
+
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
 void
 AcpiOsTracePoint (

Modified: trunk/sys/contrib/dev/acpica/include/acpixf.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/acpixf.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/acpixf.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -47,7 +47,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20161117
+#define ACPI_CA_VERSION                 0x20161222
 
 #include <contrib/dev/acpica/include/acconfig.h>
 #include <contrib/dev/acpica/include/actypes.h>
@@ -294,6 +294,15 @@
 ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_DisplayDebugTimer, FALSE);
 
 /*
+ * Debugger command handshake globals. Host OSes need to access these
+ * variables to implement their own command handshake mechanism.
+ */
+#ifdef ACPI_DEBUGGER
+ACPI_INIT_GLOBAL (BOOLEAN,          AcpiGbl_MethodExecuting, FALSE);
+ACPI_GLOBAL (char,                  AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
+#endif
+
+/*
  * Other miscellaneous globals
  */
 ACPI_GLOBAL (ACPI_TABLE_FADT,       AcpiGbl_FADT);
@@ -1268,6 +1277,10 @@
     void);
 
 void
+AcpiRunDebugger (
+    char                    *BatchBuffer);
+
+void
 AcpiSetDebuggerThreadId (
     ACPI_THREAD_ID          ThreadId);
 

Modified: trunk/sys/contrib/dev/acpica/include/platform/acenv.h
===================================================================
--- trunk/sys/contrib/dev/acpica/include/platform/acenv.h	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/include/platform/acenv.h	2018-10-21 15:50:05 UTC (rev 12108)
@@ -77,7 +77,8 @@
     (defined ACPI_NAMES_APP)    || \
     (defined ACPI_SRC_APP)      || \
     (defined ACPI_XTRACT_APP)   || \
-    (defined ACPI_EXAMPLE_APP)
+    (defined ACPI_EXAMPLE_APP)  || \
+    (defined ACPI_EFI_HELLO)
 #define ACPI_APPLICATION
 #define ACPI_SINGLE_THREADED
 #define USE_NATIVE_ALLOCATE_ZEROED
@@ -362,7 +363,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#ifdef ACPI_APPLICATION
+#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
 #include <stdio.h>
 #include <fcntl.h>
 #include <errno.h>

Added: trunk/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c
===================================================================
--- trunk/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c	                        (rev 0)
+++ trunk/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -0,0 +1,366 @@
+/******************************************************************************
+ *
+ * Module Name: osgendbg - Generic debugger command singalling
+ *
+ *****************************************************************************/
+
+/*
+ * 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 <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+#include <contrib/dev/acpica/include/acdebug.h>
+
+
+#define _COMPONENT          ACPI_CA_DEBUGGER
+        ACPI_MODULE_NAME    ("osgendbg")
+
+
+/* Local prototypes */
+
+static void
+AcpiDbRunRemoteDebugger (
+    char                    *BatchBuffer);
+
+
+static ACPI_MUTEX           AcpiGbl_DbCommandReady;
+static ACPI_MUTEX           AcpiGbl_DbCommandComplete;
+static BOOLEAN              AcpiGbl_DbCommandSignalsInitialized = FALSE;
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiDbRunRemoteDebugger
+ *
+ * PARAMETERS:  BatchBuffer         - Buffer containing commands running in
+ *                                    the batch mode
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Run multi-threading debugger remotely
+ *
+ *****************************************************************************/
+
+static void
+AcpiDbRunRemoteDebugger (
+    char                    *BatchBuffer)
+{
+    ACPI_STATUS             Status;
+    char                    *Ptr = BatchBuffer;
+    char                    *Cmd = Ptr;
+
+
+    while (!AcpiGbl_DbTerminateLoop)
+    {
+        if (BatchBuffer)
+        {
+            if (*Ptr)
+            {
+                while (*Ptr)
+                {
+                    if (*Ptr == ',')
+                    {
+                        /* Convert commas to spaces */
+                        *Ptr = ' ';
+                    }
+                    else if (*Ptr == ';')
+                    {
+                        *Ptr = '\0';
+                        continue;
+                    }
+
+                    Ptr++;
+                }
+
+                strncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE);
+                Ptr++;
+                Cmd = Ptr;
+            }
+            else
+            {
+                return;
+            }
+        }
+        else
+        {
+            /* Force output to console until a command is entered */
+
+            AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+            /* Different prompt if method is executing */
+
+            if (!AcpiGbl_MethodExecuting)
+            {
+                AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+            }
+            else
+            {
+                AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+            }
+
+            /* Get the user input line */
+
+            Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
+                ACPI_DB_LINE_BUFFER_SIZE, NULL);
+            if (ACPI_FAILURE (Status))
+            {
+                return;
+            }
+        }
+
+        /*
+         * Signal the debug thread that we have a command to execute,
+         * and wait for the command to complete.
+         */
+        AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
+
+        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
+            ACPI_WAIT_FOREVER);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+    }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiOsWaitCommandReady
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Negotiate with the debugger foreground thread (the user
+ *              thread) to wait the readiness of a command.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWaitCommandReady (
+    void)
+{
+    ACPI_STATUS             Status = AE_OK;
+
+
+    if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+    {
+        Status = AE_TIME;
+
+        while (Status == AE_TIME)
+        {
+            if (AcpiGbl_DbTerminateLoop)
+            {
+                Status = AE_CTRL_TERMINATE;
+            }
+            else
+            {
+                Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, 1000);
+            }
+        }
+    }
+    else
+    {
+        /* Force output to console until a command is entered */
+
+        AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+        /* Different prompt if method is executing */
+
+        if (!AcpiGbl_MethodExecuting)
+        {
+            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+        }
+        else
+        {
+            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+        }
+
+        /* Get the user input line */
+
+        Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
+            ACPI_DB_LINE_BUFFER_SIZE, NULL);
+    }
+
+    if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "While parsing/handling command line"));
+    }
+    return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiOsNotifyCommandComplete
+ *
+ * PARAMETERS:  void
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Negotiate with the debugger foreground thread (the user
+ *              thread) to notify the completion of a command.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsNotifyCommandComplete (
+    void)
+{
+
+    if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+    {
+        AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
+    }
+    return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiOsInitializeDebugger
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initialize OSPM specific part of the debugger
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsInitializeDebugger (
+    void)
+{
+    ACPI_STATUS             Status;
+
+
+    /* Create command signals */
+
+    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+    Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorReady;
+    }
+
+    /* Initialize the states of the command signals */
+
+    Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
+        ACPI_WAIT_FOREVER);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorComplete;
+    }
+    Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
+        ACPI_WAIT_FOREVER);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorComplete;
+    }
+
+    AcpiGbl_DbCommandSignalsInitialized = TRUE;
+    return (Status);
+
+ErrorComplete:
+    AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+ErrorReady:
+    AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+    return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiOsTerminateDebugger
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Terminate signals used by the multi-threading debugger
+ *
+ *****************************************************************************/
+
+void
+AcpiOsTerminateDebugger (
+    void)
+{
+
+    if (AcpiGbl_DbCommandSignalsInitialized)
+    {
+        AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+        AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+    }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiRunDebugger
+ *
+ * PARAMETERS:  BatchBuffer         - Buffer containing commands running in
+ *                                    the batch mode
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Run a local/remote debugger
+ *
+ *****************************************************************************/
+
+void
+AcpiRunDebugger (
+    char                    *BatchBuffer)
+{
+    /* Check for single or multithreaded debug */
+
+    if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
+    {
+        AcpiDbRunRemoteDebugger (BatchBuffer);
+    }
+    else
+    {
+        AcpiDbUserCommands ();
+    }
+}
+
+ACPI_EXPORT_SYMBOL (AcpiRunDebugger)


Property changes on: trunk/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
===================================================================
--- trunk/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -362,6 +362,33 @@
 
 /******************************************************************************
  *
+ * FUNCTION:    AcpiOsEnterSleep
+ *
+ * PARAMETERS:  SleepState          - Which sleep state to enter
+ *              RegaValue           - Register A value
+ *              RegbValue           - Register B value
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: A hook before writing sleep registers to enter the sleep
+ *              state. Return AE_CTRL_SKIP to skip further sleep register
+ *              writes.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsEnterSleep (
+    UINT8                   SleepState,
+    UINT32                  RegaValue,
+    UINT32                  RegbValue)
+{
+
+    return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
  * FUNCTION:    AcpiOsRedirectOutput
  *
  * PARAMETERS:  Destination         - An open file handle/pointer

Modified: trunk/sys/dev/acpica/Osd/OsdDebug.c
===================================================================
--- trunk/sys/dev/acpica/Osd/OsdDebug.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/dev/acpica/Osd/OsdDebug.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -100,7 +100,6 @@
 void
 acpi_EnterDebugger(void)
 {
-    ACPI_PARSE_OBJECT	obj;
     static int		initted = 0;
 
     if (!initted) {
@@ -110,6 +109,6 @@
     }
 
     printf("Entering ACPICA debugger...\n");
-    AcpiDbUserCommands('A', &obj);
+    AcpiDbUserCommands();
 }
 #endif /* ACPI_DEBUGGER */

Modified: trunk/sys/dev/acpica/Osd/OsdHardware.c
===================================================================
--- trunk/sys/dev/acpica/Osd/OsdHardware.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/sys/dev/acpica/Osd/OsdHardware.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -38,6 +38,13 @@
 #include <machine/iodev.h>
 #include <machine/pci_cfgreg.h>
 
+ACPI_STATUS
+AcpiOsEnterSleep(UINT8 SleepState, UINT32 RegaValue, UINT32 RegbValue)
+{
+
+	return (AE_OK);
+}
+
 /*
  * ACPICA's rather gung-ho approach to hardware resource ownership is a little
  * troublesome insofar as there is no easy way for us to know in advance

Modified: trunk/usr.sbin/acpi/acpidb/Makefile
===================================================================
--- trunk/usr.sbin/acpi/acpidb/Makefile	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/usr.sbin/acpi/acpidb/Makefile	2018-10-21 15:50:05 UTC (rev 12108)
@@ -70,7 +70,7 @@
 	utxface.c utxferror.c utxfinit.c
 
 # os_specific/service_layers
-SRCS+=	osunixxf.c
+SRCS+=	osgendbg.c osunixxf.c
 
 MAN=	acpidb.8
 WARNS?=	3

Modified: trunk/usr.sbin/acpi/acpidb/acpidb.c
===================================================================
--- trunk/usr.sbin/acpi/acpidb/acpidb.c	2018-10-21 15:20:53 UTC (rev 12107)
+++ trunk/usr.sbin/acpi/acpidb/acpidb.c	2018-10-21 15:50:05 UTC (rev 12108)
@@ -496,7 +496,7 @@
 
 	AcpiInitializeDebugger();
 	AcpiGbl_DebuggerConfiguration = 0;
-	AcpiDbUserCommands(':', NULL);
+	AcpiDbUserCommands();
 
 	if (dounlink) {
 		unlink(filetmp);



More information about the Midnightbsd-cvs mailing list