diff mbox

ACPICA: Update to version 20161222

Message ID 20161227234144.1967-1-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Dec. 27, 2016, 11:41 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Changes in this release of ACPICA are detailed at the following
link on the ACPICA developer mailing list:

https://lists.acpica.org/pipermail/devel/2016-December/001072.html

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/Makefile.am                             |   3 +-
 src/acpica/source/common/acfileio.c                |   2 +-
 src/acpica/source/common/ahtable.c                 |   6 +-
 src/acpica/source/common/ahuuids.c                 |   4 +-
 src/acpica/source/compiler/aslutils.c              |   2 +-
 src/acpica/source/components/debugger/dbinput.c    | 111 +----
 src/acpica/source/components/debugger/dbxface.c    |  70 +---
 .../source/components/disassembler/dmopcode.c      | 465 ++++++++++++++++++++-
 src/acpica/source/components/disassembler/dmwalk.c |  31 +-
 src/acpica/source/components/executer/exconfig.c   |   2 +-
 src/acpica/source/components/executer/exfldio.c    |  15 +-
 src/acpica/source/components/hardware/hwesleep.c   |  27 +-
 src/acpica/source/components/hardware/hwregs.c     | 230 ++++++++--
 src/acpica/source/components/hardware/hwsleep.c    |  10 +
 src/acpica/source/components/parser/psargs.c       |  26 +-
 src/acpica/source/components/parser/pstree.c       |   2 +-
 src/acpica/source/components/utilities/utdecode.c  |   4 +-
 src/acpica/source/components/utilities/utdelete.c  |   5 +-
 src/acpica/source/components/utilities/utmutex.c   |  19 -
 src/acpica/source/components/utilities/utresrc.c   |   2 +-
 src/acpica/source/include/acdebug.h                |   3 +-
 src/acpica/source/include/acdisasm.h               |   6 +-
 src/acpica/source/include/acexcep.h                |   8 +-
 src/acpica/source/include/acglobal.h               |   5 -
 src/acpica/source/include/aclocal.h                |   7 +-
 src/acpica/source/include/acmacros.h               |  85 +++-
 src/acpica/source/include/acpiosxf.h               |  34 +-
 src/acpica/source/include/acpixf.h                 |  15 +-
 src/acpica/source/include/platform/acenv.h         |   5 +-
 src/acpica/source/include/platform/aclinux.h       |   2 +
 src/acpica/source/include/platform/aclinuxex.h     |  14 +
 .../source/os_specific/service_layers/osgendbg.c   | 438 +++++++++++++++++++
 .../source/os_specific/service_layers/osunixxf.c   |  27 ++
 33 files changed, 1427 insertions(+), 258 deletions(-)
 create mode 100644 src/acpica/source/os_specific/service_layers/osgendbg.c

Comments

Alex Hung Dec. 29, 2016, 10:03 a.m. UTC | #1
On 2016-12-27 03:41 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Changes in this release of ACPICA are detailed at the following
> link on the ACPICA developer mailing list:
>
> https://lists.acpica.org/pipermail/devel/2016-December/001072.html
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---


I got the below error message as below when I first compiled fwts with 
this patch.

/usr/local/lib/fwts/libfwtsiasl.so.1: undefined reference to 
`AcpiSupportedTables'

It can be fixed by manually deleting this file.

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Jan. 4, 2017, 3:13 a.m. UTC | #2
On 2016年12月28日 07:41, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Changes in this release of ACPICA are detailed at the following
> link on the ACPICA developer mailing list:
>
> https://lists.acpica.org/pipermail/devel/2016-December/001072.html
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/Makefile.am                             |   3 +-
>  src/acpica/source/common/acfileio.c                |   2 +-
>  src/acpica/source/common/ahtable.c                 |   6 +-
>  src/acpica/source/common/ahuuids.c                 |   4 +-
>  src/acpica/source/compiler/aslutils.c              |   2 +-
>  src/acpica/source/components/debugger/dbinput.c    | 111 +----
>  src/acpica/source/components/debugger/dbxface.c    |  70 +---
>  .../source/components/disassembler/dmopcode.c      | 465 ++++++++++++++++++++-
>  src/acpica/source/components/disassembler/dmwalk.c |  31 +-
>  src/acpica/source/components/executer/exconfig.c   |   2 +-
>  src/acpica/source/components/executer/exfldio.c    |  15 +-
>  src/acpica/source/components/hardware/hwesleep.c   |  27 +-
>  src/acpica/source/components/hardware/hwregs.c     | 230 ++++++++--
>  src/acpica/source/components/hardware/hwsleep.c    |  10 +
>  src/acpica/source/components/parser/psargs.c       |  26 +-
>  src/acpica/source/components/parser/pstree.c       |   2 +-
>  src/acpica/source/components/utilities/utdecode.c  |   4 +-
>  src/acpica/source/components/utilities/utdelete.c  |   5 +-
>  src/acpica/source/components/utilities/utmutex.c   |  19 -
>  src/acpica/source/components/utilities/utresrc.c   |   2 +-
>  src/acpica/source/include/acdebug.h                |   3 +-
>  src/acpica/source/include/acdisasm.h               |   6 +-
>  src/acpica/source/include/acexcep.h                |   8 +-
>  src/acpica/source/include/acglobal.h               |   5 -
>  src/acpica/source/include/aclocal.h                |   7 +-
>  src/acpica/source/include/acmacros.h               |  85 +++-
>  src/acpica/source/include/acpiosxf.h               |  34 +-
>  src/acpica/source/include/acpixf.h                 |  15 +-
>  src/acpica/source/include/platform/acenv.h         |   5 +-
>  src/acpica/source/include/platform/aclinux.h       |   2 +
>  src/acpica/source/include/platform/aclinuxex.h     |  14 +
>  .../source/os_specific/service_layers/osgendbg.c   | 438 +++++++++++++++++++
>  .../source/os_specific/service_layers/osunixxf.c   |  27 ++
>  33 files changed, 1427 insertions(+), 258 deletions(-)
>  create mode 100644 src/acpica/source/os_specific/service_layers/osgendbg.c
>
> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
> index a58d777..d91b7af 100644
> --- a/src/acpica/Makefile.am
> +++ b/src/acpica/Makefile.am
> @@ -254,7 +254,8 @@ libfwtsacpica_la_SOURCES =				\
>  	source/common/ahuuids.c				\
>  	source/tools/acpiexec/aeinitfile.c		\
>  	source/tools/acpiexec/aehandlers.c		\
> -	source/tools/acpiexec/aeregion.c
> +	source/tools/acpiexec/aeregion.c		\
> +	source/os_specific/service_layers/osgendbg.c
>
>  libfwtsacpica_la_LIBADD = \
>  	-L$(top_builddir)/src/lib/src -lfwts -lrt
> diff --git a/src/acpica/source/common/acfileio.c b/src/acpica/source/common/acfileio.c
> index 9b4564e..ca7e79e 100644
> --- a/src/acpica/source/common/acfileio.c
> +++ b/src/acpica/source/common/acfileio.c
> @@ -475,7 +475,7 @@ AcValidateTableHeader (
>      UINT32                  i;
>
>
> -    ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
> +    ACPI_FUNCTION_TRACE (AcValidateTableHeader);
>
>
>      /* Read a potential table header */
> diff --git a/src/acpica/source/common/ahtable.c b/src/acpica/source/common/ahtable.c
> index 59ddc83..67d1eea 100644
> --- a/src/acpica/source/common/ahtable.c
> +++ b/src/acpica/source/common/ahtable.c
> @@ -123,7 +123,7 @@ const AH_TABLE *
>  AcpiAhGetTableInfo (
>      char                    *Signature);
>
> -extern const AH_TABLE      AcpiSupportedTables[];
> +extern const AH_TABLE      Gbl_AcpiSupportedTables[];
>
>
>  /*******************************************************************************
> @@ -145,7 +145,7 @@ AcpiAhGetTableInfo (
>      const AH_TABLE      *Info;
>
>
> -    for (Info = AcpiSupportedTables; Info->Signature; Info++)
> +    for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++)
>      {
>          if (ACPI_COMPARE_NAME (Signature, Info->Signature))
>          {
> @@ -161,7 +161,7 @@ AcpiAhGetTableInfo (
>   * 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"},
> diff --git a/src/acpica/source/common/ahuuids.c b/src/acpica/source/common/ahuuids.c
> index abcdfce..157a5ee 100644
> --- a/src/acpica/source/common/ahuuids.c
> +++ b/src/acpica/source/common/ahuuids.c
> @@ -124,7 +124,7 @@
>  /*
>   * Table of "known" (ACPI-related) UUIDs
>   */
> -const AH_UUID  AcpiUuids[] =
> +const AH_UUID  Gbl_AcpiUuids[] =
>  {
>      {"[Controllers]",               NULL},
>      {"GPIO Controller",             UUID_GPIO_CONTROLLER},
> @@ -184,7 +184,7 @@ AcpiAhMatchUuid (
>
>      /* 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 */
>
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 5889459..c1033f5 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -227,7 +227,7 @@ UtDisplaySupportedTables (
>      /* 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,
> diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
> index f41ad81..6bcb84b 100644
> --- a/src/acpica/source/components/debugger/dbinput.c
> +++ b/src/acpica/source/components/debugger/dbinput.c
> @@ -136,10 +136,6 @@ AcpiDbMatchCommand (
>      char                    *UserCommand);
>
>  static void
> -AcpiDbSingleThread (
> -    void);
> -
> -static void
>  AcpiDbDisplayCommandInfo (
>      const char              *Command,
>      BOOLEAN                 DisplayAll);
> @@ -1303,61 +1299,17 @@ void ACPI_SYSTEM_XFACE
>  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;
>  }
>
>
>  /*******************************************************************************
>   *
> - * FUNCTION:    AcpiDbSingleThread
> - *
> - * 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
> + * PARAMETERS:  None
>   *
>   * RETURN:      None
>   *
> @@ -1368,8 +1320,7 @@ AcpiDbSingleThread (
>
>  ACPI_STATUS
>  AcpiDbUserCommands (
> -    char                    Prompt,
> -    ACPI_PARSE_OBJECT       *Op)
> +    void)
>  {
>      ACPI_STATUS             Status = AE_OK;
>
> @@ -1380,55 +1331,33 @@ AcpiDbUserCommands (
>
>      while (!AcpiGbl_DbTerminateLoop)
>      {
> -        /* Force output to console until a command is entered */
> -
> -        AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
> -
> -        /* Different prompt if method is executing */
> +        /* Wait the readiness of the command */
>
> -        if (!AcpiGbl_MethodExecuting)
> -        {
> -            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
> -        }
> -        else
> +        Status = AcpiOsWaitCommandReady ();
> +        if (ACPI_FAILURE (Status))
>          {
> -            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
> +            break;
>          }
>
> -        /* 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);
> -
> -            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
> -                ACPI_WAIT_FOREVER);
> -            if (ACPI_FAILURE (Status))
> -            {
> -                return (Status);
> -            }
> -        }
> -        else
> -        {
> -            /* Just call to the command line interpreter */
> +        /* Notify the completion of the command */
>
> -            AcpiDbSingleThread ();
> +        Status = AcpiOsNotifyCommandComplete ();
> +        if (ACPI_FAILURE (Status))
> +        {
> +            break;
>          }
>      }
>
> +    if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
> +    {
> +        ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
> +    }
>      return (Status);
>  }
> diff --git a/src/acpica/source/components/debugger/dbxface.c b/src/acpica/source/components/debugger/dbxface.c
> index fe803bc..6a1c231 100644
> --- a/src/acpica/source/components/debugger/dbxface.c
> +++ b/src/acpica/source/components/debugger/dbxface.c
> @@ -167,50 +167,23 @@ AcpiDbStartCommand (
>
>      AcpiGbl_MethodExecuting = TRUE;
>      Status = AE_CTRL_TRUE;
> +
>      while (Status == AE_CTRL_TRUE)
>      {
> -        if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
> -        {
> -            /* Handshake with the front-end that gets user command lines */
> +        /* Notify the completion of the command */
>
> -            AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
> -
> -            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
> -                ACPI_WAIT_FOREVER);
> -            if (ACPI_FAILURE (Status))
> -            {
> -                return (Status);
> -            }
> -        }
> -        else
> +        Status = AcpiOsNotifyCommandComplete ();
> +        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);
> -            }
> +            goto ErrorExit;
> +        }
>
> -            /* Get the user input line */
> +        /* Wait the readiness of the command */
>
> -            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);
> -            }
> +        Status = AcpiOsWaitCommandReady ();
> +        if (ACPI_FAILURE (Status))
> +        {
> +            goto ErrorExit;
>          }
>
>          Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op);
> @@ -218,6 +191,12 @@ AcpiDbStartCommand (
>
>      /* 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);
>  }
>
> @@ -565,16 +544,7 @@ AcpiInitializeDebugger (
>      {
>          /* These were created with one unit, grab it */
>
> -        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
> -            ACPI_WAIT_FOREVER);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            AcpiOsPrintf ("Could not get debugger mutex\n");
> -            return_ACPI_STATUS (Status);
> -        }
> -
> -        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
> -            ACPI_WAIT_FOREVER);
> +        Status = AcpiOsInitializeDebugger ();
>          if (ACPI_FAILURE (Status))
>          {
>              AcpiOsPrintf ("Could not get debugger mutex\n");
> @@ -628,14 +598,14 @@ AcpiTerminateDebugger (
>
>      if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
>      {
> -        AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
> -
>          /* Wait the AML Debugger threads */
>
>          while (!AcpiGbl_DbThreadsTerminated)
>          {
>              AcpiOsSleep (100);
>          }
> +
> +        AcpiOsTerminateDebugger ();
>      }
>
>      if (AcpiGbl_DbBuffer)
> diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
> index 1ea92fa..17ffa4f 100644
> --- a/src/acpica/source/components/disassembler/dmopcode.c
> +++ b/src/acpica/source/components/disassembler/dmopcode.c
> @@ -140,6 +140,13 @@ static void
>  AcpiDmPromoteSubtree (
>      ACPI_PARSE_OBJECT       *StartOp);
>
> +static BOOLEAN
> +AcpiDmIsSwitchBlock (
> +    ACPI_PARSE_OBJECT       *Op);
> +
> +static BOOLEAN
> +AcpiDmIsCaseBlock (
> +    ACPI_PARSE_OBJECT       *Op);
>
>  /*******************************************************************************
>   *
> @@ -1040,6 +1047,28 @@ AcpiDmDisassembleOneOp (
>          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);
> @@ -1150,6 +1179,12 @@ AcpiDmConvertToElseIf (
>      {
>          /* 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;
>      }
> @@ -1159,13 +1194,42 @@ AcpiDmConvertToElseIf (
>      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;
> +    }
> +
> +    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");
> +    }
>
> -    AcpiOsPrintf ("%s", "ElseIf");
>      IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
>
>      /* The IF parent will now be the same as the original ELSE parent */
> @@ -1256,3 +1320,400 @@ AcpiDmPromoteSubtree (
>          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);
> +}
> diff --git a/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c
> index 34ab040..4a7a09c 100644
> --- a/src/acpica/source/components/disassembler/dmwalk.c
> +++ b/src/acpica/source/components/disassembler/dmwalk.c
> @@ -527,6 +527,20 @@ AcpiDmDescendingOp (
>          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);
> @@ -961,7 +975,8 @@ AcpiDmAscendingOp (
>      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 */
>
> @@ -1121,9 +1136,12 @@ AcpiDmAscendingOp (
>
>          /*
>           * 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 (")");
>
> @@ -1138,6 +1156,13 @@ AcpiDmAscendingOp (
>                  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");
> diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
> index 93c8c5d..4860a67 100644
> --- a/src/acpica/source/components/executer/exconfig.c
> +++ b/src/acpica/source/components/executer/exconfig.c
> @@ -297,7 +297,7 @@ AcpiExLoadTableOp (
>      AcpiExEnterInterpreter ();
>      if (ACPI_FAILURE (Status))
>      {
> -	return_ACPI_STATUS (Status);
> +        return_ACPI_STATUS (Status);
>      }
>
>      Status = AcpiExAddTable (TableIndex, &DdbHandle);
> diff --git a/src/acpica/source/components/executer/exfldio.c b/src/acpica/source/components/executer/exfldio.c
> index b7e86fd..578ba48 100644
> --- a/src/acpica/source/components/executer/exfldio.c
> +++ b/src/acpica/source/components/executer/exfldio.c
> @@ -1018,20 +1018,9 @@ AcpiExInsertIntoField (
>
>      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);
>
> diff --git a/src/acpica/source/components/hardware/hwesleep.c b/src/acpica/source/components/hardware/hwesleep.c
> index 51f006b..05f5b49 100644
> --- a/src/acpica/source/components/hardware/hwesleep.c
> +++ b/src/acpica/source/components/hardware/hwesleep.c
> @@ -185,7 +185,7 @@ AcpiHwExtendedSleep (
>      UINT8                   SleepState)
>  {
>      ACPI_STATUS             Status;
> -    UINT8                   SleepTypeValue;
> +    UINT8                   SleepControl;
>      UINT64                  SleepStatus;
>
>
> @@ -211,10 +211,6 @@ AcpiHwExtendedSleep (
>
>      AcpiGbl_SystemAwakeAndRunning = FALSE;
>
> -    /* Flush caches, as per ACPI specification */
> -
> -    ACPI_FLUSH_CPU_CACHE ();
> -
>      /*
>       * Set the SLP_TYP and SLP_EN bits.
>       *
> @@ -224,11 +220,24 @@ AcpiHwExtendedSleep (
>      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;
> +
> +    /* 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) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
> -        &AcpiGbl_FADT.SleepControl);
> +    Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl);
>      if (ACPI_FAILURE (Status))
>      {
>          return_ACPI_STATUS (Status);
> diff --git a/src/acpica/source/components/hardware/hwregs.c b/src/acpica/source/components/hardware/hwregs.c
> index ffad33f..1f9e4c2 100644
> --- a/src/acpica/source/components/hardware/hwregs.c
> +++ b/src/acpica/source/components/hardware/hwregs.c
> @@ -126,6 +126,12 @@
>
>  /* Local Prototypes */
>
> +static UINT8
> +AcpiHwGetAccessBitWidth (
> +    UINT64                  Address,
> +    ACPI_GENERIC_ADDRESS    *Reg,
> +    UINT8                   MaxBitWidth);
> +
>  static ACPI_STATUS
>  AcpiHwReadMultiple (
>      UINT32                  *Value,
> @@ -143,6 +149,90 @@ AcpiHwWriteMultiple (
>
>  /******************************************************************************
>   *
> + * 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
> @@ -163,6 +253,9 @@ AcpiHwValidateRegister (
>      UINT8                   MaxBitWidth,
>      UINT64                  *Address)
>  {
> +    UINT8                   BitWidth;
> +    UINT8                   AccessWidth;
> +
>
>      /* Must have a valid pointer to a GAS structure */
>
> @@ -192,24 +285,25 @@ AcpiHwValidateRegister (
>          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);
> @@ -230,10 +324,7 @@ AcpiHwValidateRegister (
>   *              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.
>   *
>   ******************************************************************************/
>
> @@ -243,7 +334,12 @@ AcpiHwRead (
>      ACPI_GENERIC_ADDRESS    *Reg)
>  {
>      UINT64                  Address;
> +    UINT8                   AccessWidth;
> +    UINT32                  BitWidth;
> +    UINT8                   BitOffset;
>      UINT64                  Value64;
> +    UINT32                  Value32;
> +    UINT8                   Index;
>      ACPI_STATUS             Status;
>
>
> @@ -258,30 +354,58 @@ AcpiHwRead (
>          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;
> -    }
> -    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
> -    {
> -        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
> -            Address, Value, Reg->BitWidth);
> +        /*
> +         * 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++;
>      }
>
>      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);
> @@ -309,6 +433,12 @@ AcpiHwWrite (
>      ACPI_GENERIC_ADDRESS    *Reg)
>  {
>      UINT64                  Address;
> +    UINT8                   AccessWidth;
> +    UINT32                  BitWidth;
> +    UINT8                   BitOffset;
> +    UINT64                  Value64;
> +    UINT32                  Value32;
> +    UINT8                   Index;
>      ACPI_STATUS             Status;
>
>
> @@ -323,24 +453,58 @@ AcpiHwWrite (
>          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);
> -    }
> -    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
> -    {
> -        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
> -            Address, 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++;
>      }
>
>      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);
> diff --git a/src/acpica/source/components/hardware/hwsleep.c b/src/acpica/source/components/hardware/hwsleep.c
> index c2a2a7f..567e312 100644
> --- a/src/acpica/source/components/hardware/hwsleep.c
> +++ b/src/acpica/source/components/hardware/hwsleep.c
> @@ -231,6 +231,16 @@ AcpiHwLegacySleep (
>
>      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);
> diff --git a/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c
> index 9b3d6a8..4375b8e 100644
> --- a/src/acpica/source/components/parser/psargs.c
> +++ b/src/acpica/source/components/parser/psargs.c
> @@ -370,6 +370,20 @@ AcpiPsGetNextNamepath (
>          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);
> @@ -959,7 +973,10 @@ AcpiPsGetNextArg (
>              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 */
>
> @@ -971,6 +988,13 @@ AcpiPsGetNextArg (
>
>              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
>          {
> diff --git a/src/acpica/source/components/parser/pstree.c b/src/acpica/source/components/parser/pstree.c
> index ec059ec..ae49fab 100644
> --- a/src/acpica/source/components/parser/pstree.c
> +++ b/src/acpica/source/components/parser/pstree.c
> @@ -214,7 +214,7 @@ AcpiPsAppendArg (
>      const ACPI_OPCODE_INFO  *OpInfo;
>
>
> -    ACPI_FUNCTION_TRACE ("PsAppendArg");
> +    ACPI_FUNCTION_TRACE (PsAppendArg);
>
>
>      if (!Op)
> diff --git a/src/acpica/source/components/utilities/utdecode.c b/src/acpica/source/components/utilities/utdecode.c
> index f27bf0f..30c28c4 100644
> --- a/src/acpica/source/components/utilities/utdecode.c
> +++ b/src/acpica/source/components/utilities/utdecode.c
> @@ -341,7 +341,7 @@ AcpiUtGetObjectTypeName (
>      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 */
> @@ -354,7 +354,7 @@ AcpiUtGetObjectTypeName (
>              ACPI_GET_DESCRIPTOR_TYPE (ObjDesc),
>              AcpiUtGetDescriptorName (ObjDesc), ObjDesc));
>
> -        return_PTR ("Invalid object");
> +        return_STR ("Invalid object");
>      }
>
>      return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type));
> diff --git a/src/acpica/source/components/utilities/utdelete.c b/src/acpica/source/components/utilities/utdelete.c
> index 0921b38..ebe2a78 100644
> --- a/src/acpica/source/components/utilities/utdelete.c
> +++ b/src/acpica/source/components/utilities/utdelete.c
> @@ -521,8 +521,9 @@ AcpiUtUpdateRefCount (
>          }
>
>          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:
> diff --git a/src/acpica/source/components/utilities/utmutex.c b/src/acpica/source/components/utilities/utmutex.c
> index d80a57c..aaf3660 100644
> --- a/src/acpica/source/components/utilities/utmutex.c
> +++ b/src/acpica/source/components/utilities/utmutex.c
> @@ -201,19 +201,6 @@ AcpiUtMutexInitialize (
>          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);
>  }
>
> @@ -259,12 +246,6 @@ AcpiUtMutexTerminate (
>      /* Delete the reader/writer lock */
>
>      AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
> -
> -#ifdef ACPI_DEBUGGER
> -    AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
> -    AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
> -#endif
> -
>      return_VOID;
>  }
>
> diff --git a/src/acpica/source/components/utilities/utresrc.c b/src/acpica/source/components/utilities/utresrc.c
> index 9c3823c..d1ef5cf 100644
> --- a/src/acpica/source/components/utilities/utresrc.c
> +++ b/src/acpica/source/components/utilities/utresrc.c
> @@ -544,7 +544,7 @@ AcpiUtWalkAmlResources (
>       * 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);
>      }
> diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h
> index c7cfc54..ac44660 100644
> --- a/src/acpica/source/include/acdebug.h
> +++ b/src/acpica/source/include/acdebug.h
> @@ -493,8 +493,7 @@ AcpiDbExecuteThread (
>
>  ACPI_STATUS
>  AcpiDbUserCommands (
> -    char                    Prompt,
> -    ACPI_PARSE_OBJECT       *Op);
> +    void);
>
>  char *
>  AcpiDbGetNextToken (
> diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
> index 9c01d88..69dac97 100644
> --- a/src/acpica/source/include/acdisasm.h
> +++ b/src/acpica/source/include/acdisasm.h
> @@ -501,7 +501,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoGeneric[][2];
>   * dmtable and ahtable
>   */
>  extern const ACPI_DMTABLE_DATA  AcpiDmTableData[];
> -extern const AH_TABLE           AcpiSupportedTables[];
> +extern const AH_TABLE           Gbl_AcpiSupportedTables[];
>
>  UINT8
>  AcpiDmGenerateChecksum (
> @@ -723,6 +723,10 @@ AcpiDmDisassembleOneOp (
>      ACPI_OP_WALK_INFO       *Info,
>      ACPI_PARSE_OBJECT       *Op);
>
> +BOOLEAN
> +AcpiDmIsTempName (
> +    ACPI_PARSE_OBJECT       *Op);
> +
>  UINT32
>  AcpiDmListType (
>      ACPI_PARSE_OBJECT       *Op);
> diff --git a/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h
> index c521729..e6d6adb 100644
> --- a/src/acpica/source/include/acexcep.h
> +++ b/src/acpica/source/include/acexcep.h
> @@ -289,11 +289,10 @@ typedef struct acpi_exception_info
>  #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 */
> @@ -416,7 +415,6 @@ static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Ctrl[] =
>      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")
>  };
> diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
> index eb48d40..d981741 100644
> --- a/src/acpica/source/include/acglobal.h
> +++ b/src/acpica/source/include/acglobal.h
> @@ -403,7 +403,6 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *,      AcpiGbl_ExternalFileList);
>  #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);
> @@ -422,7 +421,6 @@ ACPI_GLOBAL (ACPI_OBJECT_TYPE,          AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARG
>
>  /* 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]);
> @@ -437,9 +435,6 @@ ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCountMisc);
>  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)
> diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
> index 4d28120..48e9c31 100644
> --- a/src/acpica/source/include/aclocal.h
> +++ b/src/acpica/source/include/aclocal.h
> @@ -995,7 +995,7 @@ typedef union acpi_parse_value
>      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 */
> @@ -1008,7 +1008,10 @@ typedef union acpi_parse_value
>  #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)
> diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h
> index a805a32..1255be5 100644
> --- a/src/acpica/source/include/acmacros.h
> +++ b/src/acpica/source/include/acmacros.h
> @@ -119,7 +119,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))
> @@ -136,7 +136,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.
>   */
> @@ -336,14 +336,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 */
>
> @@ -448,7 +527,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.
>   */
> diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h
> index 60d61f1..c4d1606 100644
> --- a/src/acpica/source/include/acpiosxf.h
> +++ b/src/acpica/source/include/acpiosxf.h
> @@ -528,6 +528,14 @@ AcpiOsSignal (
>      void                    *Info);
>  #endif
>
> +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep
> +ACPI_STATUS
> +AcpiOsEnterSleep (
> +    UINT8                   SleepState,
> +    UINT32                  RegaValue,
> +    UINT32                  RegbValue);
> +#endif
> +
>
>  /*
>   * Debug print routines
> @@ -554,7 +562,7 @@ AcpiOsRedirectOutput (
>
>
>  /*
> - * Debug input
> + * Debug IO
>   */
>  #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
>  ACPI_STATUS
> @@ -564,6 +572,30 @@ AcpiOsGetLine (
>      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 (
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 479404b..0b5ca26 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -118,7 +118,7 @@
>
>  /* Current ACPICA subsystem version in YYYYMMDD format */
>
> -#define ACPI_CA_VERSION                 0x20161117
> +#define ACPI_CA_VERSION                 0x20161222
>
>  #include "acconfig.h"
>  #include "actypes.h"
> @@ -365,6 +365,15 @@ ACPI_INIT_GLOBAL (UINT32,           AcpiDbgLayer, ACPI_COMPONENT_DEFAULT);
>  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);
> @@ -1339,6 +1348,10 @@ AcpiTerminateDebugger (
>      void);
>
>  void
> +AcpiRunDebugger (
> +    char                    *BatchBuffer);
> +
> +void
>  AcpiSetDebuggerThreadId (
>      ACPI_THREAD_ID          ThreadId);
>
> diff --git a/src/acpica/source/include/platform/acenv.h b/src/acpica/source/include/platform/acenv.h
> index 4982c87..6e715bb 100644
> --- a/src/acpica/source/include/platform/acenv.h
> +++ b/src/acpica/source/include/platform/acenv.h
> @@ -148,7 +148,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
> @@ -433,7 +434,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>
> diff --git a/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h
> index 9d0927b..27803ad 100644
> --- a/src/acpica/source/include/platform/aclinux.h
> +++ b/src/acpica/source/include/platform/aclinux.h
> @@ -225,6 +225,8 @@
>   */
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
>  #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
> +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
>
>  /*
>   * OSL interfaces used by utilities
> diff --git a/src/acpica/source/include/platform/aclinuxex.h b/src/acpica/source/include/platform/aclinuxex.h
> index 7f24989..c39672d 100644
> --- a/src/acpica/source/include/platform/aclinuxex.h
> +++ b/src/acpica/source/include/platform/aclinuxex.h
> @@ -216,6 +216,20 @@ AcpiOsReadable (
>      return TRUE;
>  }
>
> +static inline ACPI_STATUS
> +AcpiOsInitializeDebugger (
> +    void)
> +{
> +    return AE_OK;
> +}
> +
> +static inline void
> +AcpiOsTerminateDebugger (
> +    void)
> +{
> +    return;
> +}
> +
>
>  /*
>   * OSL interfaces added by Linux
> diff --git a/src/acpica/source/os_specific/service_layers/osgendbg.c b/src/acpica/source/os_specific/service_layers/osgendbg.c
> new file mode 100644
> index 0000000..b8e2e3c
> --- /dev/null
> +++ b/src/acpica/source/os_specific/service_layers/osgendbg.c
> @@ -0,0 +1,438 @@
> +/******************************************************************************
> + *
> + * Module Name: osgendbg - Generic debugger command singalling
> + *
> + *****************************************************************************/
> +
> +/******************************************************************************
> + *
> + * 1. Copyright Notice
> + *
> + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
> + * All rights reserved.
> + *
> + * 2. License
> + *
> + * 2.1. This is your license from Intel Corp. under its intellectual property
> + * rights. You may have additional license terms from the party that provided
> + * you this software, covering your right to use that party's intellectual
> + * property rights.
> + *
> + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
> + * copy of the source code appearing in this file ("Covered Code") an
> + * irrevocable, perpetual, worldwide license under Intel's copyrights in the
> + * base code distributed originally by Intel ("Original Intel Code") to copy,
> + * make derivatives, distribute, use and display any portion of the Covered
> + * Code in any form, with the right to sublicense such rights; and
> + *
> + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
> + * license (with the right to sublicense), under only those claims of Intel
> + * patents that are infringed by the Original Intel Code, to make, use, sell,
> + * offer to sell, and import the Covered Code and derivative works thereof
> + * solely to the minimum extent necessary to exercise the above copyright
> + * license, and in no event shall the patent license extend to any additions
> + * to or modifications of the Original Intel Code. No other license or right
> + * is granted directly or by implication, estoppel or otherwise;
> + *
> + * The above copyright and patent license is granted only if the following
> + * conditions are met:
> + *
> + * 3. Conditions
> + *
> + * 3.1. Redistribution of Source with Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification with rights to further distribute source must include
> + * the above Copyright Notice, the above License, this list of Conditions,
> + * and the following Disclaimer and Export Compliance provision. In addition,
> + * Licensee must cause all Covered Code to which Licensee contributes to
> + * contain a file documenting the changes Licensee made to create that Covered
> + * Code and the date of any change. Licensee must include in that file the
> + * documentation of any changes made by any predecessor Licensee. Licensee
> + * must include a prominent statement that the modification is derived,
> + * directly or indirectly, from Original Intel Code.
> + *
> + * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification without rights to further distribute source must
> + * include the following Disclaimer and Export Compliance provision in the
> + * documentation and/or other materials provided with distribution. In
> + * addition, Licensee may not authorize further sublicense of source of any
> + * portion of the Covered Code, and must include terms to the effect that the
> + * license from Licensee to its licensee is limited to the intellectual
> + * property embodied in the software Licensee provides to its licensee, and
> + * not to intellectual property embodied in modifications its licensee may
> + * make.
> + *
> + * 3.3. Redistribution of Executable. Redistribution in executable form of any
> + * substantial portion of the Covered Code or modification must reproduce the
> + * above Copyright Notice, and the following Disclaimer and Export Compliance
> + * provision in the documentation and/or other materials provided with the
> + * distribution.
> + *
> + * 3.4. Intel retains all right, title, and interest in and to the Original
> + * Intel Code.
> + *
> + * 3.5. Neither the name Intel nor any other trademark owned or controlled by
> + * Intel shall be used in advertising or otherwise to promote the sale, use or
> + * other dealings in products derived from or relating to the Covered Code
> + * without prior written authorization from Intel.
> + *
> + * 4. Disclaimer and Export Compliance
> + *
> + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
> + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
> + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
> + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
> + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
> + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
> + * PARTICULAR PURPOSE.
> + *
> + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
> + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
> + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
> + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
> + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
> + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
> + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
> + * LIMITED REMEDY.
> + *
> + * 4.3. Licensee shall not export, either directly or indirectly, any of this
> + * software or system incorporating such software without first obtaining any
> + * required license or other approval from the U. S. Department of Commerce or
> + * any other agency or department of the United States Government. In the
> + * event Licensee exports any such software from the United States or
> + * re-exports any such software from a foreign destination, Licensee shall
> + * ensure that the distribution and export/re-export of the software is in
> + * compliance with all laws, regulations, orders, or other restrictions of the
> + * U.S. Export Administration Regulations. Licensee agrees that neither it nor
> + * any of its subsidiaries will export/re-export any technical data, process,
> + * software, or service, directly or indirectly, to any country for which the
> + * United States government or any agency thereof requires an export license,
> + * other governmental approval, or letter of assurance, without first obtaining
> + * such license, approval or letter.
> + *
> + *****************************************************************************/
> +
> +#include "acpi.h"
> +#include "accommon.h"
> +#include "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)
> diff --git a/src/acpica/source/os_specific/service_layers/osunixxf.c b/src/acpica/source/os_specific/service_layers/osunixxf.c
> index 413a708..c58bdfb 100644
> --- a/src/acpica/source/os_specific/service_layers/osunixxf.c
> +++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
> @@ -433,6 +433,33 @@ AcpiOsPhysicalTableOverride (
>
>  /******************************************************************************
>   *
> + * 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
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index a58d777..d91b7af 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -254,7 +254,8 @@  libfwtsacpica_la_SOURCES =				\
 	source/common/ahuuids.c				\
 	source/tools/acpiexec/aeinitfile.c		\
 	source/tools/acpiexec/aehandlers.c		\
-	source/tools/acpiexec/aeregion.c
+	source/tools/acpiexec/aeregion.c		\
+	source/os_specific/service_layers/osgendbg.c
 
 libfwtsacpica_la_LIBADD = \
 	-L$(top_builddir)/src/lib/src -lfwts -lrt
diff --git a/src/acpica/source/common/acfileio.c b/src/acpica/source/common/acfileio.c
index 9b4564e..ca7e79e 100644
--- a/src/acpica/source/common/acfileio.c
+++ b/src/acpica/source/common/acfileio.c
@@ -475,7 +475,7 @@  AcValidateTableHeader (
     UINT32                  i;
 
 
-    ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
+    ACPI_FUNCTION_TRACE (AcValidateTableHeader);
 
 
     /* Read a potential table header */
diff --git a/src/acpica/source/common/ahtable.c b/src/acpica/source/common/ahtable.c
index 59ddc83..67d1eea 100644
--- a/src/acpica/source/common/ahtable.c
+++ b/src/acpica/source/common/ahtable.c
@@ -123,7 +123,7 @@  const AH_TABLE *
 AcpiAhGetTableInfo (
     char                    *Signature);
 
-extern const AH_TABLE      AcpiSupportedTables[];
+extern const AH_TABLE      Gbl_AcpiSupportedTables[];
 
 
 /*******************************************************************************
@@ -145,7 +145,7 @@  AcpiAhGetTableInfo (
     const AH_TABLE      *Info;
 
 
-    for (Info = AcpiSupportedTables; Info->Signature; Info++)
+    for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++)
     {
         if (ACPI_COMPARE_NAME (Signature, Info->Signature))
         {
@@ -161,7 +161,7 @@  AcpiAhGetTableInfo (
  * 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"},
diff --git a/src/acpica/source/common/ahuuids.c b/src/acpica/source/common/ahuuids.c
index abcdfce..157a5ee 100644
--- a/src/acpica/source/common/ahuuids.c
+++ b/src/acpica/source/common/ahuuids.c
@@ -124,7 +124,7 @@ 
 /*
  * Table of "known" (ACPI-related) UUIDs
  */
-const AH_UUID  AcpiUuids[] =
+const AH_UUID  Gbl_AcpiUuids[] =
 {
     {"[Controllers]",               NULL},
     {"GPIO Controller",             UUID_GPIO_CONTROLLER},
@@ -184,7 +184,7 @@  AcpiAhMatchUuid (
 
     /* 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 */
 
diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
index 5889459..c1033f5 100644
--- a/src/acpica/source/compiler/aslutils.c
+++ b/src/acpica/source/compiler/aslutils.c
@@ -227,7 +227,7 @@  UtDisplaySupportedTables (
     /* 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,
diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
index f41ad81..6bcb84b 100644
--- a/src/acpica/source/components/debugger/dbinput.c
+++ b/src/acpica/source/components/debugger/dbinput.c
@@ -136,10 +136,6 @@  AcpiDbMatchCommand (
     char                    *UserCommand);
 
 static void
-AcpiDbSingleThread (
-    void);
-
-static void
 AcpiDbDisplayCommandInfo (
     const char              *Command,
     BOOLEAN                 DisplayAll);
@@ -1303,61 +1299,17 @@  void ACPI_SYSTEM_XFACE
 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;
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiDbSingleThread
- *
- * 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
+ * PARAMETERS:  None
  *
  * RETURN:      None
  *
@@ -1368,8 +1320,7 @@  AcpiDbSingleThread (
 
 ACPI_STATUS
 AcpiDbUserCommands (
-    char                    Prompt,
-    ACPI_PARSE_OBJECT       *Op)
+    void)
 {
     ACPI_STATUS             Status = AE_OK;
 
@@ -1380,55 +1331,33 @@  AcpiDbUserCommands (
 
     while (!AcpiGbl_DbTerminateLoop)
     {
-        /* Force output to console until a command is entered */
-
-        AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
-        /* Different prompt if method is executing */
+        /* Wait the readiness of the command */
 
-        if (!AcpiGbl_MethodExecuting)
-        {
-            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
-        }
-        else
+        Status = AcpiOsWaitCommandReady ();
+        if (ACPI_FAILURE (Status))
         {
-            AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+            break;
         }
 
-        /* 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);
-
-            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
-                ACPI_WAIT_FOREVER);
-            if (ACPI_FAILURE (Status))
-            {
-                return (Status);
-            }
-        }
-        else
-        {
-            /* Just call to the command line interpreter */
+        /* Notify the completion of the command */
 
-            AcpiDbSingleThread ();
+        Status = AcpiOsNotifyCommandComplete ();
+        if (ACPI_FAILURE (Status))
+        {
+            break;
         }
     }
 
+    if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+    {
+        ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
+    }
     return (Status);
 }
diff --git a/src/acpica/source/components/debugger/dbxface.c b/src/acpica/source/components/debugger/dbxface.c
index fe803bc..6a1c231 100644
--- a/src/acpica/source/components/debugger/dbxface.c
+++ b/src/acpica/source/components/debugger/dbxface.c
@@ -167,50 +167,23 @@  AcpiDbStartCommand (
 
     AcpiGbl_MethodExecuting = TRUE;
     Status = AE_CTRL_TRUE;
+
     while (Status == AE_CTRL_TRUE)
     {
-        if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
-        {
-            /* Handshake with the front-end that gets user command lines */
+        /* Notify the completion of the command */
 
-            AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
-
-            Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
-                ACPI_WAIT_FOREVER);
-            if (ACPI_FAILURE (Status))
-            {
-                return (Status);
-            }
-        }
-        else
+        Status = AcpiOsNotifyCommandComplete ();
+        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);
-            }
+            goto ErrorExit;
+        }
 
-            /* Get the user input line */
+        /* Wait the readiness of the command */
 
-            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);
-            }
+        Status = AcpiOsWaitCommandReady ();
+        if (ACPI_FAILURE (Status))
+        {
+            goto ErrorExit;
         }
 
         Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op);
@@ -218,6 +191,12 @@  AcpiDbStartCommand (
 
     /* 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);
 }
 
@@ -565,16 +544,7 @@  AcpiInitializeDebugger (
     {
         /* These were created with one unit, grab it */
 
-        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
-            ACPI_WAIT_FOREVER);
-        if (ACPI_FAILURE (Status))
-        {
-            AcpiOsPrintf ("Could not get debugger mutex\n");
-            return_ACPI_STATUS (Status);
-        }
-
-        Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
-            ACPI_WAIT_FOREVER);
+        Status = AcpiOsInitializeDebugger ();
         if (ACPI_FAILURE (Status))
         {
             AcpiOsPrintf ("Could not get debugger mutex\n");
@@ -628,14 +598,14 @@  AcpiTerminateDebugger (
 
     if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
     {
-        AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
-
         /* Wait the AML Debugger threads */
 
         while (!AcpiGbl_DbThreadsTerminated)
         {
             AcpiOsSleep (100);
         }
+
+        AcpiOsTerminateDebugger ();
     }
 
     if (AcpiGbl_DbBuffer)
diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
index 1ea92fa..17ffa4f 100644
--- a/src/acpica/source/components/disassembler/dmopcode.c
+++ b/src/acpica/source/components/disassembler/dmopcode.c
@@ -140,6 +140,13 @@  static void
 AcpiDmPromoteSubtree (
     ACPI_PARSE_OBJECT       *StartOp);
 
+static BOOLEAN
+AcpiDmIsSwitchBlock (
+    ACPI_PARSE_OBJECT       *Op);
+
+static BOOLEAN
+AcpiDmIsCaseBlock (
+    ACPI_PARSE_OBJECT       *Op);
 
 /*******************************************************************************
  *
@@ -1040,6 +1047,28 @@  AcpiDmDisassembleOneOp (
         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);
@@ -1150,6 +1179,12 @@  AcpiDmConvertToElseIf (
     {
         /* 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;
     }
@@ -1159,13 +1194,42 @@  AcpiDmConvertToElseIf (
     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;
+    }
+
+    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");
+    }
 
-    AcpiOsPrintf ("%s", "ElseIf");
     IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
 
     /* The IF parent will now be the same as the original ELSE parent */
@@ -1256,3 +1320,400 @@  AcpiDmPromoteSubtree (
         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);
+}
diff --git a/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c
index 34ab040..4a7a09c 100644
--- a/src/acpica/source/components/disassembler/dmwalk.c
+++ b/src/acpica/source/components/disassembler/dmwalk.c
@@ -527,6 +527,20 @@  AcpiDmDescendingOp (
         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);
@@ -961,7 +975,8 @@  AcpiDmAscendingOp (
     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 */
 
@@ -1121,9 +1136,12 @@  AcpiDmAscendingOp (
 
         /*
          * 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 (")");
 
@@ -1138,6 +1156,13 @@  AcpiDmAscendingOp (
                 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");
diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
index 93c8c5d..4860a67 100644
--- a/src/acpica/source/components/executer/exconfig.c
+++ b/src/acpica/source/components/executer/exconfig.c
@@ -297,7 +297,7 @@  AcpiExLoadTableOp (
     AcpiExEnterInterpreter ();
     if (ACPI_FAILURE (Status))
     {
-	return_ACPI_STATUS (Status);
+        return_ACPI_STATUS (Status);
     }
 
     Status = AcpiExAddTable (TableIndex, &DdbHandle);
diff --git a/src/acpica/source/components/executer/exfldio.c b/src/acpica/source/components/executer/exfldio.c
index b7e86fd..578ba48 100644
--- a/src/acpica/source/components/executer/exfldio.c
+++ b/src/acpica/source/components/executer/exfldio.c
@@ -1018,20 +1018,9 @@  AcpiExInsertIntoField (
 
     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);
 
diff --git a/src/acpica/source/components/hardware/hwesleep.c b/src/acpica/source/components/hardware/hwesleep.c
index 51f006b..05f5b49 100644
--- a/src/acpica/source/components/hardware/hwesleep.c
+++ b/src/acpica/source/components/hardware/hwesleep.c
@@ -185,7 +185,7 @@  AcpiHwExtendedSleep (
     UINT8                   SleepState)
 {
     ACPI_STATUS             Status;
-    UINT8                   SleepTypeValue;
+    UINT8                   SleepControl;
     UINT64                  SleepStatus;
 
 
@@ -211,10 +211,6 @@  AcpiHwExtendedSleep (
 
     AcpiGbl_SystemAwakeAndRunning = FALSE;
 
-    /* Flush caches, as per ACPI specification */
-
-    ACPI_FLUSH_CPU_CACHE ();
-
     /*
      * Set the SLP_TYP and SLP_EN bits.
      *
@@ -224,11 +220,24 @@  AcpiHwExtendedSleep (
     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;
+
+    /* 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) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
-        &AcpiGbl_FADT.SleepControl);
+    Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
diff --git a/src/acpica/source/components/hardware/hwregs.c b/src/acpica/source/components/hardware/hwregs.c
index ffad33f..1f9e4c2 100644
--- a/src/acpica/source/components/hardware/hwregs.c
+++ b/src/acpica/source/components/hardware/hwregs.c
@@ -126,6 +126,12 @@ 
 
 /* Local Prototypes */
 
+static UINT8
+AcpiHwGetAccessBitWidth (
+    UINT64                  Address,
+    ACPI_GENERIC_ADDRESS    *Reg,
+    UINT8                   MaxBitWidth);
+
 static ACPI_STATUS
 AcpiHwReadMultiple (
     UINT32                  *Value,
@@ -143,6 +149,90 @@  AcpiHwWriteMultiple (
 
 /******************************************************************************
  *
+ * 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
@@ -163,6 +253,9 @@  AcpiHwValidateRegister (
     UINT8                   MaxBitWidth,
     UINT64                  *Address)
 {
+    UINT8                   BitWidth;
+    UINT8                   AccessWidth;
+
 
     /* Must have a valid pointer to a GAS structure */
 
@@ -192,24 +285,25 @@  AcpiHwValidateRegister (
         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);
@@ -230,10 +324,7 @@  AcpiHwValidateRegister (
  *              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.
  *
  ******************************************************************************/
 
@@ -243,7 +334,12 @@  AcpiHwRead (
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
     UINT64                  Value64;
+    UINT32                  Value32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -258,30 +354,58 @@  AcpiHwRead (
         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;
-    }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
-            Address, Value, Reg->BitWidth);
+        /*
+         * 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++;
     }
 
     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);
@@ -309,6 +433,12 @@  AcpiHwWrite (
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT8                   AccessWidth;
+    UINT32                  BitWidth;
+    UINT8                   BitOffset;
+    UINT64                  Value64;
+    UINT32                  Value32;
+    UINT8                   Index;
     ACPI_STATUS             Status;
 
 
@@ -323,24 +453,58 @@  AcpiHwWrite (
         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);
-    }
-    else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-    {
-        Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
-            Address, 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++;
     }
 
     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);
diff --git a/src/acpica/source/components/hardware/hwsleep.c b/src/acpica/source/components/hardware/hwsleep.c
index c2a2a7f..567e312 100644
--- a/src/acpica/source/components/hardware/hwsleep.c
+++ b/src/acpica/source/components/hardware/hwsleep.c
@@ -231,6 +231,16 @@  AcpiHwLegacySleep (
 
     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);
diff --git a/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c
index 9b3d6a8..4375b8e 100644
--- a/src/acpica/source/components/parser/psargs.c
+++ b/src/acpica/source/components/parser/psargs.c
@@ -370,6 +370,20 @@  AcpiPsGetNextNamepath (
         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);
@@ -959,7 +973,10 @@  AcpiPsGetNextArg (
             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 */
 
@@ -971,6 +988,13 @@  AcpiPsGetNextArg (
 
             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
         {
diff --git a/src/acpica/source/components/parser/pstree.c b/src/acpica/source/components/parser/pstree.c
index ec059ec..ae49fab 100644
--- a/src/acpica/source/components/parser/pstree.c
+++ b/src/acpica/source/components/parser/pstree.c
@@ -214,7 +214,7 @@  AcpiPsAppendArg (
     const ACPI_OPCODE_INFO  *OpInfo;
 
 
-    ACPI_FUNCTION_TRACE ("PsAppendArg");
+    ACPI_FUNCTION_TRACE (PsAppendArg);
 
 
     if (!Op)
diff --git a/src/acpica/source/components/utilities/utdecode.c b/src/acpica/source/components/utilities/utdecode.c
index f27bf0f..30c28c4 100644
--- a/src/acpica/source/components/utilities/utdecode.c
+++ b/src/acpica/source/components/utilities/utdecode.c
@@ -341,7 +341,7 @@  AcpiUtGetObjectTypeName (
     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 */
@@ -354,7 +354,7 @@  AcpiUtGetObjectTypeName (
             ACPI_GET_DESCRIPTOR_TYPE (ObjDesc),
             AcpiUtGetDescriptorName (ObjDesc), ObjDesc));
 
-        return_PTR ("Invalid object");
+        return_STR ("Invalid object");
     }
 
     return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type));
diff --git a/src/acpica/source/components/utilities/utdelete.c b/src/acpica/source/components/utilities/utdelete.c
index 0921b38..ebe2a78 100644
--- a/src/acpica/source/components/utilities/utdelete.c
+++ b/src/acpica/source/components/utilities/utdelete.c
@@ -521,8 +521,9 @@  AcpiUtUpdateRefCount (
         }
 
         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:
diff --git a/src/acpica/source/components/utilities/utmutex.c b/src/acpica/source/components/utilities/utmutex.c
index d80a57c..aaf3660 100644
--- a/src/acpica/source/components/utilities/utmutex.c
+++ b/src/acpica/source/components/utilities/utmutex.c
@@ -201,19 +201,6 @@  AcpiUtMutexInitialize (
         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);
 }
 
@@ -259,12 +246,6 @@  AcpiUtMutexTerminate (
     /* Delete the reader/writer lock */
 
     AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
-
-#ifdef ACPI_DEBUGGER
-    AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
-    AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
-#endif
-
     return_VOID;
 }
 
diff --git a/src/acpica/source/components/utilities/utresrc.c b/src/acpica/source/components/utilities/utresrc.c
index 9c3823c..d1ef5cf 100644
--- a/src/acpica/source/components/utilities/utresrc.c
+++ b/src/acpica/source/components/utilities/utresrc.c
@@ -544,7 +544,7 @@  AcpiUtWalkAmlResources (
      * 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);
     }
diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h
index c7cfc54..ac44660 100644
--- a/src/acpica/source/include/acdebug.h
+++ b/src/acpica/source/include/acdebug.h
@@ -493,8 +493,7 @@  AcpiDbExecuteThread (
 
 ACPI_STATUS
 AcpiDbUserCommands (
-    char                    Prompt,
-    ACPI_PARSE_OBJECT       *Op);
+    void);
 
 char *
 AcpiDbGetNextToken (
diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
index 9c01d88..69dac97 100644
--- a/src/acpica/source/include/acdisasm.h
+++ b/src/acpica/source/include/acdisasm.h
@@ -501,7 +501,7 @@  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoGeneric[][2];
  * dmtable and ahtable
  */
 extern const ACPI_DMTABLE_DATA  AcpiDmTableData[];
-extern const AH_TABLE           AcpiSupportedTables[];
+extern const AH_TABLE           Gbl_AcpiSupportedTables[];
 
 UINT8
 AcpiDmGenerateChecksum (
@@ -723,6 +723,10 @@  AcpiDmDisassembleOneOp (
     ACPI_OP_WALK_INFO       *Info,
     ACPI_PARSE_OBJECT       *Op);
 
+BOOLEAN
+AcpiDmIsTempName (
+    ACPI_PARSE_OBJECT       *Op);
+
 UINT32
 AcpiDmListType (
     ACPI_PARSE_OBJECT       *Op);
diff --git a/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h
index c521729..e6d6adb 100644
--- a/src/acpica/source/include/acexcep.h
+++ b/src/acpica/source/include/acexcep.h
@@ -289,11 +289,10 @@  typedef struct acpi_exception_info
 #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 */
@@ -416,7 +415,6 @@  static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Ctrl[] =
     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")
 };
diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
index eb48d40..d981741 100644
--- a/src/acpica/source/include/acglobal.h
+++ b/src/acpica/source/include/acglobal.h
@@ -403,7 +403,6 @@  ACPI_GLOBAL (ACPI_EXTERNAL_FILE *,      AcpiGbl_ExternalFileList);
 #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);
@@ -422,7 +421,6 @@  ACPI_GLOBAL (ACPI_OBJECT_TYPE,          AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARG
 
 /* 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]);
@@ -437,9 +435,6 @@  ACPI_GLOBAL (UINT16,                    AcpiGbl_NodeTypeCountMisc);
 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)
diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
index 4d28120..48e9c31 100644
--- a/src/acpica/source/include/aclocal.h
+++ b/src/acpica/source/include/aclocal.h
@@ -995,7 +995,7 @@  typedef union acpi_parse_value
     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 */
@@ -1008,7 +1008,10 @@  typedef union acpi_parse_value
 #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)
diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h
index a805a32..1255be5 100644
--- a/src/acpica/source/include/acmacros.h
+++ b/src/acpica/source/include/acmacros.h
@@ -119,7 +119,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))
@@ -136,7 +136,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.
  */
@@ -336,14 +336,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 */
 
@@ -448,7 +527,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.
  */
diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h
index 60d61f1..c4d1606 100644
--- a/src/acpica/source/include/acpiosxf.h
+++ b/src/acpica/source/include/acpiosxf.h
@@ -528,6 +528,14 @@  AcpiOsSignal (
     void                    *Info);
 #endif
 
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep
+ACPI_STATUS
+AcpiOsEnterSleep (
+    UINT8                   SleepState,
+    UINT32                  RegaValue,
+    UINT32                  RegbValue);
+#endif
+
 
 /*
  * Debug print routines
@@ -554,7 +562,7 @@  AcpiOsRedirectOutput (
 
 
 /*
- * Debug input
+ * Debug IO
  */
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
 ACPI_STATUS
@@ -564,6 +572,30 @@  AcpiOsGetLine (
     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 (
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 479404b..0b5ca26 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -118,7 +118,7 @@ 
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20161117
+#define ACPI_CA_VERSION                 0x20161222
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -365,6 +365,15 @@  ACPI_INIT_GLOBAL (UINT32,           AcpiDbgLayer, ACPI_COMPONENT_DEFAULT);
 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);
@@ -1339,6 +1348,10 @@  AcpiTerminateDebugger (
     void);
 
 void
+AcpiRunDebugger (
+    char                    *BatchBuffer);
+
+void
 AcpiSetDebuggerThreadId (
     ACPI_THREAD_ID          ThreadId);
 
diff --git a/src/acpica/source/include/platform/acenv.h b/src/acpica/source/include/platform/acenv.h
index 4982c87..6e715bb 100644
--- a/src/acpica/source/include/platform/acenv.h
+++ b/src/acpica/source/include/platform/acenv.h
@@ -148,7 +148,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
@@ -433,7 +434,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>
diff --git a/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h
index 9d0927b..27803ad 100644
--- a/src/acpica/source/include/platform/aclinux.h
+++ b/src/acpica/source/include/platform/aclinux.h
@@ -225,6 +225,8 @@ 
  */
 #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
 #define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
 
 /*
  * OSL interfaces used by utilities
diff --git a/src/acpica/source/include/platform/aclinuxex.h b/src/acpica/source/include/platform/aclinuxex.h
index 7f24989..c39672d 100644
--- a/src/acpica/source/include/platform/aclinuxex.h
+++ b/src/acpica/source/include/platform/aclinuxex.h
@@ -216,6 +216,20 @@  AcpiOsReadable (
     return TRUE;
 }
 
+static inline ACPI_STATUS
+AcpiOsInitializeDebugger (
+    void)
+{
+    return AE_OK;
+}
+
+static inline void
+AcpiOsTerminateDebugger (
+    void)
+{
+    return;
+}
+
 
 /*
  * OSL interfaces added by Linux
diff --git a/src/acpica/source/os_specific/service_layers/osgendbg.c b/src/acpica/source/os_specific/service_layers/osgendbg.c
new file mode 100644
index 0000000..b8e2e3c
--- /dev/null
+++ b/src/acpica/source/os_specific/service_layers/osgendbg.c
@@ -0,0 +1,438 @@ 
+/******************************************************************************
+ *
+ * Module Name: osgendbg - Generic debugger command singalling
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "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)
diff --git a/src/acpica/source/os_specific/service_layers/osunixxf.c b/src/acpica/source/os_specific/service_layers/osunixxf.c
index 413a708..c58bdfb 100644
--- a/src/acpica/source/os_specific/service_layers/osunixxf.c
+++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
@@ -433,6 +433,33 @@  AcpiOsPhysicalTableOverride (
 
 /******************************************************************************
  *
+ * 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