Patchwork ACPICA: update to version 20130626

login
register
mail settings
Submitter Colin King
Date June 27, 2013, 10:54 a.m.
Message ID <1372330478-24371-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/255035/
State Accepted
Headers show

Comments

Colin King - June 27, 2013, 10:54 a.m.
From: Colin Ian King <colin.king@canonical.com>

This set of ACPICA fixes includes the following fixes pertinant for fwts:
 (cut and re-formatetd from the ACPICA mailing list release message):

1) ACPICA kernel-resident subsystem:

Fixed an issue with runtime repair of the _CST object. Null or invalid
elements were not always removed properly. Lv Zheng.

Removed an arbitrary restriction of 256 GPEs per GPE block (such as the
FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device,
the maximum number of GPEs is 1016. Use of multiple GPE block devices
makes the system-wide number of GPEs essentially unlimited.

2) iASL Compiler/Disassembler and Tools:

Disassembler: Added some missing types for the HEST and EINJ tables:
"Set Error Type With Address", "CMCI", "MCE", and "Flush Cacheline".

iASL/Preprocessor: Implemented full support for nested #if/#else/#elif/#endif
blocks. Allows arbitrary depth of nested blocks.

Disassembler: Expanded maximum output string length to 64K. Was 256 bytes
max. The original purpose of this constraint was to limit the amount of
debug output. However, the string function in question (UtPrintString) is
now used for the disassembler also, where 256 bytes is insufficient.
Reported by RehabMan@GitHub.

iASL/DataTables: Fixed some problems and issues with compilation of DMAR
tables. ACPICA BZ 999. Lv Zheng.

iASL: Fixed a couple of error exit issues that could result in a "Could not
delete <file>" message during ASL compilation.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/source/common/dmrestag.c                |   1 +
 src/acpica/source/common/dmtable.c                 |  10 +
 src/acpica/source/common/dmtbdump.c                |   3 +
 src/acpica/source/common/dmtbinfo.c                |   1 +
 src/acpica/source/compiler/aslcompile.c            |  14 +-
 src/acpica/source/compiler/aslmessages.h           |   3 +-
 src/acpica/source/compiler/asltree.c               |   3 +-
 src/acpica/source/compiler/aslutils.c              |   3 +-
 src/acpica/source/compiler/dtfield.c               |   3 +-
 src/acpica/source/compiler/dtio.c                  |  25 +-
 src/acpica/source/compiler/dttable.c               |  32 +-
 src/acpica/source/compiler/dttemplate.h            |  18 +-
 src/acpica/source/compiler/dtutils.c               |   6 +
 src/acpica/source/compiler/preprocess.h            |  20 +-
 src/acpica/source/compiler/prscan.c                | 404 +++++++++++++++------
 src/acpica/source/components/debugger/dbcmds.c     |   4 +-
 src/acpica/source/components/debugger/dbdisply.c   |   4 +-
 src/acpica/source/components/debugger/dbinput.c    |  10 +-
 src/acpica/source/components/debugger/dbnames.c    |   4 +-
 .../source/components/disassembler/dmbuffer.c      |   6 +-
 .../source/components/disassembler/dmopcode.c      |   2 +-
 .../source/components/disassembler/dmresrcl.c      |   2 +-
 .../source/components/disassembler/dmresrcl2.c     |   8 +-
 src/acpica/source/components/events/evgpeinit.c    |  11 -
 src/acpica/source/components/executer/exdump.c     |   5 +-
 src/acpica/source/components/namespace/nsdump.c    |   2 +-
 src/acpica/source/components/namespace/nsrepair2.c |  28 +-
 src/acpica/source/components/namespace/nsxfname.c  |  11 +-
 src/acpica/source/components/resources/rsdump.c    |   2 +-
 src/acpica/source/components/resources/rsutils.c   |   2 +-
 src/acpica/source/components/tables/tbxfroot.c     |   7 +-
 src/acpica/source/components/utilities/uteval.c    |   8 +-
 src/acpica/source/components/utilities/utstring.c  |   5 +-
 src/acpica/source/include/acdisasm.h               |   1 +
 src/acpica/source/include/acpixf.h                 |   2 +-
 src/acpica/source/include/actables.h               |   9 +
 src/acpica/source/include/actypes.h                |   7 -
 src/acpica/source/include/acutils.h                |   2 +-
 src/acpica/source/tools/acpiexec/aehandlers.c      |   2 +-
 39 files changed, 451 insertions(+), 239 deletions(-)
Keng-Yu Lin - June 28, 2013, 2:29 a.m.
On Thu, Jun 27, 2013 at 6:54 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> This set of ACPICA fixes includes the following fixes pertinant for fwts:
>  (cut and re-formatetd from the ACPICA mailing list release message):
>
> 1) ACPICA kernel-resident subsystem:
>
> Fixed an issue with runtime repair of the _CST object. Null or invalid
> elements were not always removed properly. Lv Zheng.
>
> Removed an arbitrary restriction of 256 GPEs per GPE block (such as the
> FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device,
> the maximum number of GPEs is 1016. Use of multiple GPE block devices
> makes the system-wide number of GPEs essentially unlimited.
>
> 2) iASL Compiler/Disassembler and Tools:
>
> Disassembler: Added some missing types for the HEST and EINJ tables:
> "Set Error Type With Address", "CMCI", "MCE", and "Flush Cacheline".
>
> iASL/Preprocessor: Implemented full support for nested #if/#else/#elif/#endif
> blocks. Allows arbitrary depth of nested blocks.
>
> Disassembler: Expanded maximum output string length to 64K. Was 256 bytes
> max. The original purpose of this constraint was to limit the amount of
> debug output. However, the string function in question (UtPrintString) is
> now used for the disassembler also, where 256 bytes is insufficient.
> Reported by RehabMan@GitHub.
>
> iASL/DataTables: Fixed some problems and issues with compilation of DMAR
> tables. ACPICA BZ 999. Lv Zheng.
>
> iASL: Fixed a couple of error exit issues that could result in a "Could not
> delete <file>" message during ASL compilation.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/common/dmrestag.c                |   1 +
>  src/acpica/source/common/dmtable.c                 |  10 +
>  src/acpica/source/common/dmtbdump.c                |   3 +
>  src/acpica/source/common/dmtbinfo.c                |   1 +
>  src/acpica/source/compiler/aslcompile.c            |  14 +-
>  src/acpica/source/compiler/aslmessages.h           |   3 +-
>  src/acpica/source/compiler/asltree.c               |   3 +-
>  src/acpica/source/compiler/aslutils.c              |   3 +-
>  src/acpica/source/compiler/dtfield.c               |   3 +-
>  src/acpica/source/compiler/dtio.c                  |  25 +-
>  src/acpica/source/compiler/dttable.c               |  32 +-
>  src/acpica/source/compiler/dttemplate.h            |  18 +-
>  src/acpica/source/compiler/dtutils.c               |   6 +
>  src/acpica/source/compiler/preprocess.h            |  20 +-
>  src/acpica/source/compiler/prscan.c                | 404 +++++++++++++++------
>  src/acpica/source/components/debugger/dbcmds.c     |   4 +-
>  src/acpica/source/components/debugger/dbdisply.c   |   4 +-
>  src/acpica/source/components/debugger/dbinput.c    |  10 +-
>  src/acpica/source/components/debugger/dbnames.c    |   4 +-
>  .../source/components/disassembler/dmbuffer.c      |   6 +-
>  .../source/components/disassembler/dmopcode.c      |   2 +-
>  .../source/components/disassembler/dmresrcl.c      |   2 +-
>  .../source/components/disassembler/dmresrcl2.c     |   8 +-
>  src/acpica/source/components/events/evgpeinit.c    |  11 -
>  src/acpica/source/components/executer/exdump.c     |   5 +-
>  src/acpica/source/components/namespace/nsdump.c    |   2 +-
>  src/acpica/source/components/namespace/nsrepair2.c |  28 +-
>  src/acpica/source/components/namespace/nsxfname.c  |  11 +-
>  src/acpica/source/components/resources/rsdump.c    |   2 +-
>  src/acpica/source/components/resources/rsutils.c   |   2 +-
>  src/acpica/source/components/tables/tbxfroot.c     |   7 +-
>  src/acpica/source/components/utilities/uteval.c    |   8 +-
>  src/acpica/source/components/utilities/utstring.c  |   5 +-
>  src/acpica/source/include/acdisasm.h               |   1 +
>  src/acpica/source/include/acpixf.h                 |   2 +-
>  src/acpica/source/include/actables.h               |   9 +
>  src/acpica/source/include/actypes.h                |   7 -
>  src/acpica/source/include/acutils.h                |   2 +-
>  src/acpica/source/tools/acpiexec/aehandlers.c      |   2 +-
>  39 files changed, 451 insertions(+), 239 deletions(-)
>
> diff --git a/src/acpica/source/common/dmrestag.c b/src/acpica/source/common/dmrestag.c
> index cc1aece..6f12f74 100644
> --- a/src/acpica/source/common/dmrestag.c
> +++ b/src/acpica/source/common/dmrestag.c
> @@ -738,6 +738,7 @@ AcpiGetTagPathname (
>      Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
>      if (ACPI_FAILURE (Status))
>      {
> +        ACPI_FREE (Pathname);
>          return (NULL);
>      }
>
> diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c
> index 35767c1..b1f2e77 100644
> --- a/src/acpica/source/common/dmtable.c
> +++ b/src/acpica/source/common/dmtable.c
> @@ -172,6 +172,7 @@ static const char           *AcpiDmEinjActions[] =
>      "Execute Operation",
>      "Check Busy Status",
>      "Get Command Status",
> +    "Set Error Type With Address",
>      "Unknown Action"
>  };
>
> @@ -182,6 +183,7 @@ static const char           *AcpiDmEinjInstructions[] =
>      "Write Register",
>      "Write Register Value",
>      "Noop",
> +    "Flush Cacheline",
>      "Unknown Instruction"
>  };
>
> @@ -252,6 +254,8 @@ static const char           *AcpiDmHestNotifySubnames[] =
>      "Local Interrupt",
>      "SCI",
>      "NMI",
> +    "CMCI",                         /* ACPI 5.0 */
> +    "MCE",                          /* ACPI 5.0 */
>      "Unknown Notify Type"           /* Reserved */
>  };
>
> @@ -816,6 +820,11 @@ AcpiDmDumpTable (
>              ByteLength = 8;
>              break;
>
> +        case ACPI_DMT_BUF10:
> +
> +            ByteLength = 10;
> +            break;
> +
>          case ACPI_DMT_BUF16:
>          case ACPI_DMT_UUID:
>
> @@ -934,6 +943,7 @@ AcpiDmDumpTable (
>              break;
>
>          case ACPI_DMT_BUF7:
> +        case ACPI_DMT_BUF10:
>          case ACPI_DMT_BUF16:
>          case ACPI_DMT_BUF128:
>              /*
> diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c
> index 3d7ac6d..84c646a 100644
> --- a/src/acpica/source/common/dmtbdump.c
> +++ b/src/acpica/source/common/dmtbdump.c
> @@ -944,6 +944,7 @@ AcpiDmDumpDmar (
>          {
>              return;
>          }
> +        AcpiOsPrintf ("\n");
>
>          switch (SubTable->Type)
>          {
> @@ -996,6 +997,7 @@ AcpiDmDumpDmar (
>              {
>                  return;
>              }
> +            AcpiOsPrintf ("\n");
>
>              /* Dump the PCI Path entries for this device scope */
>
> @@ -1013,6 +1015,7 @@ AcpiDmDumpDmar (
>
>                  PathOffset += 2;
>                  PciPath += 2;
> +                AcpiOsPrintf ("\n");
>              }
>
>              /* Point to next device scope entry */
> diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c
> index 743c654..def6de8 100644
> --- a/src/acpica/source/common/dmtbinfo.c
> +++ b/src/acpica/source/common/dmtbinfo.c
> @@ -852,6 +852,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoDmar[] =
>  {
>      {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Width),                   "Host Address Width", 0},
>      {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Flags),                   "Flags", 0},
> +    {ACPI_DMT_BUF10,    ACPI_DMAR_OFFSET (Reserved[0]),             "Reserved", 0},
>      ACPI_DMT_TERMINATOR
>  };
>
> diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
> index 4932abd..3d5a1a5 100644
> --- a/src/acpica/source/compiler/aslcompile.c
> +++ b/src/acpica/source/compiler/aslcompile.c
> @@ -1038,7 +1038,19 @@ CmCleanupAndExit (
>
>      /* Close all open files */
>
> -    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
> +    /*
> +     * Take care with the preprocessor file (.i), it might be the same
> +     * as the "input" file, depending on where the compiler has terminated
> +     * or aborted. Prevent attempt to close the same file twice in
> +     * loop below.
> +     */
> +    if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
> +        Gbl_Files[ASL_FILE_INPUT].Handle)
> +    {
> +        Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
> +    }
> +
> +    /* Close the standard I/O files */
>
>      for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
>      {
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 586afca..16c1d94 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -320,7 +320,7 @@ typedef enum
>      ASL_MSG_TOO_MANY_ARGUMENTS,
>      ASL_MSG_UNKNOWN_DIRECTIVE,
>      ASL_MSG_UNKNOWN_PRAGMA,
> -
> +    ASL_MSG_WARNING_DIRECTIVE,
>
>      /* These messages are used by the data table compiler only */
>
> @@ -505,6 +505,7 @@ char                        *AslMessages [] =
>  /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
>  /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
>  /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
> +/*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
>
>  /* Table compiler */
>
> diff --git a/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c
> index 2fb249b..59cea2b 100644
> --- a/src/acpica/source/compiler/asltree.c
> +++ b/src/acpica/source/compiler/asltree.c
> @@ -895,6 +895,7 @@ TrLinkChildren (
>          {
>              AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,
>                  "Child node list invalid");
> +            va_end(ap);
>              return (Op);
>          }
>
> @@ -941,8 +942,8 @@ TrLinkChildren (
>          }
>          PrevChild = Child;
>      }
> -    va_end(ap);
>
> +    va_end(ap);
>      DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
>      return (Op);
>  }
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 53fba5a..2e4db5a 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -425,8 +425,6 @@ DbgPrint (
>      va_list                 Args;
>
>
> -    va_start (Args, Fmt);
> -
>      if (!Gbl_DebugFlag)
>      {
>          return;
> @@ -438,6 +436,7 @@ DbgPrint (
>          return;
>      }
>
> +    va_start (Args, Fmt);
>      (void) vfprintf (stderr, Fmt, Args);
>      va_end (Args);
>      return;
> diff --git a/src/acpica/source/compiler/dtfield.c b/src/acpica/source/compiler/dtfield.c
> index 6d781ca..00debb8 100644
> --- a/src/acpica/source/compiler/dtfield.c
> +++ b/src/acpica/source/compiler/dtfield.c
> @@ -539,12 +539,13 @@ DtCompileBuffer (
>          if (ACPI_FAILURE (Status))
>          {
>              DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
> -            return (ByteLength - Count);
> +            goto Exit;
>          }
>
>          Buffer[i] = (UINT8) Value;
>      }
>
> +Exit:
>      ACPI_FREE (StringValue);
>      return (ByteLength - Count);
>  }
> diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c
> index f20792d..3c22381 100644
> --- a/src/acpica/source/compiler/dtio.c
> +++ b/src/acpica/source/compiler/dtio.c
> @@ -359,31 +359,21 @@ DtParseLine (
>
>      while (Start < Colon)
>      {
> -        if (*Start == ' ')
> -        {
> -            Start++;
> -            continue;
> -        }
> -
> -        /* Found left bracket, go to the right bracket */
> -
>          if (*Start == '[')
>          {
> +            /* Found left bracket, go to the right bracket */
> +
>              while (Start < Colon && *Start != ']')
>              {
>                  Start++;
>              }
> -
> -            if (Start == Colon)
> -            {
> -                break;
> -            }
> -
> -            Start++;
> -            continue;
> +        }
> +        else if (*Start != ' ')
> +        {
> +            break;
>          }
>
> -        break;
> +        Start++;
>      }
>
>      /*
> @@ -1210,4 +1200,5 @@ DtWriteTableToListing (
>      AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0);
>
>      AcpiOsRedirectOutput (stdout);
> +    ACPI_FREE (Buffer);
>  }
> diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c
> index a7c6e18..e754cc4 100644
> --- a/src/acpica/source/compiler/dttable.c
> +++ b/src/acpica/source/compiler/dttable.c
> @@ -613,8 +613,9 @@ DtCompileDmar (
>      DT_FIELD                *SubtableStart;
>      ACPI_DMTABLE_INFO       *InfoTable;
>      ACPI_DMAR_HEADER        *DmarHeader;
> -    UINT8                   *ReservedBuffer;
> -    UINT32                  ReservedSize;
> +    ACPI_DMAR_DEVICE_SCOPE  *DmarDeviceScope;
> +    UINT32                  DeviceScopeLength;
> +    UINT32                  PciPathLength;
>
>
>      Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
> @@ -625,17 +626,7 @@ DtCompileDmar (
>
>      ParentTable = DtPeekSubtable ();
>      DtInsertSubtable (ParentTable, Subtable);
> -
> -    /* DMAR Reserved area */
> -
> -    ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved);
> -    ReservedBuffer = UtLocalCalloc (ReservedSize);
> -
> -    DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
> -
> -    ACPI_FREE (ReservedBuffer);
> -    ParentTable = DtPeekSubtable ();
> -    DtInsertSubtable (ParentTable, Subtable);
> +    DtPushSubtable (Subtable);
>
>      while (*PFieldList)
>      {
> @@ -693,10 +684,13 @@ DtCompileDmar (
>
>          ParentTable = DtPeekSubtable ();
>          DtInsertSubtable (ParentTable, Subtable);
> +        DtPushSubtable (Subtable);
>
>          /* Optional Device Scope subtables */
>
> -        while (*PFieldList)
> +        DeviceScopeLength = DmarHeader->Length - Subtable->Length -
> +            ParentTable->Length;
> +        while (DeviceScopeLength)
>          {
>              Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
>                          &Subtable, FALSE);
> @@ -709,9 +703,12 @@ DtCompileDmar (
>              DtInsertSubtable (ParentTable, Subtable);
>              DtPushSubtable (Subtable);
>
> +            DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
> +
>              /* Optional PCI Paths */
>
> -            while (*PFieldList)
> +            PciPathLength = DmarDeviceScope->Length - Subtable->Length;
> +            while (PciPathLength)
>              {
>                  Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
>                              &Subtable, FALSE);
> @@ -723,10 +720,15 @@ DtCompileDmar (
>
>                  ParentTable = DtPeekSubtable ();
>                  DtInsertSubtable (ParentTable, Subtable);
> +                PciPathLength -= Subtable->Length;
>              }
> +
> +            DtPopSubtable ();
> +            DeviceScopeLength -= DmarDeviceScope->Length;
>          }
>
>          DtPopSubtable ();
> +        DtPopSubtable ();
>      }
>
>      return (AE_OK);
> diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h
> index 9543ad6..f131b62 100644
> --- a/src/acpica/source/compiler/dttemplate.h
> +++ b/src/acpica/source/compiler/dttemplate.h
> @@ -260,22 +260,22 @@ const unsigned char TemplateDbgp[] =
>  const unsigned char TemplateDmar[] =
>  {
>      0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00,  /* 00000000    "DMAR...." */
> -    0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
> +    0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
>      0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
>      0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
> -    0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "(.. /..." */
> +    0x17,0x05,0x13,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "... /..." */
>      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */
>      0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00,  /* 00000030    "........" */
> -    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
> -    0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07,  /* 00000040    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
> +    0x03,0x08,0x00,0x00,0x08,0x00,0x00,0x01,  /* 00000040    "........" */
>      0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00,  /* 00000048    ".. ....." */
> -    0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000050    "...x...." */
> -    0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000058    ".?.x...." */
> -    0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00,  /* 00000060    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000050    "........" */
> +    0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000058    "........" */
> +    0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x02,  /* 00000060    "........" */
>      0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00,  /* 00000068    "........" */
> -    0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00,  /* 00000070    "........" */
> +    0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x03,  /* 00000070    "........" */
>      0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00,  /* 00000078    "........" */
> -    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
>      0x00,0x00,0x00,0x00                       /* 00000088    "...."     */
>  };
>
> diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c
> index dacb9c4..0045e07 100644
> --- a/src/acpica/source/compiler/dtutils.c
> +++ b/src/acpica/source/compiler/dtutils.c
> @@ -469,6 +469,7 @@ DtGetFieldType (
>
>      case ACPI_DMT_BUFFER:
>      case ACPI_DMT_BUF7:
> +    case ACPI_DMT_BUF10:
>      case ACPI_DMT_BUF16:
>      case ACPI_DMT_BUF128:
>      case ACPI_DMT_PCI_PATH:
> @@ -702,6 +703,11 @@ DtGetFieldLength (
>          }
>          break;
>
> +    case ACPI_DMT_BUF10:
> +
> +        ByteLength = 10;
> +        break;
> +
>      case ACPI_DMT_BUF16:
>      case ACPI_DMT_UUID:
>
> diff --git a/src/acpica/source/compiler/preprocess.h b/src/acpica/source/compiler/preprocess.h
> index 3e4eaff..ccf83d0 100644
> --- a/src/acpica/source/compiler/preprocess.h
> +++ b/src/acpica/source/compiler/preprocess.h
> @@ -196,6 +196,17 @@ typedef struct pr_file_node
>
>  } PR_FILE_NODE;
>
> +#define MAX_ARGUMENT_LENGTH     24
> +
> +typedef struct directive_info
> +{
> +    struct directive_info       *Next;
> +    char                        Argument[MAX_ARGUMENT_LENGTH];
> +    int                         Directive;
> +    BOOLEAN                     IgnoringThisCodeBlock;
> +
> +} DIRECTIVE_INFO;
> +
>
>  /*
>   * Globals
> @@ -208,12 +219,13 @@ PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /*
>  PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
>  PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
>
> -PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
> -PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
>  PR_EXTERN UINT32                Gbl_PreprocessorLineNumber;
>  PR_EXTERN int                   Gbl_IfDepth;
> +PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
> +PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
>  PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE);
> -
> +PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE);
> +PR_EXTERN DIRECTIVE_INFO        PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL);
>
>  /*
>   * prscan - Preprocessor entry
> @@ -230,7 +242,7 @@ void
>  PrTerminatePreprocessor (
>      void);
>
> -BOOLEAN
> +void
>  PrDoPreprocess (
>      void);
>
> diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c
> index a32f14c..c36a52c 100644
> --- a/src/acpica/source/compiler/prscan.c
> +++ b/src/acpica/source/compiler/prscan.c
> @@ -137,13 +137,27 @@ PrPreprocessInputFile (
>  static void
>  PrDoDirective (
>      char                    *DirectiveToken,
> -    char                    **Next,
> -    BOOLEAN                 *IgnoringThisCodeBlock);
> +    char                    **Next);
>
>  static int
>  PrMatchDirective (
>      char                    *Directive);
>
> +static void
> +PrPushDirective (
> +    int                     Directive,
> +    char                    *Argument);
> +
> +static ACPI_STATUS
> +PrPopDirective (
> +    void);
> +
> +static void
> +PrDbgPrint (
> +    char                    *Action,
> +    char                    *DirectiveName);
> +
> +
>  /*
>   * Supported preprocessor directives
>   */
> @@ -228,11 +242,16 @@ PrInitializeGlobals (
>  {
>      /* Init globals */
>
> -    Gbl_IfDepth = 0;
>      Gbl_InputFileList = NULL;
>      Gbl_CurrentLineNumber = 0;
>      Gbl_PreprocessorLineNumber = 1;
>      Gbl_PreprocessorError = FALSE;
> +
> +    /* These are used to track #if/#else blocks (possibly nested) */
> +
> +    Gbl_IfDepth = 0;
> +    Gbl_IgnoringThisCodeBlock = FALSE;
> +    Gbl_DirectiveStack = NULL;
>  }
>
>
> @@ -279,7 +298,7 @@ PrTerminatePreprocessor (
>   *
>   * PARAMETERS:  None
>   *
> - * RETURN:      Error Status. TRUE if error, FALSE if OK.
> + * RETURN:      None
>   *
>   * DESCRIPTION: Main entry point for the iASL Preprocessor. Input file must
>   *              be already open. Handles multiple input files via the
> @@ -287,7 +306,7 @@ PrTerminatePreprocessor (
>   *
>   ******************************************************************************/
>
> -BOOLEAN
> +void
>  PrDoPreprocess (
>      void)
>  {
> @@ -309,20 +328,7 @@ PrDoPreprocess (
>
>      } while (MoreInputFiles);
>
> -
> -    /*
> -     * TBD: is this necessary? (Do we abort on any preprocessing errors?)
> -     */
> -    if (Gbl_PreprocessorError)
> -    {
> -        /* TBD: can't use source_output file for preprocessor error reporting */
> -
> -        Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL;
> -        PrTerminatePreprocessor ();
> -        return (TRUE);
> -    }
> -
> -    /* Point compiler input to the new preprocessor file (.i) */
> +    /* Point compiler input to the new preprocessor output file (.i) */
>
>      FlCloseFile (ASL_FILE_INPUT);
>      Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle;
> @@ -334,7 +340,6 @@ PrDoPreprocess (
>      Gbl_CurrentLineNumber = 1;
>
>      DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n");
> -    return (FALSE);
>  }
>
>
> @@ -362,7 +367,6 @@ PrPreprocessInputFile (
>      char                    *ReplaceString;
>      PR_DEFINE_INFO          *DefineInfo;
>      ACPI_SIZE               TokenOffset;
> -    BOOLEAN                 IgnoringThisCodeBlock = FALSE;
>      char                    *Next;
>      int                     OffsetAdjust;
>
> @@ -392,7 +396,7 @@ PrPreprocessInputFile (
>
>              /* Execute the directive, do not write line to output file */
>
> -            PrDoDirective (Token, &Next, &IgnoringThisCodeBlock);
> +            PrDoDirective (Token, &Next);
>              continue;
>          }
>
> @@ -401,7 +405,7 @@ PrPreprocessInputFile (
>           * FALSE, ignore the line and do not write it to the output file.
>           * This continues until an #else or #endif is encountered.
>           */
> -        if (IgnoringThisCodeBlock == TRUE)
> +        if (Gbl_IgnoringThisCodeBlock)
>          {
>              continue;
>          }
> @@ -488,12 +492,8 @@ PrPreprocessInputFile (
>   *
>   * PARAMETERS:  Directive               - Pointer to directive name token
>   *              Next                    - "Next" buffer from GetNextToken
> - *              IgnoringThisCodeBlock   - Where the "ignore code" flag is
> - *                                        returned.
>   *
> - * RETURN:      IgnoringThisCodeBlock: Set to TRUE if we are skipping the FALSE
> - *              part of an #if or #else block. Set to FALSE when the
> - *              corresponding #else or #endif is encountered.
> + * RETURN:      None.
>   *
>   * DESCRIPTION: Main processing for all preprocessor directives
>   *
> @@ -502,8 +502,7 @@ PrPreprocessInputFile (
>  static void
>  PrDoDirective (
>      char                    *DirectiveToken,
> -    char                    **Next,
> -    BOOLEAN                 *IgnoringThisCodeBlock)
> +    char                    **Next)
>  {
>      char                    *Token = Gbl_MainTokenBuffer;
>      char                    *Token2;
> @@ -531,14 +530,28 @@ PrDoDirective (
>          return;
>      }
>
> -    /* TBD: Need a faster way to do this: */
> -
> -    if ((Directive == PR_DIRECTIVE_ELIF) ||
> -        (Directive == PR_DIRECTIVE_ELSE) ||
> -        (Directive == PR_DIRECTIVE_ENDIF))
> +    /*
> +     * If we are currently ignoring this block and we encounter a #else or
> +     * #elif, we must ignore their blocks also if the parent block is also
> +     * being ignored.
> +     */
> +    if (Gbl_IgnoringThisCodeBlock)
>      {
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
> -            Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
> +        switch (Directive)
> +        {
> +        case PR_DIRECTIVE_ELSE:
> +        case PR_DIRECTIVE_ELIF:
> +
> +            if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock)
> +            {
> +                PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
> +                return;
> +            }
> +            break;
> +
> +        default:
> +            break;
> +        }
>      }
>
>      /*
> @@ -548,57 +561,54 @@ PrDoDirective (
>       */
>      switch (Directive)
>      {
> +    case PR_DIRECTIVE_ELSE:
> +
> +        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
> +        PrDbgPrint ("Executing", "else block");
> +        return;
> +
>      case PR_DIRECTIVE_ELIF:
>
> -        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
> -        if (*IgnoringThisCodeBlock == TRUE)
> +        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
> +        Directive = PR_DIRECTIVE_IF;
> +
> +        if (Gbl_IgnoringThisCodeBlock == TRUE)
>          {
>              /* Not executing the ELSE part -- all done here */
> +            PrDbgPrint ("Ignoring", "elif block");
>              return;
>          }
>
> -        /* Will execute the ELSE..IF part */
> +        /*
> +         * After this, we will execute the IF part further below.
> +         * First, however, pop off the original #if directive.
> +         */
> +        if (ACPI_FAILURE (PrPopDirective ()))
> +        {
> +            PrError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
> +                THIS_TOKEN_OFFSET (DirectiveToken));
> +        }
>
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "#elif - Executing else block\n",
> -            Gbl_CurrentLineNumber);
> -        Directive = PR_DIRECTIVE_IF;
> +        PrDbgPrint ("Executing", "elif block");
>          break;
>
> -    case PR_DIRECTIVE_ELSE:
> +    case PR_DIRECTIVE_ENDIF:
>
> -        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
> -        return;
> +        PrDbgPrint ("Executing", "endif");
>
> -    case PR_DIRECTIVE_ENDIF:
> +        /* Pop the owning #if/#ifdef/#ifndef */
>
> -        *IgnoringThisCodeBlock = FALSE;
> -        Gbl_IfDepth--;
> -        if (Gbl_IfDepth < 0)
> +        if (ACPI_FAILURE (PrPopDirective ()))
>          {
>              PrError (ASL_ERROR, ASL_MSG_ENDIF_MISMATCH,
>                  THIS_TOKEN_OFFSET (DirectiveToken));
> -            Gbl_IfDepth = 0;
>          }
>          return;
>
>      default:
> -
>          break;
>      }
>
> -    /*
> -     * At this point, if we are ignoring the current code block,
> -     * do not process any more directives (i.e., ignore them also.)
> -     */
> -    if (*IgnoringThisCodeBlock == TRUE)
> -    {
> -        return;
> -    }
> -
> -    DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
> -        Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
> -
>      /* Most directives have at least one argument */
>
>      if (Gbl_DirectiveInfo[Directive].ArgCount == 1)
> @@ -610,8 +620,85 @@ PrDoDirective (
>          }
>      }
>
> +    /*
> +     * At this point, if we are ignoring the current code block,
> +     * do not process any more directives (i.e., ignore them also.)
> +     * For "if" style directives, open/push a new block anyway. We
> +     * must do this to keep track of #endif directives
> +     */
> +    if (Gbl_IgnoringThisCodeBlock)
> +    {
> +        switch (Directive)
> +        {
> +        case PR_DIRECTIVE_IF:
> +        case PR_DIRECTIVE_IFDEF:
> +        case PR_DIRECTIVE_IFNDEF:
> +
> +            PrPushDirective (Directive, Token);
> +            PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
> +            break;
> +
> +        default:
> +            break;
> +        }
> +
> +        return;
> +    }
> +
> +    /*
> +     * Execute the directive
> +     */
> +    PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name);
> +
>      switch (Directive)
>      {
> +    case PR_DIRECTIVE_IF:
> +
> +        TokenOffset = Token - Gbl_MainTokenBuffer;
> +
> +        /* Need to expand #define macros in the expression string first */
> +
> +        Status = PrResolveIntegerExpression (
> +            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
> +        if (ACPI_FAILURE (Status))
> +        {
> +            return;
> +        }
> +
> +        PrPushDirective (Directive, Token);
> +        if (!Value)
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> +            "Resolved #if: %8.8X%8.8X %s\n",
> +            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
> +            Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> +        break;
> +
> +    case PR_DIRECTIVE_IFDEF:
> +
> +        PrPushDirective (Directive, Token);
> +        if (!PrMatchDefine (Token))
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        PrDbgPrint ("Evaluated", "ifdef");
> +        break;
> +
> +    case PR_DIRECTIVE_IFNDEF:
> +
> +        PrPushDirective (Directive, Token);
> +        if (PrMatchDefine (Token))
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        PrDbgPrint ("Evaluated", "ifndef");
> +        break;
> +
>      case PR_DIRECTIVE_DEFINE:
>          /*
>           * By definition, if first char after the name is a paren,
> @@ -667,64 +754,15 @@ PrDoDirective (
>
>      case PR_DIRECTIVE_ERROR:
>
> -        /* TBD compiler should abort */
>          /* Note: No macro expansion */
>
>          PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE,
>              THIS_TOKEN_OFFSET (Token));
> -        break;
> -
> -    case PR_DIRECTIVE_IF:
>
> -        TokenOffset = Token - Gbl_MainTokenBuffer;
> -
> -        /* Need to expand #define macros in the expression string first */
> -
> -        Status = PrResolveIntegerExpression (
> -            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return;
> -        }
> -
> -        if (!Value)
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Resolved #if: %8.8X%8.8X %s\n",
> -            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
> -            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> -
> -        Gbl_IfDepth++;
> -        break;
> -
> -    case PR_DIRECTIVE_IFDEF:
> -
> -        if (!PrMatchDefine (Token))
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        Gbl_IfDepth++;
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Start #ifdef %s\n", Gbl_CurrentLineNumber,
> -            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> -        break;
> -
> -    case PR_DIRECTIVE_IFNDEF:
> -
> -        if (PrMatchDefine (Token))
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        Gbl_IfDepth++;
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Start #ifndef %2.2X\n", Gbl_CurrentLineNumber,
> -            *IgnoringThisCodeBlock, Gbl_CurrentLineNumber);
> -        break;
> +        Gbl_SourceLine = 0;
> +        Gbl_NextError = Gbl_ErrorLog;
> +        CmCleanupAndExit ();
> +        exit(1);
>
>      case PR_DIRECTIVE_INCLUDE:
>
> @@ -810,7 +848,7 @@ PrDoDirective (
>
>      case PR_DIRECTIVE_WARNING:
>
> -        PrError (ASL_WARNING, ASL_MSG_ERROR_DIRECTIVE,
> +        PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE,
>              THIS_TOKEN_OFFSET (Token));
>          break;
>
> @@ -825,7 +863,6 @@ PrDoDirective (
>
>      return;
>
> -
>  SyntaxError:
>
>      PrError (ASL_ERROR, ASL_MSG_DIRECTIVE_SYNTAX,
> @@ -868,3 +905,130 @@ PrMatchDirective (
>
>      return (ASL_DIRECTIVE_NOT_FOUND);    /* Command not recognized */
>  }
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrPushDirective
> + *
> + * PARAMETERS:  Directive           - Encoded directive ID
> + *              Argument            - String containing argument to the
> + *                                    directive
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Push an item onto the directive stack. Used for processing
> + *              nested #if/#else type conditional compilation directives.
> + *              Specifically: Used on detection of #if/#ifdef/#ifndef to open
> + *              a block.
> + *
> + ******************************************************************************/
> +
> +static void
> +PrPushDirective (
> +    int                     Directive,
> +    char                    *Argument)
> +{
> +    DIRECTIVE_INFO          *Info;
> +
> +
> +    /* Allocate and populate a stack info item */
> +
> +    Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO));
> +
> +    Info->Next = Gbl_DirectiveStack;
> +    Info->Directive = Directive;
> +    Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock;
> +    strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH);
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT,
> +        "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Gbl_DirectiveInfo[Directive].Name,
> +        Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
> +
> +    /* Push new item */
> +
> +    Gbl_DirectiveStack = Info;
> +    Gbl_IfDepth++;
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrPopDirective
> + *
> + * PARAMETERS:  None
> + *
> + * RETURN:      Status. Error if the stack is empty.
> + *
> + * DESCRIPTION: Pop an item off the directive stack. Used for processing
> + *              nested #if/#else type conditional compilation directives.
> + *              Specifically: Used on detection of #elif and #endif to remove
> + *              the original #if/#ifdef/#ifndef from the stack and close
> + *              the block.
> + *
> + ******************************************************************************/
> +
> +static ACPI_STATUS
> +PrPopDirective (
> +    void)
> +{
> +    DIRECTIVE_INFO          *Info;
> +
> +
> +    /* Check for empty stack */
> +
> +    Info = Gbl_DirectiveStack;
> +    if (!Info)
> +    {
> +        return (AE_ERROR);
> +    }
> +
> +    /* Pop one item, keep globals up-to-date */
> +
> +    Gbl_IfDepth--;
> +    Gbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock;
> +    Gbl_DirectiveStack = Info->Next;
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT,
> +        "Pr(%.4u) - [%u %s] %*s Popped [#%s %s]: IgnoreFlag now = %s\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Gbl_DirectiveInfo[Info->Directive].Name,
> +        Info->Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
> +
> +    ACPI_FREE (Info);
> +    return (AE_OK);
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrDbgPrint
> + *
> + * PARAMETERS:  Action              - Action being performed
> + *              DirectiveName       - Directive being processed
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Special debug print for directive processing.
> + *
> + ******************************************************************************/
> +
> +static void
> +PrDbgPrint (
> +    char                    *Action,
> +    char                    *DirectiveName)
> +{
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] "
> +        "%*s %s #%s, Depth %u\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Action, DirectiveName, Gbl_IfDepth);
> +}
> diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c
> index 0e1c49b..54ddf1a 100644
> --- a/src/acpica/source/components/debugger/dbcmds.c
> +++ b/src/acpica/source/components/debugger/dbcmds.c
> @@ -177,13 +177,15 @@ AcpiDbConvertToNode (
>      char                    *InString)
>  {
>      ACPI_NAMESPACE_NODE     *Node;
> +    ACPI_SIZE               Address;
>
>
>      if ((*InString >= 0x30) && (*InString <= 0x39))
>      {
>          /* Numeric argument, convert */
>
> -        Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
> +        Address = ACPI_STRTOUL (InString, NULL, 16);
> +        Node = ACPI_TO_POINTER (Address);
>          if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
>          {
>              AcpiOsPrintf ("Address %p is invalid in this address space\n",
> diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c
> index a42a954..832647d 100644
> --- a/src/acpica/source/components/debugger/dbdisply.c
> +++ b/src/acpica/source/components/debugger/dbdisply.c
> @@ -211,9 +211,11 @@ AcpiDbGetPointer (
>      void                    *Target)
>  {
>      void                    *ObjPtr;
> +    ACPI_SIZE               Address;
>
>
> -    ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
> +    Address = ACPI_STRTOUL (Target, NULL, 16);
> +    ObjPtr = ACPI_TO_POINTER (Address);
>      return (ObjPtr);
>  }
>
> diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
> index 8f30208..2f6127f 100644
> --- a/src/acpica/source/components/debugger/dbinput.c
> +++ b/src/acpica/source/components/debugger/dbinput.c
> @@ -901,7 +901,7 @@ AcpiDbCommandDispatch (
>          break;
>
>      case CMD_EVENT:
> -
> +
>          AcpiOsPrintf ("Event command not implemented\n");
>          break;
>
> @@ -960,7 +960,7 @@ AcpiDbCommandDispatch (
>          return (Status);
>
>      case CMD_HISTORY_LAST: /* !! command */
> -
> +
>          CommandLine = AcpiDbGetFromHistory (NULL);
>          if (!CommandLine)
>          {
> @@ -971,12 +971,12 @@ AcpiDbCommandDispatch (
>          return (Status);
>
>      case CMD_INFORMATION:
> -
> +
>          AcpiDbDisplayMethodInfo (Op);
>          break;
>
>      case CMD_INTEGRITY:
> -
> +
>          AcpiDbCheckIntegrity ();
>          break;
>
> @@ -1070,7 +1070,7 @@ AcpiDbCommandDispatch (
>          break;
>
>      case CMD_OWNER:
> -
> +
>          AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
>          break;
>
> diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
> index bc37388..9fbe539 100644
> --- a/src/acpica/source/components/debugger/dbnames.c
> +++ b/src/acpica/source/components/debugger/dbnames.c
> @@ -855,11 +855,13 @@ AcpiDbFindReferences (
>      char                    *ObjectArg)
>  {
>      ACPI_OPERAND_OBJECT     *ObjDesc;
> +    ACPI_SIZE               Address;
>
>
>      /* Convert string to object pointer */
>
> -    ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
> +    Address = ACPI_STRTOUL (ObjectArg, NULL, 16);
> +    ObjDesc = ACPI_TO_POINTER (Address);
>
>      /* Search all nodes in namespace */
>
> diff --git a/src/acpica/source/components/disassembler/dmbuffer.c b/src/acpica/source/components/disassembler/dmbuffer.c
> index 4b33c56..9e9f4c4 100644
> --- a/src/acpica/source/components/disassembler/dmbuffer.c
> +++ b/src/acpica/source/components/disassembler/dmbuffer.c
> @@ -249,7 +249,7 @@ AcpiDmByteList (
>      case ACPI_DASM_STRING:
>
>          AcpiDmIndent (Info->Level);
> -        AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX);
> +        AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX);
>          AcpiOsPrintf ("\n");
>          break;
>
> @@ -595,11 +595,9 @@ AcpiDmUnicode (
>      WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
>      WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
>
> -
> -    AcpiOsPrintf ("\"");
> -
>      /* Write every other byte as an ASCII character */
>
> +    AcpiOsPrintf ("\"");
>      for (i = 0; i < (WordCount - 1); i++)
>      {
>          AcpiOsPrintf ("%c", (int) WordData[i]);
> diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
> index 36cfd8a..767c2bf 100644
> --- a/src/acpica/source/components/disassembler/dmopcode.c
> +++ b/src/acpica/source/components/disassembler/dmopcode.c
> @@ -705,7 +705,7 @@ AcpiDmDisassembleOneOp (
>
>      case AML_STRING_OP:
>
> -        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX);
> +        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
>          break;
>
>      case AML_BUFFER_OP:
> diff --git a/src/acpica/source/components/disassembler/dmresrcl.c b/src/acpica/source/components/disassembler/dmresrcl.c
> index 6d1420d..4096822 100644
> --- a/src/acpica/source/components/disassembler/dmresrcl.c
> +++ b/src/acpica/source/components/disassembler/dmresrcl.c
> @@ -637,7 +637,7 @@ AcpiDmResourceSource (
>      if (TotalLength > (MinimumTotalLength + 1))
>      {
>          AcpiOsPrintf (" ");
> -        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
> +        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
>      }
>
>      AcpiOsPrintf (", ");
> diff --git a/src/acpica/source/components/disassembler/dmresrcl2.c b/src/acpica/source/components/disassembler/dmresrcl2.c
> index b15db88..a5cc7fb 100644
> --- a/src/acpica/source/components/disassembler/dmresrcl2.c
> +++ b/src/acpica/source/components/disassembler/dmresrcl2.c
> @@ -267,7 +267,7 @@ AcpiDmGpioCommon (
>      {
>          AcpiUtPrintString (
>              ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
> -            ACPI_UINT8_MAX);
> +            ACPI_UINT16_MAX);
>      }
>
>      AcpiOsPrintf (", ");
> @@ -570,7 +570,7 @@ AcpiDmI2cSerialBusDescriptor (
>
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>
>      /* ResourceSourceIndex, ResourceUsage */
>
> @@ -645,7 +645,7 @@ AcpiDmSpiSerialBusDescriptor (
>
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>
>      /* ResourceSourceIndex, ResourceUsage */
>
> @@ -723,7 +723,7 @@ AcpiDmUartSerialBusDescriptor (
>
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>
>      /* ResourceSourceIndex, ResourceUsage */
>
> diff --git a/src/acpica/source/components/events/evgpeinit.c b/src/acpica/source/components/events/evgpeinit.c
> index 8cf5730..c9ae57b 100644
> --- a/src/acpica/source/components/events/evgpeinit.c
> +++ b/src/acpica/source/components/events/evgpeinit.c
> @@ -206,7 +206,6 @@ AcpiEvGpeInitialize (
>          /* GPE block 0 exists (has both length and address > 0) */
>
>          RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
> -
>          GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
>
>          /* Install GPE Block 0 */
> @@ -281,16 +280,6 @@ AcpiEvGpeInitialize (
>          goto Cleanup;
>      }
>
> -    /* Check for Max GPE number out-of-range */
> -
> -    if (GpeNumberMax > ACPI_GPE_MAX)
> -    {
> -        ACPI_ERROR ((AE_INFO,
> -            "Maximum GPE number from FADT is too large: 0x%X",
> -            GpeNumberMax));
> -        Status = AE_BAD_VALUE;
> -        goto Cleanup;
> -    }
>
>  Cleanup:
>      (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
> diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c
> index cb93831..af788e2 100644
> --- a/src/acpica/source/components/executer/exdump.c
> +++ b/src/acpica/source/components/executer/exdump.c
> @@ -429,6 +429,7 @@ AcpiExDumpObject (
>  {
>      UINT8                   *Target;
>      char                    *Name;
> +    const char              *ReferenceName;
>      UINT8                   Count;
>
>
> @@ -513,8 +514,8 @@ AcpiExDumpObject (
>
>          case ACPI_EXD_REFERENCE:
>
> -            AcpiExOutString ("Class Name",
> -                ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
> +            ReferenceName = AcpiUtGetReferenceName (ObjDesc);
> +            AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
>              AcpiExDumpReferenceObj (ObjDesc);
>              break;
>
> diff --git a/src/acpica/source/components/namespace/nsdump.c b/src/acpica/source/components/namespace/nsdump.c
> index 45f009d..233ded6 100644
> --- a/src/acpica/source/components/namespace/nsdump.c
> +++ b/src/acpica/source/components/namespace/nsdump.c
> @@ -691,7 +691,7 @@ AcpiNsDumpOneObject (
>              break;
>
>          case ACPI_TYPE_LOCAL_INDEX_FIELD:
> -
> +
>              ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
>              break;
>
> diff --git a/src/acpica/source/components/namespace/nsrepair2.c b/src/acpica/source/components/namespace/nsrepair2.c
> index e3ec4a6..46f4107 100644
> --- a/src/acpica/source/components/namespace/nsrepair2.c
> +++ b/src/acpica/source/components/namespace/nsrepair2.c
> @@ -573,19 +573,7 @@ AcpiNsRepair_CST (
>
>
>      /*
> -     * Entries (subpackages) in the _CST Package must be sorted by the
> -     * C-state type, in ascending order.
> -     */
> -    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
> -                ACPI_SORT_ASCENDING, "C-State Type");
> -    if (ACPI_FAILURE (Status))
> -    {
> -        return (Status);
> -    }
> -
> -    /*
> -     * We now know the list is correctly sorted by C-state type. Check if
> -     * the C-state type values are proportional.
> +     * Check if the C-state type values are proportional.
>       */
>      OuterElementCount = ReturnObject->Package.Count - 1;
>      i = 0;
> @@ -599,6 +587,7 @@ AcpiNsRepair_CST (
>              ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
>                  "SubPackage[%u] - removing entry due to zero count", i));
>              Removing = TRUE;
> +            goto RemoveElement;
>          }
>
>          ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */
> @@ -609,6 +598,7 @@ AcpiNsRepair_CST (
>              Removing = TRUE;
>          }
>
> +RemoveElement:
>          if (Removing)
>          {
>              AcpiNsRemoveElement (ReturnObject, i + 1);
> @@ -624,6 +614,18 @@ AcpiNsRepair_CST (
>
>      ObjDesc = ReturnObject->Package.Elements[0];
>      ObjDesc->Integer.Value = OuterElementCount;
> +
> +    /*
> +     * Entries (subpackages) in the _CST Package must be sorted by the
> +     * C-state type, in ascending order.
> +     */
> +    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
> +                ACPI_SORT_ASCENDING, "C-State Type");
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (Status);
> +    }
> +
>      return (AE_OK);
>  }
>
> diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c
> index 71f1191..530d94a 100644
> --- a/src/acpica/source/components/namespace/nsxfname.c
> +++ b/src/acpica/source/components/namespace/nsxfname.c
> @@ -249,6 +249,7 @@ AcpiGetName (
>  {
>      ACPI_STATUS             Status;
>      ACPI_NAMESPACE_NODE     *Node;
> +    char                    *NodeName;
>
>
>      /* Parameter validation */
> @@ -299,7 +300,8 @@ AcpiGetName (
>
>      /* Just copy the ACPI name from the Node and zero terminate it */
>
> -    ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node));
> +    NodeName = AcpiUtGetNodeName (Node);
> +    ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
>      ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
>      Status = AE_OK;
>
> @@ -495,9 +497,14 @@ AcpiGetObjectInfo (
>           * Get extra info for ACPI Device/Processor objects only:
>           * Run the _STA, _ADR and, SxW, and _SxD methods.
>           *
> -         * Note: none of these methods are required, so they may or may
> +         * Notes: none of these methods are required, so they may or may
>           * not be present for this device. The Info->Valid bitfield is used
>           * to indicate which methods were found and run successfully.
> +         *
> +         * For _STA, if the method does not exist, then (as per the ACPI
> +         * specification), the returned CurrentStatus flags will indicate
> +         * that the device is present/functional/enabled. Otherwise, the
> +         * CurrentStatus flags reflect the value returned from _STA.
>           */
>
>          /* Execute the Device._STA method */
> diff --git a/src/acpica/source/components/resources/rsdump.c b/src/acpica/source/components/resources/rsdump.c
> index 26f8315..fb1af63 100644
> --- a/src/acpica/source/components/resources/rsdump.c
> +++ b/src/acpica/source/components/resources/rsdump.c
> @@ -275,7 +275,7 @@ AcpiRsDumpDescriptor (
>              break;
>
>          case ACPI_RSD_UINT64:
> -
> +
>              AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
>              break;
>
> diff --git a/src/acpica/source/components/resources/rsutils.c b/src/acpica/source/components/resources/rsutils.c
> index c04ebac..bdc5ccf 100644
> --- a/src/acpica/source/components/resources/rsutils.c
> +++ b/src/acpica/source/components/resources/rsutils.c
> @@ -265,7 +265,7 @@ AcpiRsMoveData (
>              break;
>
>          case ACPI_RSC_MOVE32:
> -
> +
>              ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
>                                  &ACPI_CAST_PTR (UINT32, Source)[i]);
>              break;
> diff --git a/src/acpica/source/components/tables/tbxfroot.c b/src/acpica/source/components/tables/tbxfroot.c
> index 377e2a7..7e6a620 100644
> --- a/src/acpica/source/components/tables/tbxfroot.c
> +++ b/src/acpica/source/components/tables/tbxfroot.c
> @@ -125,11 +125,6 @@
>
>  /* Local prototypes */
>
> -static UINT8 *
> -AcpiTbScanMemoryForRsdp (
> -    UINT8                   *StartAddress,
> -    UINT32                  Length);
> -
>  static ACPI_STATUS
>  AcpiTbValidateRsdp (
>      ACPI_TABLE_RSDP         *Rsdp);
> @@ -324,7 +319,7 @@ ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
>   *
>   ******************************************************************************/
>
> -static UINT8 *
> +UINT8 *
>  AcpiTbScanMemoryForRsdp (
>      UINT8                   *StartAddress,
>      UINT32                  Length)
> diff --git a/src/acpica/source/components/utilities/uteval.c b/src/acpica/source/components/utilities/uteval.c
> index 90677b9..b8d7b6b 100644
> --- a/src/acpica/source/components/utilities/uteval.c
> +++ b/src/acpica/source/components/utilities/uteval.c
> @@ -332,7 +332,8 @@ AcpiUtEvaluateNumericObject (
>   * RETURN:      Status
>   *
>   * DESCRIPTION: Executes _STA for selected device and stores results in
> - *              *Flags.
> + *              *Flags. If _STA does not exist, then the device is assumed
> + *              to be present/functional/enabled (as per the ACPI spec).
>   *
>   *              NOTE: Internal function, no parameter validation
>   *
> @@ -356,6 +357,11 @@ AcpiUtExecute_STA (
>      {
>          if (AE_NOT_FOUND == Status)
>          {
> +            /*
> +             * if _STA does not exist, then (as per the ACPI specification),
> +             * the returned flags will indicate that the device is present,
> +             * functional, and enabled.
> +             */
>              ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
>                  "_STA on %4.4s was not found, assuming device is present\n",
>                  AcpiUtGetNodeName (DeviceNode)));
> diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
> index e38deef..a8c928d 100644
> --- a/src/acpica/source/components/utilities/utstring.c
> +++ b/src/acpica/source/components/utilities/utstring.c
> @@ -467,7 +467,8 @@ ErrorExit:
>   * FUNCTION:    AcpiUtPrintString
>   *
>   * PARAMETERS:  String          - Null terminated ASCII string
> - *              MaxLength       - Maximum output length
> + *              MaxLength       - Maximum output length. Used to constrain the
> + *                                length of strings during debug output only.
>   *
>   * RETURN:      None
>   *
> @@ -479,7 +480,7 @@ ErrorExit:
>  void
>  AcpiUtPrintString (
>      char                    *String,
> -    UINT8                   MaxLength)
> +    UINT16                  MaxLength)
>  {
>      UINT32                  i;
>
> diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
> index 440103e..d328c2b 100644
> --- a/src/acpica/source/include/acdisasm.h
> +++ b/src/acpica/source/include/acdisasm.h
> @@ -180,6 +180,7 @@ typedef enum
>      ACPI_DMT_UINT56,
>      ACPI_DMT_UINT64,
>      ACPI_DMT_BUF7,
> +    ACPI_DMT_BUF10,
>      ACPI_DMT_BUF16,
>      ACPI_DMT_BUF128,
>      ACPI_DMT_SIG,
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 56383de..7042300 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -119,7 +119,7 @@
>
>  /* Current ACPICA subsystem version in YYYYMMDD format */
>
> -#define ACPI_CA_VERSION                 0x20130517
> +#define ACPI_CA_VERSION                 0x20130626
>
>  #include "acconfig.h"
>  #include "actypes.h"
> diff --git a/src/acpica/source/include/actables.h b/src/acpica/source/include/actables.h
> index 3e88f73..dc1bb21 100644
> --- a/src/acpica/source/include/actables.h
> +++ b/src/acpica/source/include/actables.h
> @@ -122,6 +122,15 @@ AcpiAllocateRootTable (
>      UINT32                  InitialTableCount);
>
>  /*
> + * tbxfroot - Root pointer utilities
> + */
> +UINT8 *
> +AcpiTbScanMemoryForRsdp (
> +    UINT8                   *StartAddress,
> +    UINT32                  Length);
> +
> +
> +/*
>   * tbfadt - FADT parse/convert/validate
>   */
>  void
> diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
> index f8c48a3..50d315b 100644
> --- a/src/acpica/source/include/actypes.h
> +++ b/src/acpica/source/include/actypes.h
> @@ -752,13 +752,6 @@ typedef UINT32                          ACPI_EVENT_STATUS;
>  #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
>  #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
>
> -/*
> - * General Purpose Events (GPE)
> - */
> -#define ACPI_GPE_INVALID                0xFF
> -#define ACPI_GPE_MAX                    0xFF
> -#define ACPI_NUM_GPE                    256
> -
>  /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
>
>  #define ACPI_GPE_ENABLE                 0
> diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
> index fdbc142..62442de 100644
> --- a/src/acpica/source/include/acutils.h
> +++ b/src/acpica/source/include/acutils.h
> @@ -975,7 +975,7 @@ AcpiUtStrtoul64 (
>  void
>  AcpiUtPrintString (
>      char                    *String,
> -    UINT8                   MaxLength);
> +    UINT16                  MaxLength);
>
>  void
>  UtConvertBackslashes (
> diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
> index ef869f6..c5024b5 100644
> --- a/src/acpica/source/tools/acpiexec/aehandlers.c
> +++ b/src/acpica/source/tools/acpiexec/aehandlers.c
> @@ -1264,7 +1264,7 @@ AeRegionHandler (
>              case AML_FIELD_ATTRIB_QUICK:
>              case AML_FIELD_ATTRIB_SEND_RCV:
>              case AML_FIELD_ATTRIB_BYTE:
> -
> +
>                  Length = 1;
>                  break;
>
> --
> 1.8.3.1
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - June 28, 2013, 3:34 a.m.
On 06/27/2013 06:54 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> This set of ACPICA fixes includes the following fixes pertinant for fwts:
>  (cut and re-formatetd from the ACPICA mailing list release message):
> 
> 1) ACPICA kernel-resident subsystem:
> 
> Fixed an issue with runtime repair of the _CST object. Null or invalid
> elements were not always removed properly. Lv Zheng.
> 
> Removed an arbitrary restriction of 256 GPEs per GPE block (such as the
> FADT-defined GPE0 and GPE1). For GPE0, GPE1, and each GPE Block Device,
> the maximum number of GPEs is 1016. Use of multiple GPE block devices
> makes the system-wide number of GPEs essentially unlimited.
> 
> 2) iASL Compiler/Disassembler and Tools:
> 
> Disassembler: Added some missing types for the HEST and EINJ tables:
> "Set Error Type With Address", "CMCI", "MCE", and "Flush Cacheline".
> 
> iASL/Preprocessor: Implemented full support for nested #if/#else/#elif/#endif
> blocks. Allows arbitrary depth of nested blocks.
> 
> Disassembler: Expanded maximum output string length to 64K. Was 256 bytes
> max. The original purpose of this constraint was to limit the amount of
> debug output. However, the string function in question (UtPrintString) is
> now used for the disassembler also, where 256 bytes is insufficient.
> Reported by RehabMan@GitHub.
> 
> iASL/DataTables: Fixed some problems and issues with compilation of DMAR
> tables. ACPICA BZ 999. Lv Zheng.
> 
> iASL: Fixed a couple of error exit issues that could result in a "Could not
> delete <file>" message during ASL compilation.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/common/dmrestag.c                |   1 +
>  src/acpica/source/common/dmtable.c                 |  10 +
>  src/acpica/source/common/dmtbdump.c                |   3 +
>  src/acpica/source/common/dmtbinfo.c                |   1 +
>  src/acpica/source/compiler/aslcompile.c            |  14 +-
>  src/acpica/source/compiler/aslmessages.h           |   3 +-
>  src/acpica/source/compiler/asltree.c               |   3 +-
>  src/acpica/source/compiler/aslutils.c              |   3 +-
>  src/acpica/source/compiler/dtfield.c               |   3 +-
>  src/acpica/source/compiler/dtio.c                  |  25 +-
>  src/acpica/source/compiler/dttable.c               |  32 +-
>  src/acpica/source/compiler/dttemplate.h            |  18 +-
>  src/acpica/source/compiler/dtutils.c               |   6 +
>  src/acpica/source/compiler/preprocess.h            |  20 +-
>  src/acpica/source/compiler/prscan.c                | 404 +++++++++++++++------
>  src/acpica/source/components/debugger/dbcmds.c     |   4 +-
>  src/acpica/source/components/debugger/dbdisply.c   |   4 +-
>  src/acpica/source/components/debugger/dbinput.c    |  10 +-
>  src/acpica/source/components/debugger/dbnames.c    |   4 +-
>  .../source/components/disassembler/dmbuffer.c      |   6 +-
>  .../source/components/disassembler/dmopcode.c      |   2 +-
>  .../source/components/disassembler/dmresrcl.c      |   2 +-
>  .../source/components/disassembler/dmresrcl2.c     |   8 +-
>  src/acpica/source/components/events/evgpeinit.c    |  11 -
>  src/acpica/source/components/executer/exdump.c     |   5 +-
>  src/acpica/source/components/namespace/nsdump.c    |   2 +-
>  src/acpica/source/components/namespace/nsrepair2.c |  28 +-
>  src/acpica/source/components/namespace/nsxfname.c  |  11 +-
>  src/acpica/source/components/resources/rsdump.c    |   2 +-
>  src/acpica/source/components/resources/rsutils.c   |   2 +-
>  src/acpica/source/components/tables/tbxfroot.c     |   7 +-
>  src/acpica/source/components/utilities/uteval.c    |   8 +-
>  src/acpica/source/components/utilities/utstring.c  |   5 +-
>  src/acpica/source/include/acdisasm.h               |   1 +
>  src/acpica/source/include/acpixf.h                 |   2 +-
>  src/acpica/source/include/actables.h               |   9 +
>  src/acpica/source/include/actypes.h                |   7 -
>  src/acpica/source/include/acutils.h                |   2 +-
>  src/acpica/source/tools/acpiexec/aehandlers.c      |   2 +-
>  39 files changed, 451 insertions(+), 239 deletions(-)
> 
> diff --git a/src/acpica/source/common/dmrestag.c b/src/acpica/source/common/dmrestag.c
> index cc1aece..6f12f74 100644
> --- a/src/acpica/source/common/dmrestag.c
> +++ b/src/acpica/source/common/dmrestag.c
> @@ -738,6 +738,7 @@ AcpiGetTagPathname (
>      Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
>      if (ACPI_FAILURE (Status))
>      {
> +        ACPI_FREE (Pathname);
>          return (NULL);
>      }
>  
> diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c
> index 35767c1..b1f2e77 100644
> --- a/src/acpica/source/common/dmtable.c
> +++ b/src/acpica/source/common/dmtable.c
> @@ -172,6 +172,7 @@ static const char           *AcpiDmEinjActions[] =
>      "Execute Operation",
>      "Check Busy Status",
>      "Get Command Status",
> +    "Set Error Type With Address",
>      "Unknown Action"
>  };
>  
> @@ -182,6 +183,7 @@ static const char           *AcpiDmEinjInstructions[] =
>      "Write Register",
>      "Write Register Value",
>      "Noop",
> +    "Flush Cacheline",
>      "Unknown Instruction"
>  };
>  
> @@ -252,6 +254,8 @@ static const char           *AcpiDmHestNotifySubnames[] =
>      "Local Interrupt",
>      "SCI",
>      "NMI",
> +    "CMCI",                         /* ACPI 5.0 */
> +    "MCE",                          /* ACPI 5.0 */
>      "Unknown Notify Type"           /* Reserved */
>  };
>  
> @@ -816,6 +820,11 @@ AcpiDmDumpTable (
>              ByteLength = 8;
>              break;
>  
> +        case ACPI_DMT_BUF10:
> +
> +            ByteLength = 10;
> +            break;
> +
>          case ACPI_DMT_BUF16:
>          case ACPI_DMT_UUID:
>  
> @@ -934,6 +943,7 @@ AcpiDmDumpTable (
>              break;
>  
>          case ACPI_DMT_BUF7:
> +        case ACPI_DMT_BUF10:
>          case ACPI_DMT_BUF16:
>          case ACPI_DMT_BUF128:
>              /*
> diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c
> index 3d7ac6d..84c646a 100644
> --- a/src/acpica/source/common/dmtbdump.c
> +++ b/src/acpica/source/common/dmtbdump.c
> @@ -944,6 +944,7 @@ AcpiDmDumpDmar (
>          {
>              return;
>          }
> +        AcpiOsPrintf ("\n");
>  
>          switch (SubTable->Type)
>          {
> @@ -996,6 +997,7 @@ AcpiDmDumpDmar (
>              {
>                  return;
>              }
> +            AcpiOsPrintf ("\n");
>  
>              /* Dump the PCI Path entries for this device scope */
>  
> @@ -1013,6 +1015,7 @@ AcpiDmDumpDmar (
>  
>                  PathOffset += 2;
>                  PciPath += 2;
> +                AcpiOsPrintf ("\n");
>              }
>  
>              /* Point to next device scope entry */
> diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c
> index 743c654..def6de8 100644
> --- a/src/acpica/source/common/dmtbinfo.c
> +++ b/src/acpica/source/common/dmtbinfo.c
> @@ -852,6 +852,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoDmar[] =
>  {
>      {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Width),                   "Host Address Width", 0},
>      {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Flags),                   "Flags", 0},
> +    {ACPI_DMT_BUF10,    ACPI_DMAR_OFFSET (Reserved[0]),             "Reserved", 0},
>      ACPI_DMT_TERMINATOR
>  };
>  
> diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
> index 4932abd..3d5a1a5 100644
> --- a/src/acpica/source/compiler/aslcompile.c
> +++ b/src/acpica/source/compiler/aslcompile.c
> @@ -1038,7 +1038,19 @@ CmCleanupAndExit (
>  
>      /* Close all open files */
>  
> -    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
> +    /*
> +     * Take care with the preprocessor file (.i), it might be the same
> +     * as the "input" file, depending on where the compiler has terminated
> +     * or aborted. Prevent attempt to close the same file twice in
> +     * loop below.
> +     */
> +    if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
> +        Gbl_Files[ASL_FILE_INPUT].Handle)
> +    {
> +        Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
> +    }
> +
> +    /* Close the standard I/O files */
>  
>      for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
>      {
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 586afca..16c1d94 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -320,7 +320,7 @@ typedef enum
>      ASL_MSG_TOO_MANY_ARGUMENTS,
>      ASL_MSG_UNKNOWN_DIRECTIVE,
>      ASL_MSG_UNKNOWN_PRAGMA,
> -
> +    ASL_MSG_WARNING_DIRECTIVE,
>  
>      /* These messages are used by the data table compiler only */
>  
> @@ -505,6 +505,7 @@ char                        *AslMessages [] =
>  /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
>  /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
>  /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
> +/*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
>  
>  /* Table compiler */
>  
> diff --git a/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c
> index 2fb249b..59cea2b 100644
> --- a/src/acpica/source/compiler/asltree.c
> +++ b/src/acpica/source/compiler/asltree.c
> @@ -895,6 +895,7 @@ TrLinkChildren (
>          {
>              AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,
>                  "Child node list invalid");
> +            va_end(ap);
>              return (Op);
>          }
>  
> @@ -941,8 +942,8 @@ TrLinkChildren (
>          }
>          PrevChild = Child;
>      }
> -    va_end(ap);
>  
> +    va_end(ap);
>      DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
>      return (Op);
>  }
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 53fba5a..2e4db5a 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -425,8 +425,6 @@ DbgPrint (
>      va_list                 Args;
>  
>  
> -    va_start (Args, Fmt);
> -
>      if (!Gbl_DebugFlag)
>      {
>          return;
> @@ -438,6 +436,7 @@ DbgPrint (
>          return;
>      }
>  
> +    va_start (Args, Fmt);
>      (void) vfprintf (stderr, Fmt, Args);
>      va_end (Args);
>      return;
> diff --git a/src/acpica/source/compiler/dtfield.c b/src/acpica/source/compiler/dtfield.c
> index 6d781ca..00debb8 100644
> --- a/src/acpica/source/compiler/dtfield.c
> +++ b/src/acpica/source/compiler/dtfield.c
> @@ -539,12 +539,13 @@ DtCompileBuffer (
>          if (ACPI_FAILURE (Status))
>          {
>              DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
> -            return (ByteLength - Count);
> +            goto Exit;
>          }
>  
>          Buffer[i] = (UINT8) Value;
>      }
>  
> +Exit:
>      ACPI_FREE (StringValue);
>      return (ByteLength - Count);
>  }
> diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c
> index f20792d..3c22381 100644
> --- a/src/acpica/source/compiler/dtio.c
> +++ b/src/acpica/source/compiler/dtio.c
> @@ -359,31 +359,21 @@ DtParseLine (
>  
>      while (Start < Colon)
>      {
> -        if (*Start == ' ')
> -        {
> -            Start++;
> -            continue;
> -        }
> -
> -        /* Found left bracket, go to the right bracket */
> -
>          if (*Start == '[')
>          {
> +            /* Found left bracket, go to the right bracket */
> +
>              while (Start < Colon && *Start != ']')
>              {
>                  Start++;
>              }
> -
> -            if (Start == Colon)
> -            {
> -                break;
> -            }
> -
> -            Start++;
> -            continue;
> +        }
> +        else if (*Start != ' ')
> +        {
> +            break;
>          }
>  
> -        break;
> +        Start++;
>      }
>  
>      /*
> @@ -1210,4 +1200,5 @@ DtWriteTableToListing (
>      AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0);
>  
>      AcpiOsRedirectOutput (stdout);
> +    ACPI_FREE (Buffer);
>  }
> diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c
> index a7c6e18..e754cc4 100644
> --- a/src/acpica/source/compiler/dttable.c
> +++ b/src/acpica/source/compiler/dttable.c
> @@ -613,8 +613,9 @@ DtCompileDmar (
>      DT_FIELD                *SubtableStart;
>      ACPI_DMTABLE_INFO       *InfoTable;
>      ACPI_DMAR_HEADER        *DmarHeader;
> -    UINT8                   *ReservedBuffer;
> -    UINT32                  ReservedSize;
> +    ACPI_DMAR_DEVICE_SCOPE  *DmarDeviceScope;
> +    UINT32                  DeviceScopeLength;
> +    UINT32                  PciPathLength;
>  
>  
>      Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
> @@ -625,17 +626,7 @@ DtCompileDmar (
>  
>      ParentTable = DtPeekSubtable ();
>      DtInsertSubtable (ParentTable, Subtable);
> -
> -    /* DMAR Reserved area */
> -
> -    ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved);
> -    ReservedBuffer = UtLocalCalloc (ReservedSize);
> -
> -    DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
> -
> -    ACPI_FREE (ReservedBuffer);
> -    ParentTable = DtPeekSubtable ();
> -    DtInsertSubtable (ParentTable, Subtable);
> +    DtPushSubtable (Subtable);
>  
>      while (*PFieldList)
>      {
> @@ -693,10 +684,13 @@ DtCompileDmar (
>  
>          ParentTable = DtPeekSubtable ();
>          DtInsertSubtable (ParentTable, Subtable);
> +        DtPushSubtable (Subtable);
>  
>          /* Optional Device Scope subtables */
>  
> -        while (*PFieldList)
> +        DeviceScopeLength = DmarHeader->Length - Subtable->Length -
> +            ParentTable->Length;
> +        while (DeviceScopeLength)
>          {
>              Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
>                          &Subtable, FALSE);
> @@ -709,9 +703,12 @@ DtCompileDmar (
>              DtInsertSubtable (ParentTable, Subtable);
>              DtPushSubtable (Subtable);
>  
> +            DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
> +
>              /* Optional PCI Paths */
>  
> -            while (*PFieldList)
> +            PciPathLength = DmarDeviceScope->Length - Subtable->Length;
> +            while (PciPathLength)
>              {
>                  Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
>                              &Subtable, FALSE);
> @@ -723,10 +720,15 @@ DtCompileDmar (
>  
>                  ParentTable = DtPeekSubtable ();
>                  DtInsertSubtable (ParentTable, Subtable);
> +                PciPathLength -= Subtable->Length;
>              }
> +
> +            DtPopSubtable ();
> +            DeviceScopeLength -= DmarDeviceScope->Length;
>          }
>  
>          DtPopSubtable ();
> +        DtPopSubtable ();
>      }
>  
>      return (AE_OK);
> diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h
> index 9543ad6..f131b62 100644
> --- a/src/acpica/source/compiler/dttemplate.h
> +++ b/src/acpica/source/compiler/dttemplate.h
> @@ -260,22 +260,22 @@ const unsigned char TemplateDbgp[] =
>  const unsigned char TemplateDmar[] =
>  {
>      0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00,  /* 00000000    "DMAR...." */
> -    0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
> +    0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
>      0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
>      0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
> -    0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "(.. /..." */
> +    0x17,0x05,0x13,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "... /..." */
>      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */
>      0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00,  /* 00000030    "........" */
> -    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
> -    0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07,  /* 00000040    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
> +    0x03,0x08,0x00,0x00,0x08,0x00,0x00,0x01,  /* 00000040    "........" */
>      0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00,  /* 00000048    ".. ....." */
> -    0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000050    "...x...." */
> -    0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000058    ".?.x...." */
> -    0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00,  /* 00000060    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000050    "........" */
> +    0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000058    "........" */
> +    0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x02,  /* 00000060    "........" */
>      0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00,  /* 00000068    "........" */
> -    0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00,  /* 00000070    "........" */
> +    0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x03,  /* 00000070    "........" */
>      0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00,  /* 00000078    "........" */
> -    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
> +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
>      0x00,0x00,0x00,0x00                       /* 00000088    "...."     */
>  };
>  
> diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c
> index dacb9c4..0045e07 100644
> --- a/src/acpica/source/compiler/dtutils.c
> +++ b/src/acpica/source/compiler/dtutils.c
> @@ -469,6 +469,7 @@ DtGetFieldType (
>  
>      case ACPI_DMT_BUFFER:
>      case ACPI_DMT_BUF7:
> +    case ACPI_DMT_BUF10:
>      case ACPI_DMT_BUF16:
>      case ACPI_DMT_BUF128:
>      case ACPI_DMT_PCI_PATH:
> @@ -702,6 +703,11 @@ DtGetFieldLength (
>          }
>          break;
>  
> +    case ACPI_DMT_BUF10:
> +
> +        ByteLength = 10;
> +        break;
> +
>      case ACPI_DMT_BUF16:
>      case ACPI_DMT_UUID:
>  
> diff --git a/src/acpica/source/compiler/preprocess.h b/src/acpica/source/compiler/preprocess.h
> index 3e4eaff..ccf83d0 100644
> --- a/src/acpica/source/compiler/preprocess.h
> +++ b/src/acpica/source/compiler/preprocess.h
> @@ -196,6 +196,17 @@ typedef struct pr_file_node
>  
>  } PR_FILE_NODE;
>  
> +#define MAX_ARGUMENT_LENGTH     24
> +
> +typedef struct directive_info
> +{
> +    struct directive_info       *Next;
> +    char                        Argument[MAX_ARGUMENT_LENGTH];
> +    int                         Directive;
> +    BOOLEAN                     IgnoringThisCodeBlock;
> +
> +} DIRECTIVE_INFO;
> +
>  
>  /*
>   * Globals
> @@ -208,12 +219,13 @@ PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /*
>  PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
>  PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
>  
> -PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
> -PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
>  PR_EXTERN UINT32                Gbl_PreprocessorLineNumber;
>  PR_EXTERN int                   Gbl_IfDepth;
> +PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
> +PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
>  PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE);
> -
> +PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE);
> +PR_EXTERN DIRECTIVE_INFO        PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL);
>  
>  /*
>   * prscan - Preprocessor entry
> @@ -230,7 +242,7 @@ void
>  PrTerminatePreprocessor (
>      void);
>  
> -BOOLEAN
> +void
>  PrDoPreprocess (
>      void);
>  
> diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c
> index a32f14c..c36a52c 100644
> --- a/src/acpica/source/compiler/prscan.c
> +++ b/src/acpica/source/compiler/prscan.c
> @@ -137,13 +137,27 @@ PrPreprocessInputFile (
>  static void
>  PrDoDirective (
>      char                    *DirectiveToken,
> -    char                    **Next,
> -    BOOLEAN                 *IgnoringThisCodeBlock);
> +    char                    **Next);
>  
>  static int
>  PrMatchDirective (
>      char                    *Directive);
>  
> +static void
> +PrPushDirective (
> +    int                     Directive,
> +    char                    *Argument);
> +
> +static ACPI_STATUS
> +PrPopDirective (
> +    void);
> +
> +static void
> +PrDbgPrint (
> +    char                    *Action,
> +    char                    *DirectiveName);
> +
> +
>  /*
>   * Supported preprocessor directives
>   */
> @@ -228,11 +242,16 @@ PrInitializeGlobals (
>  {
>      /* Init globals */
>  
> -    Gbl_IfDepth = 0;
>      Gbl_InputFileList = NULL;
>      Gbl_CurrentLineNumber = 0;
>      Gbl_PreprocessorLineNumber = 1;
>      Gbl_PreprocessorError = FALSE;
> +
> +    /* These are used to track #if/#else blocks (possibly nested) */
> +
> +    Gbl_IfDepth = 0;
> +    Gbl_IgnoringThisCodeBlock = FALSE;
> +    Gbl_DirectiveStack = NULL;
>  }
>  
>  
> @@ -279,7 +298,7 @@ PrTerminatePreprocessor (
>   *
>   * PARAMETERS:  None
>   *
> - * RETURN:      Error Status. TRUE if error, FALSE if OK.
> + * RETURN:      None
>   *
>   * DESCRIPTION: Main entry point for the iASL Preprocessor. Input file must
>   *              be already open. Handles multiple input files via the
> @@ -287,7 +306,7 @@ PrTerminatePreprocessor (
>   *
>   ******************************************************************************/
>  
> -BOOLEAN
> +void
>  PrDoPreprocess (
>      void)
>  {
> @@ -309,20 +328,7 @@ PrDoPreprocess (
>  
>      } while (MoreInputFiles);
>  
> -
> -    /*
> -     * TBD: is this necessary? (Do we abort on any preprocessing errors?)
> -     */
> -    if (Gbl_PreprocessorError)
> -    {
> -        /* TBD: can't use source_output file for preprocessor error reporting */
> -
> -        Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL;
> -        PrTerminatePreprocessor ();
> -        return (TRUE);
> -    }
> -
> -    /* Point compiler input to the new preprocessor file (.i) */
> +    /* Point compiler input to the new preprocessor output file (.i) */
>  
>      FlCloseFile (ASL_FILE_INPUT);
>      Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle;
> @@ -334,7 +340,6 @@ PrDoPreprocess (
>      Gbl_CurrentLineNumber = 1;
>  
>      DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n");
> -    return (FALSE);
>  }
>  
>  
> @@ -362,7 +367,6 @@ PrPreprocessInputFile (
>      char                    *ReplaceString;
>      PR_DEFINE_INFO          *DefineInfo;
>      ACPI_SIZE               TokenOffset;
> -    BOOLEAN                 IgnoringThisCodeBlock = FALSE;
>      char                    *Next;
>      int                     OffsetAdjust;
>  
> @@ -392,7 +396,7 @@ PrPreprocessInputFile (
>  
>              /* Execute the directive, do not write line to output file */
>  
> -            PrDoDirective (Token, &Next, &IgnoringThisCodeBlock);
> +            PrDoDirective (Token, &Next);
>              continue;
>          }
>  
> @@ -401,7 +405,7 @@ PrPreprocessInputFile (
>           * FALSE, ignore the line and do not write it to the output file.
>           * This continues until an #else or #endif is encountered.
>           */
> -        if (IgnoringThisCodeBlock == TRUE)
> +        if (Gbl_IgnoringThisCodeBlock)
>          {
>              continue;
>          }
> @@ -488,12 +492,8 @@ PrPreprocessInputFile (
>   *
>   * PARAMETERS:  Directive               - Pointer to directive name token
>   *              Next                    - "Next" buffer from GetNextToken
> - *              IgnoringThisCodeBlock   - Where the "ignore code" flag is
> - *                                        returned.
>   *
> - * RETURN:      IgnoringThisCodeBlock: Set to TRUE if we are skipping the FALSE
> - *              part of an #if or #else block. Set to FALSE when the
> - *              corresponding #else or #endif is encountered.
> + * RETURN:      None.
>   *
>   * DESCRIPTION: Main processing for all preprocessor directives
>   *
> @@ -502,8 +502,7 @@ PrPreprocessInputFile (
>  static void
>  PrDoDirective (
>      char                    *DirectiveToken,
> -    char                    **Next,
> -    BOOLEAN                 *IgnoringThisCodeBlock)
> +    char                    **Next)
>  {
>      char                    *Token = Gbl_MainTokenBuffer;
>      char                    *Token2;
> @@ -531,14 +530,28 @@ PrDoDirective (
>          return;
>      }
>  
> -    /* TBD: Need a faster way to do this: */
> -
> -    if ((Directive == PR_DIRECTIVE_ELIF) ||
> -        (Directive == PR_DIRECTIVE_ELSE) ||
> -        (Directive == PR_DIRECTIVE_ENDIF))
> +    /*
> +     * If we are currently ignoring this block and we encounter a #else or
> +     * #elif, we must ignore their blocks also if the parent block is also
> +     * being ignored.
> +     */
> +    if (Gbl_IgnoringThisCodeBlock)
>      {
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
> -            Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
> +        switch (Directive)
> +        {
> +        case PR_DIRECTIVE_ELSE:
> +        case PR_DIRECTIVE_ELIF:
> +
> +            if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock)
> +            {
> +                PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
> +                return;
> +            }
> +            break;
> +
> +        default:
> +            break;
> +        }
>      }
>  
>      /*
> @@ -548,57 +561,54 @@ PrDoDirective (
>       */
>      switch (Directive)
>      {
> +    case PR_DIRECTIVE_ELSE:
> +
> +        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
> +        PrDbgPrint ("Executing", "else block");
> +        return;
> +
>      case PR_DIRECTIVE_ELIF:
>  
> -        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
> -        if (*IgnoringThisCodeBlock == TRUE)
> +        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
> +        Directive = PR_DIRECTIVE_IF;
> +
> +        if (Gbl_IgnoringThisCodeBlock == TRUE)
>          {
>              /* Not executing the ELSE part -- all done here */
> +            PrDbgPrint ("Ignoring", "elif block");
>              return;
>          }
>  
> -        /* Will execute the ELSE..IF part */
> +        /*
> +         * After this, we will execute the IF part further below.
> +         * First, however, pop off the original #if directive.
> +         */
> +        if (ACPI_FAILURE (PrPopDirective ()))
> +        {
> +            PrError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
> +                THIS_TOKEN_OFFSET (DirectiveToken));
> +        }
>  
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "#elif - Executing else block\n",
> -            Gbl_CurrentLineNumber);
> -        Directive = PR_DIRECTIVE_IF;
> +        PrDbgPrint ("Executing", "elif block");
>          break;
>  
> -    case PR_DIRECTIVE_ELSE:
> +    case PR_DIRECTIVE_ENDIF:
>  
> -        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
> -        return;
> +        PrDbgPrint ("Executing", "endif");
>  
> -    case PR_DIRECTIVE_ENDIF:
> +        /* Pop the owning #if/#ifdef/#ifndef */
>  
> -        *IgnoringThisCodeBlock = FALSE;
> -        Gbl_IfDepth--;
> -        if (Gbl_IfDepth < 0)
> +        if (ACPI_FAILURE (PrPopDirective ()))
>          {
>              PrError (ASL_ERROR, ASL_MSG_ENDIF_MISMATCH,
>                  THIS_TOKEN_OFFSET (DirectiveToken));
> -            Gbl_IfDepth = 0;
>          }
>          return;
>  
>      default:
> -
>          break;
>      }
>  
> -    /*
> -     * At this point, if we are ignoring the current code block,
> -     * do not process any more directives (i.e., ignore them also.)
> -     */
> -    if (*IgnoringThisCodeBlock == TRUE)
> -    {
> -        return;
> -    }
> -
> -    DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
> -        Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
> -
>      /* Most directives have at least one argument */
>  
>      if (Gbl_DirectiveInfo[Directive].ArgCount == 1)
> @@ -610,8 +620,85 @@ PrDoDirective (
>          }
>      }
>  
> +    /*
> +     * At this point, if we are ignoring the current code block,
> +     * do not process any more directives (i.e., ignore them also.)
> +     * For "if" style directives, open/push a new block anyway. We
> +     * must do this to keep track of #endif directives
> +     */
> +    if (Gbl_IgnoringThisCodeBlock)
> +    {
> +        switch (Directive)
> +        {
> +        case PR_DIRECTIVE_IF:
> +        case PR_DIRECTIVE_IFDEF:
> +        case PR_DIRECTIVE_IFNDEF:
> +
> +            PrPushDirective (Directive, Token);
> +            PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
> +            break;
> +
> +        default:
> +            break;
> +        }
> +
> +        return;
> +    }
> +
> +    /*
> +     * Execute the directive
> +     */
> +    PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name);
> +
>      switch (Directive)
>      {
> +    case PR_DIRECTIVE_IF:
> +
> +        TokenOffset = Token - Gbl_MainTokenBuffer;
> +
> +        /* Need to expand #define macros in the expression string first */
> +
> +        Status = PrResolveIntegerExpression (
> +            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
> +        if (ACPI_FAILURE (Status))
> +        {
> +            return;
> +        }
> +
> +        PrPushDirective (Directive, Token);
> +        if (!Value)
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> +            "Resolved #if: %8.8X%8.8X %s\n",
> +            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
> +            Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> +        break;
> +
> +    case PR_DIRECTIVE_IFDEF:
> +
> +        PrPushDirective (Directive, Token);
> +        if (!PrMatchDefine (Token))
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        PrDbgPrint ("Evaluated", "ifdef");
> +        break;
> +
> +    case PR_DIRECTIVE_IFNDEF:
> +
> +        PrPushDirective (Directive, Token);
> +        if (PrMatchDefine (Token))
> +        {
> +            Gbl_IgnoringThisCodeBlock = TRUE;
> +        }
> +
> +        PrDbgPrint ("Evaluated", "ifndef");
> +        break;
> +
>      case PR_DIRECTIVE_DEFINE:
>          /*
>           * By definition, if first char after the name is a paren,
> @@ -667,64 +754,15 @@ PrDoDirective (
>  
>      case PR_DIRECTIVE_ERROR:
>  
> -        /* TBD compiler should abort */
>          /* Note: No macro expansion */
>  
>          PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE,
>              THIS_TOKEN_OFFSET (Token));
> -        break;
> -
> -    case PR_DIRECTIVE_IF:
>  
> -        TokenOffset = Token - Gbl_MainTokenBuffer;
> -
> -        /* Need to expand #define macros in the expression string first */
> -
> -        Status = PrResolveIntegerExpression (
> -            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return;
> -        }
> -
> -        if (!Value)
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Resolved #if: %8.8X%8.8X %s\n",
> -            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
> -            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> -
> -        Gbl_IfDepth++;
> -        break;
> -
> -    case PR_DIRECTIVE_IFDEF:
> -
> -        if (!PrMatchDefine (Token))
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        Gbl_IfDepth++;
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Start #ifdef %s\n", Gbl_CurrentLineNumber,
> -            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
> -        break;
> -
> -    case PR_DIRECTIVE_IFNDEF:
> -
> -        if (PrMatchDefine (Token))
> -        {
> -            *IgnoringThisCodeBlock = TRUE;
> -        }
> -
> -        Gbl_IfDepth++;
> -        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
> -            "Start #ifndef %2.2X\n", Gbl_CurrentLineNumber,
> -            *IgnoringThisCodeBlock, Gbl_CurrentLineNumber);
> -        break;
> +        Gbl_SourceLine = 0;
> +        Gbl_NextError = Gbl_ErrorLog;
> +        CmCleanupAndExit ();
> +        exit(1);
>  
>      case PR_DIRECTIVE_INCLUDE:
>  
> @@ -810,7 +848,7 @@ PrDoDirective (
>  
>      case PR_DIRECTIVE_WARNING:
>  
> -        PrError (ASL_WARNING, ASL_MSG_ERROR_DIRECTIVE,
> +        PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE,
>              THIS_TOKEN_OFFSET (Token));
>          break;
>  
> @@ -825,7 +863,6 @@ PrDoDirective (
>  
>      return;
>  
> -
>  SyntaxError:
>  
>      PrError (ASL_ERROR, ASL_MSG_DIRECTIVE_SYNTAX,
> @@ -868,3 +905,130 @@ PrMatchDirective (
>  
>      return (ASL_DIRECTIVE_NOT_FOUND);    /* Command not recognized */
>  }
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrPushDirective
> + *
> + * PARAMETERS:  Directive           - Encoded directive ID
> + *              Argument            - String containing argument to the
> + *                                    directive
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Push an item onto the directive stack. Used for processing
> + *              nested #if/#else type conditional compilation directives.
> + *              Specifically: Used on detection of #if/#ifdef/#ifndef to open
> + *              a block.
> + *
> + ******************************************************************************/
> +
> +static void
> +PrPushDirective (
> +    int                     Directive,
> +    char                    *Argument)
> +{
> +    DIRECTIVE_INFO          *Info;
> +
> +
> +    /* Allocate and populate a stack info item */
> +
> +    Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO));
> +
> +    Info->Next = Gbl_DirectiveStack;
> +    Info->Directive = Directive;
> +    Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock;
> +    strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH);
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT,
> +        "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Gbl_DirectiveInfo[Directive].Name,
> +        Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
> +
> +    /* Push new item */
> +
> +    Gbl_DirectiveStack = Info;
> +    Gbl_IfDepth++;
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrPopDirective
> + *
> + * PARAMETERS:  None
> + *
> + * RETURN:      Status. Error if the stack is empty.
> + *
> + * DESCRIPTION: Pop an item off the directive stack. Used for processing
> + *              nested #if/#else type conditional compilation directives.
> + *              Specifically: Used on detection of #elif and #endif to remove
> + *              the original #if/#ifdef/#ifndef from the stack and close
> + *              the block.
> + *
> + ******************************************************************************/
> +
> +static ACPI_STATUS
> +PrPopDirective (
> +    void)
> +{
> +    DIRECTIVE_INFO          *Info;
> +
> +
> +    /* Check for empty stack */
> +
> +    Info = Gbl_DirectiveStack;
> +    if (!Info)
> +    {
> +        return (AE_ERROR);
> +    }
> +
> +    /* Pop one item, keep globals up-to-date */
> +
> +    Gbl_IfDepth--;
> +    Gbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock;
> +    Gbl_DirectiveStack = Info->Next;
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT,
> +        "Pr(%.4u) - [%u %s] %*s Popped [#%s %s]: IgnoreFlag now = %s\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Gbl_DirectiveInfo[Info->Directive].Name,
> +        Info->Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
> +
> +    ACPI_FREE (Info);
> +    return (AE_OK);
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    PrDbgPrint
> + *
> + * PARAMETERS:  Action              - Action being performed
> + *              DirectiveName       - Directive being processed
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Special debug print for directive processing.
> + *
> + ******************************************************************************/
> +
> +static void
> +PrDbgPrint (
> +    char                    *Action,
> +    char                    *DirectiveName)
> +{
> +
> +    DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] "
> +        "%*s %s #%s, Depth %u\n",
> +        Gbl_CurrentLineNumber, Gbl_IfDepth,
> +        Gbl_IgnoringThisCodeBlock ? "I" : "E",
> +        Gbl_IfDepth * 4, " ",
> +        Action, DirectiveName, Gbl_IfDepth);
> +}
> diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c
> index 0e1c49b..54ddf1a 100644
> --- a/src/acpica/source/components/debugger/dbcmds.c
> +++ b/src/acpica/source/components/debugger/dbcmds.c
> @@ -177,13 +177,15 @@ AcpiDbConvertToNode (
>      char                    *InString)
>  {
>      ACPI_NAMESPACE_NODE     *Node;
> +    ACPI_SIZE               Address;
>  
>  
>      if ((*InString >= 0x30) && (*InString <= 0x39))
>      {
>          /* Numeric argument, convert */
>  
> -        Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
> +        Address = ACPI_STRTOUL (InString, NULL, 16);
> +        Node = ACPI_TO_POINTER (Address);
>          if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
>          {
>              AcpiOsPrintf ("Address %p is invalid in this address space\n",
> diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c
> index a42a954..832647d 100644
> --- a/src/acpica/source/components/debugger/dbdisply.c
> +++ b/src/acpica/source/components/debugger/dbdisply.c
> @@ -211,9 +211,11 @@ AcpiDbGetPointer (
>      void                    *Target)
>  {
>      void                    *ObjPtr;
> +    ACPI_SIZE               Address;
>  
>  
> -    ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
> +    Address = ACPI_STRTOUL (Target, NULL, 16);
> +    ObjPtr = ACPI_TO_POINTER (Address);
>      return (ObjPtr);
>  }
>  
> diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
> index 8f30208..2f6127f 100644
> --- a/src/acpica/source/components/debugger/dbinput.c
> +++ b/src/acpica/source/components/debugger/dbinput.c
> @@ -901,7 +901,7 @@ AcpiDbCommandDispatch (
>          break;
>  
>      case CMD_EVENT:
> -        
> +
>          AcpiOsPrintf ("Event command not implemented\n");
>          break;
>  
> @@ -960,7 +960,7 @@ AcpiDbCommandDispatch (
>          return (Status);
>  
>      case CMD_HISTORY_LAST: /* !! command */
> -        
> +
>          CommandLine = AcpiDbGetFromHistory (NULL);
>          if (!CommandLine)
>          {
> @@ -971,12 +971,12 @@ AcpiDbCommandDispatch (
>          return (Status);
>  
>      case CMD_INFORMATION:
> -        
> +
>          AcpiDbDisplayMethodInfo (Op);
>          break;
>  
>      case CMD_INTEGRITY:
> -        
> +
>          AcpiDbCheckIntegrity ();
>          break;
>  
> @@ -1070,7 +1070,7 @@ AcpiDbCommandDispatch (
>          break;
>  
>      case CMD_OWNER:
> -        
> +
>          AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
>          break;
>  
> diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
> index bc37388..9fbe539 100644
> --- a/src/acpica/source/components/debugger/dbnames.c
> +++ b/src/acpica/source/components/debugger/dbnames.c
> @@ -855,11 +855,13 @@ AcpiDbFindReferences (
>      char                    *ObjectArg)
>  {
>      ACPI_OPERAND_OBJECT     *ObjDesc;
> +    ACPI_SIZE               Address;
>  
>  
>      /* Convert string to object pointer */
>  
> -    ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
> +    Address = ACPI_STRTOUL (ObjectArg, NULL, 16);
> +    ObjDesc = ACPI_TO_POINTER (Address);
>  
>      /* Search all nodes in namespace */
>  
> diff --git a/src/acpica/source/components/disassembler/dmbuffer.c b/src/acpica/source/components/disassembler/dmbuffer.c
> index 4b33c56..9e9f4c4 100644
> --- a/src/acpica/source/components/disassembler/dmbuffer.c
> +++ b/src/acpica/source/components/disassembler/dmbuffer.c
> @@ -249,7 +249,7 @@ AcpiDmByteList (
>      case ACPI_DASM_STRING:
>  
>          AcpiDmIndent (Info->Level);
> -        AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX);
> +        AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX);
>          AcpiOsPrintf ("\n");
>          break;
>  
> @@ -595,11 +595,9 @@ AcpiDmUnicode (
>      WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
>      WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
>  
> -
> -    AcpiOsPrintf ("\"");
> -
>      /* Write every other byte as an ASCII character */
>  
> +    AcpiOsPrintf ("\"");
>      for (i = 0; i < (WordCount - 1); i++)
>      {
>          AcpiOsPrintf ("%c", (int) WordData[i]);
> diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
> index 36cfd8a..767c2bf 100644
> --- a/src/acpica/source/components/disassembler/dmopcode.c
> +++ b/src/acpica/source/components/disassembler/dmopcode.c
> @@ -705,7 +705,7 @@ AcpiDmDisassembleOneOp (
>  
>      case AML_STRING_OP:
>  
> -        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX);
> +        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
>          break;
>  
>      case AML_BUFFER_OP:
> diff --git a/src/acpica/source/components/disassembler/dmresrcl.c b/src/acpica/source/components/disassembler/dmresrcl.c
> index 6d1420d..4096822 100644
> --- a/src/acpica/source/components/disassembler/dmresrcl.c
> +++ b/src/acpica/source/components/disassembler/dmresrcl.c
> @@ -637,7 +637,7 @@ AcpiDmResourceSource (
>      if (TotalLength > (MinimumTotalLength + 1))
>      {
>          AcpiOsPrintf (" ");
> -        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
> +        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
>      }
>  
>      AcpiOsPrintf (", ");
> diff --git a/src/acpica/source/components/disassembler/dmresrcl2.c b/src/acpica/source/components/disassembler/dmresrcl2.c
> index b15db88..a5cc7fb 100644
> --- a/src/acpica/source/components/disassembler/dmresrcl2.c
> +++ b/src/acpica/source/components/disassembler/dmresrcl2.c
> @@ -267,7 +267,7 @@ AcpiDmGpioCommon (
>      {
>          AcpiUtPrintString (
>              ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
> -            ACPI_UINT8_MAX);
> +            ACPI_UINT16_MAX);
>      }
>  
>      AcpiOsPrintf (", ");
> @@ -570,7 +570,7 @@ AcpiDmI2cSerialBusDescriptor (
>  
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>  
>      /* ResourceSourceIndex, ResourceUsage */
>  
> @@ -645,7 +645,7 @@ AcpiDmSpiSerialBusDescriptor (
>  
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>  
>      /* ResourceSourceIndex, ResourceUsage */
>  
> @@ -723,7 +723,7 @@ AcpiDmUartSerialBusDescriptor (
>  
>      AcpiUtPrintString (
>          ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
> -        ACPI_UINT8_MAX);
> +        ACPI_UINT16_MAX);
>  
>      /* ResourceSourceIndex, ResourceUsage */
>  
> diff --git a/src/acpica/source/components/events/evgpeinit.c b/src/acpica/source/components/events/evgpeinit.c
> index 8cf5730..c9ae57b 100644
> --- a/src/acpica/source/components/events/evgpeinit.c
> +++ b/src/acpica/source/components/events/evgpeinit.c
> @@ -206,7 +206,6 @@ AcpiEvGpeInitialize (
>          /* GPE block 0 exists (has both length and address > 0) */
>  
>          RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
> -
>          GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
>  
>          /* Install GPE Block 0 */
> @@ -281,16 +280,6 @@ AcpiEvGpeInitialize (
>          goto Cleanup;
>      }
>  
> -    /* Check for Max GPE number out-of-range */
> -
> -    if (GpeNumberMax > ACPI_GPE_MAX)
> -    {
> -        ACPI_ERROR ((AE_INFO,
> -            "Maximum GPE number from FADT is too large: 0x%X",
> -            GpeNumberMax));
> -        Status = AE_BAD_VALUE;
> -        goto Cleanup;
> -    }
>  
>  Cleanup:
>      (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
> diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c
> index cb93831..af788e2 100644
> --- a/src/acpica/source/components/executer/exdump.c
> +++ b/src/acpica/source/components/executer/exdump.c
> @@ -429,6 +429,7 @@ AcpiExDumpObject (
>  {
>      UINT8                   *Target;
>      char                    *Name;
> +    const char              *ReferenceName;
>      UINT8                   Count;
>  
>  
> @@ -513,8 +514,8 @@ AcpiExDumpObject (
>  
>          case ACPI_EXD_REFERENCE:
>  
> -            AcpiExOutString ("Class Name",
> -                ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
> +            ReferenceName = AcpiUtGetReferenceName (ObjDesc);
> +            AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
>              AcpiExDumpReferenceObj (ObjDesc);
>              break;
>  
> diff --git a/src/acpica/source/components/namespace/nsdump.c b/src/acpica/source/components/namespace/nsdump.c
> index 45f009d..233ded6 100644
> --- a/src/acpica/source/components/namespace/nsdump.c
> +++ b/src/acpica/source/components/namespace/nsdump.c
> @@ -691,7 +691,7 @@ AcpiNsDumpOneObject (
>              break;
>  
>          case ACPI_TYPE_LOCAL_INDEX_FIELD:
> -            
> +
>              ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
>              break;
>  
> diff --git a/src/acpica/source/components/namespace/nsrepair2.c b/src/acpica/source/components/namespace/nsrepair2.c
> index e3ec4a6..46f4107 100644
> --- a/src/acpica/source/components/namespace/nsrepair2.c
> +++ b/src/acpica/source/components/namespace/nsrepair2.c
> @@ -573,19 +573,7 @@ AcpiNsRepair_CST (
>  
>  
>      /*
> -     * Entries (subpackages) in the _CST Package must be sorted by the
> -     * C-state type, in ascending order.
> -     */
> -    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
> -                ACPI_SORT_ASCENDING, "C-State Type");
> -    if (ACPI_FAILURE (Status))
> -    {
> -        return (Status);
> -    }
> -
> -    /*
> -     * We now know the list is correctly sorted by C-state type. Check if
> -     * the C-state type values are proportional.
> +     * Check if the C-state type values are proportional.
>       */
>      OuterElementCount = ReturnObject->Package.Count - 1;
>      i = 0;
> @@ -599,6 +587,7 @@ AcpiNsRepair_CST (
>              ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
>                  "SubPackage[%u] - removing entry due to zero count", i));
>              Removing = TRUE;
> +            goto RemoveElement;
>          }
>  
>          ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */
> @@ -609,6 +598,7 @@ AcpiNsRepair_CST (
>              Removing = TRUE;
>          }
>  
> +RemoveElement:
>          if (Removing)
>          {
>              AcpiNsRemoveElement (ReturnObject, i + 1);
> @@ -624,6 +614,18 @@ AcpiNsRepair_CST (
>  
>      ObjDesc = ReturnObject->Package.Elements[0];
>      ObjDesc->Integer.Value = OuterElementCount;
> +
> +    /*
> +     * Entries (subpackages) in the _CST Package must be sorted by the
> +     * C-state type, in ascending order.
> +     */
> +    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
> +                ACPI_SORT_ASCENDING, "C-State Type");
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (Status);
> +    }
> +
>      return (AE_OK);
>  }
>  
> diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c
> index 71f1191..530d94a 100644
> --- a/src/acpica/source/components/namespace/nsxfname.c
> +++ b/src/acpica/source/components/namespace/nsxfname.c
> @@ -249,6 +249,7 @@ AcpiGetName (
>  {
>      ACPI_STATUS             Status;
>      ACPI_NAMESPACE_NODE     *Node;
> +    char                    *NodeName;
>  
>  
>      /* Parameter validation */
> @@ -299,7 +300,8 @@ AcpiGetName (
>  
>      /* Just copy the ACPI name from the Node and zero terminate it */
>  
> -    ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node));
> +    NodeName = AcpiUtGetNodeName (Node);
> +    ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
>      ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
>      Status = AE_OK;
>  
> @@ -495,9 +497,14 @@ AcpiGetObjectInfo (
>           * Get extra info for ACPI Device/Processor objects only:
>           * Run the _STA, _ADR and, SxW, and _SxD methods.
>           *
> -         * Note: none of these methods are required, so they may or may
> +         * Notes: none of these methods are required, so they may or may
>           * not be present for this device. The Info->Valid bitfield is used
>           * to indicate which methods were found and run successfully.
> +         *
> +         * For _STA, if the method does not exist, then (as per the ACPI
> +         * specification), the returned CurrentStatus flags will indicate
> +         * that the device is present/functional/enabled. Otherwise, the
> +         * CurrentStatus flags reflect the value returned from _STA.
>           */
>  
>          /* Execute the Device._STA method */
> diff --git a/src/acpica/source/components/resources/rsdump.c b/src/acpica/source/components/resources/rsdump.c
> index 26f8315..fb1af63 100644
> --- a/src/acpica/source/components/resources/rsdump.c
> +++ b/src/acpica/source/components/resources/rsdump.c
> @@ -275,7 +275,7 @@ AcpiRsDumpDescriptor (
>              break;
>  
>          case ACPI_RSD_UINT64:
> -            
> +
>              AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
>              break;
>  
> diff --git a/src/acpica/source/components/resources/rsutils.c b/src/acpica/source/components/resources/rsutils.c
> index c04ebac..bdc5ccf 100644
> --- a/src/acpica/source/components/resources/rsutils.c
> +++ b/src/acpica/source/components/resources/rsutils.c
> @@ -265,7 +265,7 @@ AcpiRsMoveData (
>              break;
>  
>          case ACPI_RSC_MOVE32:
> -            
> +
>              ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
>                                  &ACPI_CAST_PTR (UINT32, Source)[i]);
>              break;
> diff --git a/src/acpica/source/components/tables/tbxfroot.c b/src/acpica/source/components/tables/tbxfroot.c
> index 377e2a7..7e6a620 100644
> --- a/src/acpica/source/components/tables/tbxfroot.c
> +++ b/src/acpica/source/components/tables/tbxfroot.c
> @@ -125,11 +125,6 @@
>  
>  /* Local prototypes */
>  
> -static UINT8 *
> -AcpiTbScanMemoryForRsdp (
> -    UINT8                   *StartAddress,
> -    UINT32                  Length);
> -
>  static ACPI_STATUS
>  AcpiTbValidateRsdp (
>      ACPI_TABLE_RSDP         *Rsdp);
> @@ -324,7 +319,7 @@ ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
>   *
>   ******************************************************************************/
>  
> -static UINT8 *
> +UINT8 *
>  AcpiTbScanMemoryForRsdp (
>      UINT8                   *StartAddress,
>      UINT32                  Length)
> diff --git a/src/acpica/source/components/utilities/uteval.c b/src/acpica/source/components/utilities/uteval.c
> index 90677b9..b8d7b6b 100644
> --- a/src/acpica/source/components/utilities/uteval.c
> +++ b/src/acpica/source/components/utilities/uteval.c
> @@ -332,7 +332,8 @@ AcpiUtEvaluateNumericObject (
>   * RETURN:      Status
>   *
>   * DESCRIPTION: Executes _STA for selected device and stores results in
> - *              *Flags.
> + *              *Flags. If _STA does not exist, then the device is assumed
> + *              to be present/functional/enabled (as per the ACPI spec).
>   *
>   *              NOTE: Internal function, no parameter validation
>   *
> @@ -356,6 +357,11 @@ AcpiUtExecute_STA (
>      {
>          if (AE_NOT_FOUND == Status)
>          {
> +            /*
> +             * if _STA does not exist, then (as per the ACPI specification),
> +             * the returned flags will indicate that the device is present,
> +             * functional, and enabled.
> +             */
>              ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
>                  "_STA on %4.4s was not found, assuming device is present\n",
>                  AcpiUtGetNodeName (DeviceNode)));
> diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
> index e38deef..a8c928d 100644
> --- a/src/acpica/source/components/utilities/utstring.c
> +++ b/src/acpica/source/components/utilities/utstring.c
> @@ -467,7 +467,8 @@ ErrorExit:
>   * FUNCTION:    AcpiUtPrintString
>   *
>   * PARAMETERS:  String          - Null terminated ASCII string
> - *              MaxLength       - Maximum output length
> + *              MaxLength       - Maximum output length. Used to constrain the
> + *                                length of strings during debug output only.
>   *
>   * RETURN:      None
>   *
> @@ -479,7 +480,7 @@ ErrorExit:
>  void
>  AcpiUtPrintString (
>      char                    *String,
> -    UINT8                   MaxLength)
> +    UINT16                  MaxLength)
>  {
>      UINT32                  i;
>  
> diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
> index 440103e..d328c2b 100644
> --- a/src/acpica/source/include/acdisasm.h
> +++ b/src/acpica/source/include/acdisasm.h
> @@ -180,6 +180,7 @@ typedef enum
>      ACPI_DMT_UINT56,
>      ACPI_DMT_UINT64,
>      ACPI_DMT_BUF7,
> +    ACPI_DMT_BUF10,
>      ACPI_DMT_BUF16,
>      ACPI_DMT_BUF128,
>      ACPI_DMT_SIG,
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 56383de..7042300 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -119,7 +119,7 @@
>  
>  /* Current ACPICA subsystem version in YYYYMMDD format */
>  
> -#define ACPI_CA_VERSION                 0x20130517
> +#define ACPI_CA_VERSION                 0x20130626
>  
>  #include "acconfig.h"
>  #include "actypes.h"
> diff --git a/src/acpica/source/include/actables.h b/src/acpica/source/include/actables.h
> index 3e88f73..dc1bb21 100644
> --- a/src/acpica/source/include/actables.h
> +++ b/src/acpica/source/include/actables.h
> @@ -122,6 +122,15 @@ AcpiAllocateRootTable (
>      UINT32                  InitialTableCount);
>  
>  /*
> + * tbxfroot - Root pointer utilities
> + */
> +UINT8 *
> +AcpiTbScanMemoryForRsdp (
> +    UINT8                   *StartAddress,
> +    UINT32                  Length);
> +
> +
> +/*
>   * tbfadt - FADT parse/convert/validate
>   */
>  void
> diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
> index f8c48a3..50d315b 100644
> --- a/src/acpica/source/include/actypes.h
> +++ b/src/acpica/source/include/actypes.h
> @@ -752,13 +752,6 @@ typedef UINT32                          ACPI_EVENT_STATUS;
>  #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
>  #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
>  
> -/*
> - * General Purpose Events (GPE)
> - */
> -#define ACPI_GPE_INVALID                0xFF
> -#define ACPI_GPE_MAX                    0xFF
> -#define ACPI_NUM_GPE                    256
> -
>  /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
>  
>  #define ACPI_GPE_ENABLE                 0
> diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
> index fdbc142..62442de 100644
> --- a/src/acpica/source/include/acutils.h
> +++ b/src/acpica/source/include/acutils.h
> @@ -975,7 +975,7 @@ AcpiUtStrtoul64 (
>  void
>  AcpiUtPrintString (
>      char                    *String,
> -    UINT8                   MaxLength);
> +    UINT16                  MaxLength);
>  
>  void
>  UtConvertBackslashes (
> diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
> index ef869f6..c5024b5 100644
> --- a/src/acpica/source/tools/acpiexec/aehandlers.c
> +++ b/src/acpica/source/tools/acpiexec/aehandlers.c
> @@ -1264,7 +1264,7 @@ AeRegionHandler (
>              case AML_FIELD_ATTRIB_QUICK:
>              case AML_FIELD_ATTRIB_SEND_RCV:
>              case AML_FIELD_ATTRIB_BYTE:
> -                
> +
>                  Length = 1;
>                  break;
>  
> 

Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpica/source/common/dmrestag.c b/src/acpica/source/common/dmrestag.c
index cc1aece..6f12f74 100644
--- a/src/acpica/source/common/dmrestag.c
+++ b/src/acpica/source/common/dmrestag.c
@@ -738,6 +738,7 @@  AcpiGetTagPathname (
     Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
     if (ACPI_FAILURE (Status))
     {
+        ACPI_FREE (Pathname);
         return (NULL);
     }
 
diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c
index 35767c1..b1f2e77 100644
--- a/src/acpica/source/common/dmtable.c
+++ b/src/acpica/source/common/dmtable.c
@@ -172,6 +172,7 @@  static const char           *AcpiDmEinjActions[] =
     "Execute Operation",
     "Check Busy Status",
     "Get Command Status",
+    "Set Error Type With Address",
     "Unknown Action"
 };
 
@@ -182,6 +183,7 @@  static const char           *AcpiDmEinjInstructions[] =
     "Write Register",
     "Write Register Value",
     "Noop",
+    "Flush Cacheline",
     "Unknown Instruction"
 };
 
@@ -252,6 +254,8 @@  static const char           *AcpiDmHestNotifySubnames[] =
     "Local Interrupt",
     "SCI",
     "NMI",
+    "CMCI",                         /* ACPI 5.0 */
+    "MCE",                          /* ACPI 5.0 */
     "Unknown Notify Type"           /* Reserved */
 };
 
@@ -816,6 +820,11 @@  AcpiDmDumpTable (
             ByteLength = 8;
             break;
 
+        case ACPI_DMT_BUF10:
+
+            ByteLength = 10;
+            break;
+
         case ACPI_DMT_BUF16:
         case ACPI_DMT_UUID:
 
@@ -934,6 +943,7 @@  AcpiDmDumpTable (
             break;
 
         case ACPI_DMT_BUF7:
+        case ACPI_DMT_BUF10:
         case ACPI_DMT_BUF16:
         case ACPI_DMT_BUF128:
             /*
diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c
index 3d7ac6d..84c646a 100644
--- a/src/acpica/source/common/dmtbdump.c
+++ b/src/acpica/source/common/dmtbdump.c
@@ -944,6 +944,7 @@  AcpiDmDumpDmar (
         {
             return;
         }
+        AcpiOsPrintf ("\n");
 
         switch (SubTable->Type)
         {
@@ -996,6 +997,7 @@  AcpiDmDumpDmar (
             {
                 return;
             }
+            AcpiOsPrintf ("\n");
 
             /* Dump the PCI Path entries for this device scope */
 
@@ -1013,6 +1015,7 @@  AcpiDmDumpDmar (
 
                 PathOffset += 2;
                 PciPath += 2;
+                AcpiOsPrintf ("\n");
             }
 
             /* Point to next device scope entry */
diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c
index 743c654..def6de8 100644
--- a/src/acpica/source/common/dmtbinfo.c
+++ b/src/acpica/source/common/dmtbinfo.c
@@ -852,6 +852,7 @@  ACPI_DMTABLE_INFO           AcpiDmTableInfoDmar[] =
 {
     {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Width),                   "Host Address Width", 0},
     {ACPI_DMT_UINT8,    ACPI_DMAR_OFFSET (Flags),                   "Flags", 0},
+    {ACPI_DMT_BUF10,    ACPI_DMAR_OFFSET (Reserved[0]),             "Reserved", 0},
     ACPI_DMT_TERMINATOR
 };
 
diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
index 4932abd..3d5a1a5 100644
--- a/src/acpica/source/compiler/aslcompile.c
+++ b/src/acpica/source/compiler/aslcompile.c
@@ -1038,7 +1038,19 @@  CmCleanupAndExit (
 
     /* Close all open files */
 
-    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
+    /*
+     * Take care with the preprocessor file (.i), it might be the same
+     * as the "input" file, depending on where the compiler has terminated
+     * or aborted. Prevent attempt to close the same file twice in
+     * loop below.
+     */
+    if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
+        Gbl_Files[ASL_FILE_INPUT].Handle)
+    {
+        Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
+    }
+
+    /* Close the standard I/O files */
 
     for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
     {
diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
index 586afca..16c1d94 100644
--- a/src/acpica/source/compiler/aslmessages.h
+++ b/src/acpica/source/compiler/aslmessages.h
@@ -320,7 +320,7 @@  typedef enum
     ASL_MSG_TOO_MANY_ARGUMENTS,
     ASL_MSG_UNKNOWN_DIRECTIVE,
     ASL_MSG_UNKNOWN_PRAGMA,
-
+    ASL_MSG_WARNING_DIRECTIVE,
 
     /* These messages are used by the data table compiler only */
 
@@ -505,6 +505,7 @@  char                        *AslMessages [] =
 /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
 /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
 /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
+/*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
 
 /* Table compiler */
 
diff --git a/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c
index 2fb249b..59cea2b 100644
--- a/src/acpica/source/compiler/asltree.c
+++ b/src/acpica/source/compiler/asltree.c
@@ -895,6 +895,7 @@  TrLinkChildren (
         {
             AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,
                 "Child node list invalid");
+            va_end(ap);
             return (Op);
         }
 
@@ -941,8 +942,8 @@  TrLinkChildren (
         }
         PrevChild = Child;
     }
-    va_end(ap);
 
+    va_end(ap);
     DbgPrint (ASL_PARSE_OUTPUT, "\n\n");
     return (Op);
 }
diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
index 53fba5a..2e4db5a 100644
--- a/src/acpica/source/compiler/aslutils.c
+++ b/src/acpica/source/compiler/aslutils.c
@@ -425,8 +425,6 @@  DbgPrint (
     va_list                 Args;
 
 
-    va_start (Args, Fmt);
-
     if (!Gbl_DebugFlag)
     {
         return;
@@ -438,6 +436,7 @@  DbgPrint (
         return;
     }
 
+    va_start (Args, Fmt);
     (void) vfprintf (stderr, Fmt, Args);
     va_end (Args);
     return;
diff --git a/src/acpica/source/compiler/dtfield.c b/src/acpica/source/compiler/dtfield.c
index 6d781ca..00debb8 100644
--- a/src/acpica/source/compiler/dtfield.c
+++ b/src/acpica/source/compiler/dtfield.c
@@ -539,12 +539,13 @@  DtCompileBuffer (
         if (ACPI_FAILURE (Status))
         {
             DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
-            return (ByteLength - Count);
+            goto Exit;
         }
 
         Buffer[i] = (UINT8) Value;
     }
 
+Exit:
     ACPI_FREE (StringValue);
     return (ByteLength - Count);
 }
diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c
index f20792d..3c22381 100644
--- a/src/acpica/source/compiler/dtio.c
+++ b/src/acpica/source/compiler/dtio.c
@@ -359,31 +359,21 @@  DtParseLine (
 
     while (Start < Colon)
     {
-        if (*Start == ' ')
-        {
-            Start++;
-            continue;
-        }
-
-        /* Found left bracket, go to the right bracket */
-
         if (*Start == '[')
         {
+            /* Found left bracket, go to the right bracket */
+
             while (Start < Colon && *Start != ']')
             {
                 Start++;
             }
-
-            if (Start == Colon)
-            {
-                break;
-            }
-
-            Start++;
-            continue;
+        }
+        else if (*Start != ' ')
+        {
+            break;
         }
 
-        break;
+        Start++;
     }
 
     /*
@@ -1210,4 +1200,5 @@  DtWriteTableToListing (
     AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0);
 
     AcpiOsRedirectOutput (stdout);
+    ACPI_FREE (Buffer);
 }
diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c
index a7c6e18..e754cc4 100644
--- a/src/acpica/source/compiler/dttable.c
+++ b/src/acpica/source/compiler/dttable.c
@@ -613,8 +613,9 @@  DtCompileDmar (
     DT_FIELD                *SubtableStart;
     ACPI_DMTABLE_INFO       *InfoTable;
     ACPI_DMAR_HEADER        *DmarHeader;
-    UINT8                   *ReservedBuffer;
-    UINT32                  ReservedSize;
+    ACPI_DMAR_DEVICE_SCOPE  *DmarDeviceScope;
+    UINT32                  DeviceScopeLength;
+    UINT32                  PciPathLength;
 
 
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
@@ -625,17 +626,7 @@  DtCompileDmar (
 
     ParentTable = DtPeekSubtable ();
     DtInsertSubtable (ParentTable, Subtable);
-
-    /* DMAR Reserved area */
-
-    ReservedSize = (UINT32) sizeof (((ACPI_TABLE_DMAR *) NULL)->Reserved);
-    ReservedBuffer = UtLocalCalloc (ReservedSize);
-
-    DtCreateSubtable (ReservedBuffer, ReservedSize, &Subtable);
-
-    ACPI_FREE (ReservedBuffer);
-    ParentTable = DtPeekSubtable ();
-    DtInsertSubtable (ParentTable, Subtable);
+    DtPushSubtable (Subtable);
 
     while (*PFieldList)
     {
@@ -693,10 +684,13 @@  DtCompileDmar (
 
         ParentTable = DtPeekSubtable ();
         DtInsertSubtable (ParentTable, Subtable);
+        DtPushSubtable (Subtable);
 
         /* Optional Device Scope subtables */
 
-        while (*PFieldList)
+        DeviceScopeLength = DmarHeader->Length - Subtable->Length -
+            ParentTable->Length;
+        while (DeviceScopeLength)
         {
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
                         &Subtable, FALSE);
@@ -709,9 +703,12 @@  DtCompileDmar (
             DtInsertSubtable (ParentTable, Subtable);
             DtPushSubtable (Subtable);
 
+            DmarDeviceScope = ACPI_CAST_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable->Buffer);
+
             /* Optional PCI Paths */
 
-            while (*PFieldList)
+            PciPathLength = DmarDeviceScope->Length - Subtable->Length;
+            while (PciPathLength)
             {
                 Status = DtCompileTable (PFieldList, TableInfoDmarPciPath,
                             &Subtable, FALSE);
@@ -723,10 +720,15 @@  DtCompileDmar (
 
                 ParentTable = DtPeekSubtable ();
                 DtInsertSubtable (ParentTable, Subtable);
+                PciPathLength -= Subtable->Length;
             }
+
+            DtPopSubtable ();
+            DeviceScopeLength -= DmarDeviceScope->Length;
         }
 
         DtPopSubtable ();
+        DtPopSubtable ();
     }
 
     return (AE_OK);
diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h
index 9543ad6..f131b62 100644
--- a/src/acpica/source/compiler/dttemplate.h
+++ b/src/acpica/source/compiler/dttemplate.h
@@ -260,22 +260,22 @@  const unsigned char TemplateDbgp[] =
 const unsigned char TemplateDmar[] =
 {
     0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00,  /* 00000000    "DMAR...." */
-    0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
+    0x01,0x03,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
     0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
-    0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "(.. /..." */
+    0x17,0x05,0x13,0x20,0x2F,0x01,0x00,0x00,  /* 00000020    "... /..." */
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */
     0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00,  /* 00000030    "........" */
-    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
-    0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07,  /* 00000040    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
+    0x03,0x08,0x00,0x00,0x08,0x00,0x00,0x01,  /* 00000040    "........" */
     0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00,  /* 00000048    ".. ....." */
-    0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000050    "...x...." */
-    0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00,  /* 00000058    ".?.x...." */
-    0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00,  /* 00000060    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000050    "........" */
+    0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000058    "........" */
+    0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x02,  /* 00000060    "........" */
     0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00,  /* 00000068    "........" */
-    0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00,  /* 00000070    "........" */
+    0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x03,  /* 00000070    "........" */
     0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00,  /* 00000078    "........" */
-    0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
     0x00,0x00,0x00,0x00                       /* 00000088    "...."     */
 };
 
diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c
index dacb9c4..0045e07 100644
--- a/src/acpica/source/compiler/dtutils.c
+++ b/src/acpica/source/compiler/dtutils.c
@@ -469,6 +469,7 @@  DtGetFieldType (
 
     case ACPI_DMT_BUFFER:
     case ACPI_DMT_BUF7:
+    case ACPI_DMT_BUF10:
     case ACPI_DMT_BUF16:
     case ACPI_DMT_BUF128:
     case ACPI_DMT_PCI_PATH:
@@ -702,6 +703,11 @@  DtGetFieldLength (
         }
         break;
 
+    case ACPI_DMT_BUF10:
+
+        ByteLength = 10;
+        break;
+
     case ACPI_DMT_BUF16:
     case ACPI_DMT_UUID:
 
diff --git a/src/acpica/source/compiler/preprocess.h b/src/acpica/source/compiler/preprocess.h
index 3e4eaff..ccf83d0 100644
--- a/src/acpica/source/compiler/preprocess.h
+++ b/src/acpica/source/compiler/preprocess.h
@@ -196,6 +196,17 @@  typedef struct pr_file_node
 
 } PR_FILE_NODE;
 
+#define MAX_ARGUMENT_LENGTH     24
+
+typedef struct directive_info
+{
+    struct directive_info       *Next;
+    char                        Argument[MAX_ARGUMENT_LENGTH];
+    int                         Directive;
+    BOOLEAN                     IgnoringThisCodeBlock;
+
+} DIRECTIVE_INFO;
+
 
 /*
  * Globals
@@ -208,12 +219,13 @@  PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /*
 PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
 PR_EXTERN char                  PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */
 
-PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
-PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
 PR_EXTERN UINT32                Gbl_PreprocessorLineNumber;
 PR_EXTERN int                   Gbl_IfDepth;
+PR_EXTERN PR_FILE_NODE          *Gbl_InputFileList;
+PR_EXTERN PR_DEFINE_INFO        PR_INIT_GLOBAL (*Gbl_DefineList, NULL);
 PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_PreprocessorError, FALSE);
-
+PR_EXTERN BOOLEAN               PR_INIT_GLOBAL (Gbl_IgnoringThisCodeBlock, FALSE);
+PR_EXTERN DIRECTIVE_INFO        PR_INIT_GLOBAL (*Gbl_DirectiveStack, NULL);
 
 /*
  * prscan - Preprocessor entry
@@ -230,7 +242,7 @@  void
 PrTerminatePreprocessor (
     void);
 
-BOOLEAN
+void
 PrDoPreprocess (
     void);
 
diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c
index a32f14c..c36a52c 100644
--- a/src/acpica/source/compiler/prscan.c
+++ b/src/acpica/source/compiler/prscan.c
@@ -137,13 +137,27 @@  PrPreprocessInputFile (
 static void
 PrDoDirective (
     char                    *DirectiveToken,
-    char                    **Next,
-    BOOLEAN                 *IgnoringThisCodeBlock);
+    char                    **Next);
 
 static int
 PrMatchDirective (
     char                    *Directive);
 
+static void
+PrPushDirective (
+    int                     Directive,
+    char                    *Argument);
+
+static ACPI_STATUS
+PrPopDirective (
+    void);
+
+static void
+PrDbgPrint (
+    char                    *Action,
+    char                    *DirectiveName);
+
+
 /*
  * Supported preprocessor directives
  */
@@ -228,11 +242,16 @@  PrInitializeGlobals (
 {
     /* Init globals */
 
-    Gbl_IfDepth = 0;
     Gbl_InputFileList = NULL;
     Gbl_CurrentLineNumber = 0;
     Gbl_PreprocessorLineNumber = 1;
     Gbl_PreprocessorError = FALSE;
+
+    /* These are used to track #if/#else blocks (possibly nested) */
+
+    Gbl_IfDepth = 0;
+    Gbl_IgnoringThisCodeBlock = FALSE;
+    Gbl_DirectiveStack = NULL;
 }
 
 
@@ -279,7 +298,7 @@  PrTerminatePreprocessor (
  *
  * PARAMETERS:  None
  *
- * RETURN:      Error Status. TRUE if error, FALSE if OK.
+ * RETURN:      None
  *
  * DESCRIPTION: Main entry point for the iASL Preprocessor. Input file must
  *              be already open. Handles multiple input files via the
@@ -287,7 +306,7 @@  PrTerminatePreprocessor (
  *
  ******************************************************************************/
 
-BOOLEAN
+void
 PrDoPreprocess (
     void)
 {
@@ -309,20 +328,7 @@  PrDoPreprocess (
 
     } while (MoreInputFiles);
 
-
-    /*
-     * TBD: is this necessary? (Do we abort on any preprocessing errors?)
-     */
-    if (Gbl_PreprocessorError)
-    {
-        /* TBD: can't use source_output file for preprocessor error reporting */
-
-        Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL;
-        PrTerminatePreprocessor ();
-        return (TRUE);
-    }
-
-    /* Point compiler input to the new preprocessor file (.i) */
+    /* Point compiler input to the new preprocessor output file (.i) */
 
     FlCloseFile (ASL_FILE_INPUT);
     Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle;
@@ -334,7 +340,6 @@  PrDoPreprocess (
     Gbl_CurrentLineNumber = 1;
 
     DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n");
-    return (FALSE);
 }
 
 
@@ -362,7 +367,6 @@  PrPreprocessInputFile (
     char                    *ReplaceString;
     PR_DEFINE_INFO          *DefineInfo;
     ACPI_SIZE               TokenOffset;
-    BOOLEAN                 IgnoringThisCodeBlock = FALSE;
     char                    *Next;
     int                     OffsetAdjust;
 
@@ -392,7 +396,7 @@  PrPreprocessInputFile (
 
             /* Execute the directive, do not write line to output file */
 
-            PrDoDirective (Token, &Next, &IgnoringThisCodeBlock);
+            PrDoDirective (Token, &Next);
             continue;
         }
 
@@ -401,7 +405,7 @@  PrPreprocessInputFile (
          * FALSE, ignore the line and do not write it to the output file.
          * This continues until an #else or #endif is encountered.
          */
-        if (IgnoringThisCodeBlock == TRUE)
+        if (Gbl_IgnoringThisCodeBlock)
         {
             continue;
         }
@@ -488,12 +492,8 @@  PrPreprocessInputFile (
  *
  * PARAMETERS:  Directive               - Pointer to directive name token
  *              Next                    - "Next" buffer from GetNextToken
- *              IgnoringThisCodeBlock   - Where the "ignore code" flag is
- *                                        returned.
  *
- * RETURN:      IgnoringThisCodeBlock: Set to TRUE if we are skipping the FALSE
- *              part of an #if or #else block. Set to FALSE when the
- *              corresponding #else or #endif is encountered.
+ * RETURN:      None.
  *
  * DESCRIPTION: Main processing for all preprocessor directives
  *
@@ -502,8 +502,7 @@  PrPreprocessInputFile (
 static void
 PrDoDirective (
     char                    *DirectiveToken,
-    char                    **Next,
-    BOOLEAN                 *IgnoringThisCodeBlock)
+    char                    **Next)
 {
     char                    *Token = Gbl_MainTokenBuffer;
     char                    *Token2;
@@ -531,14 +530,28 @@  PrDoDirective (
         return;
     }
 
-    /* TBD: Need a faster way to do this: */
-
-    if ((Directive == PR_DIRECTIVE_ELIF) ||
-        (Directive == PR_DIRECTIVE_ELSE) ||
-        (Directive == PR_DIRECTIVE_ENDIF))
+    /*
+     * If we are currently ignoring this block and we encounter a #else or
+     * #elif, we must ignore their blocks also if the parent block is also
+     * being ignored.
+     */
+    if (Gbl_IgnoringThisCodeBlock)
     {
-        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
-            Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
+        switch (Directive)
+        {
+        case PR_DIRECTIVE_ELSE:
+        case PR_DIRECTIVE_ELIF:
+
+            if (Gbl_DirectiveStack && Gbl_DirectiveStack->IgnoringThisCodeBlock)
+            {
+                PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
+                return;
+            }
+            break;
+
+        default:
+            break;
+        }
     }
 
     /*
@@ -548,57 +561,54 @@  PrDoDirective (
      */
     switch (Directive)
     {
+    case PR_DIRECTIVE_ELSE:
+
+        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
+        PrDbgPrint ("Executing", "else block");
+        return;
+
     case PR_DIRECTIVE_ELIF:
 
-        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
-        if (*IgnoringThisCodeBlock == TRUE)
+        Gbl_IgnoringThisCodeBlock = !(Gbl_IgnoringThisCodeBlock);
+        Directive = PR_DIRECTIVE_IF;
+
+        if (Gbl_IgnoringThisCodeBlock == TRUE)
         {
             /* Not executing the ELSE part -- all done here */
+            PrDbgPrint ("Ignoring", "elif block");
             return;
         }
 
-        /* Will execute the ELSE..IF part */
+        /*
+         * After this, we will execute the IF part further below.
+         * First, however, pop off the original #if directive.
+         */
+        if (ACPI_FAILURE (PrPopDirective ()))
+        {
+            PrError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
+                THIS_TOKEN_OFFSET (DirectiveToken));
+        }
 
-        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
-            "#elif - Executing else block\n",
-            Gbl_CurrentLineNumber);
-        Directive = PR_DIRECTIVE_IF;
+        PrDbgPrint ("Executing", "elif block");
         break;
 
-    case PR_DIRECTIVE_ELSE:
+    case PR_DIRECTIVE_ENDIF:
 
-        *IgnoringThisCodeBlock = !(*IgnoringThisCodeBlock);
-        return;
+        PrDbgPrint ("Executing", "endif");
 
-    case PR_DIRECTIVE_ENDIF:
+        /* Pop the owning #if/#ifdef/#ifndef */
 
-        *IgnoringThisCodeBlock = FALSE;
-        Gbl_IfDepth--;
-        if (Gbl_IfDepth < 0)
+        if (ACPI_FAILURE (PrPopDirective ()))
         {
             PrError (ASL_ERROR, ASL_MSG_ENDIF_MISMATCH,
                 THIS_TOKEN_OFFSET (DirectiveToken));
-            Gbl_IfDepth = 0;
         }
         return;
 
     default:
-
         break;
     }
 
-    /*
-     * At this point, if we are ignoring the current code block,
-     * do not process any more directives (i.e., ignore them also.)
-     */
-    if (*IgnoringThisCodeBlock == TRUE)
-    {
-        return;
-    }
-
-    DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID "Begin #%s\n",
-        Gbl_CurrentLineNumber, Gbl_DirectiveInfo[Directive].Name);
-
     /* Most directives have at least one argument */
 
     if (Gbl_DirectiveInfo[Directive].ArgCount == 1)
@@ -610,8 +620,85 @@  PrDoDirective (
         }
     }
 
+    /*
+     * At this point, if we are ignoring the current code block,
+     * do not process any more directives (i.e., ignore them also.)
+     * For "if" style directives, open/push a new block anyway. We
+     * must do this to keep track of #endif directives
+     */
+    if (Gbl_IgnoringThisCodeBlock)
+    {
+        switch (Directive)
+        {
+        case PR_DIRECTIVE_IF:
+        case PR_DIRECTIVE_IFDEF:
+        case PR_DIRECTIVE_IFNDEF:
+
+            PrPushDirective (Directive, Token);
+            PrDbgPrint ("Ignoring", Gbl_DirectiveInfo[Directive].Name);
+            break;
+
+        default:
+            break;
+        }
+
+        return;
+    }
+
+    /*
+     * Execute the directive
+     */
+    PrDbgPrint ("Begin execution", Gbl_DirectiveInfo[Directive].Name);
+
     switch (Directive)
     {
+    case PR_DIRECTIVE_IF:
+
+        TokenOffset = Token - Gbl_MainTokenBuffer;
+
+        /* Need to expand #define macros in the expression string first */
+
+        Status = PrResolveIntegerExpression (
+            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+
+        PrPushDirective (Directive, Token);
+        if (!Value)
+        {
+            Gbl_IgnoringThisCodeBlock = TRUE;
+        }
+
+        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
+            "Resolved #if: %8.8X%8.8X %s\n",
+            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
+            Gbl_IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
+        break;
+
+    case PR_DIRECTIVE_IFDEF:
+
+        PrPushDirective (Directive, Token);
+        if (!PrMatchDefine (Token))
+        {
+            Gbl_IgnoringThisCodeBlock = TRUE;
+        }
+
+        PrDbgPrint ("Evaluated", "ifdef");
+        break;
+
+    case PR_DIRECTIVE_IFNDEF:
+
+        PrPushDirective (Directive, Token);
+        if (PrMatchDefine (Token))
+        {
+            Gbl_IgnoringThisCodeBlock = TRUE;
+        }
+
+        PrDbgPrint ("Evaluated", "ifndef");
+        break;
+
     case PR_DIRECTIVE_DEFINE:
         /*
          * By definition, if first char after the name is a paren,
@@ -667,64 +754,15 @@  PrDoDirective (
 
     case PR_DIRECTIVE_ERROR:
 
-        /* TBD compiler should abort */
         /* Note: No macro expansion */
 
         PrError (ASL_ERROR, ASL_MSG_ERROR_DIRECTIVE,
             THIS_TOKEN_OFFSET (Token));
-        break;
-
-    case PR_DIRECTIVE_IF:
 
-        TokenOffset = Token - Gbl_MainTokenBuffer;
-
-        /* Need to expand #define macros in the expression string first */
-
-        Status = PrResolveIntegerExpression (
-            &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
-        if (ACPI_FAILURE (Status))
-        {
-            return;
-        }
-
-        if (!Value)
-        {
-            *IgnoringThisCodeBlock = TRUE;
-        }
-
-        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
-            "Resolved #if: %8.8X%8.8X %s\n",
-            Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value),
-            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
-
-        Gbl_IfDepth++;
-        break;
-
-    case PR_DIRECTIVE_IFDEF:
-
-        if (!PrMatchDefine (Token))
-        {
-            *IgnoringThisCodeBlock = TRUE;
-        }
-
-        Gbl_IfDepth++;
-        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
-            "Start #ifdef %s\n", Gbl_CurrentLineNumber,
-            *IgnoringThisCodeBlock ? "<Skipping Block>" : "<Executing Block>");
-        break;
-
-    case PR_DIRECTIVE_IFNDEF:
-
-        if (PrMatchDefine (Token))
-        {
-            *IgnoringThisCodeBlock = TRUE;
-        }
-
-        Gbl_IfDepth++;
-        DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
-            "Start #ifndef %2.2X\n", Gbl_CurrentLineNumber,
-            *IgnoringThisCodeBlock, Gbl_CurrentLineNumber);
-        break;
+        Gbl_SourceLine = 0;
+        Gbl_NextError = Gbl_ErrorLog;
+        CmCleanupAndExit ();
+        exit(1);
 
     case PR_DIRECTIVE_INCLUDE:
 
@@ -810,7 +848,7 @@  PrDoDirective (
 
     case PR_DIRECTIVE_WARNING:
 
-        PrError (ASL_WARNING, ASL_MSG_ERROR_DIRECTIVE,
+        PrError (ASL_WARNING, ASL_MSG_WARNING_DIRECTIVE,
             THIS_TOKEN_OFFSET (Token));
         break;
 
@@ -825,7 +863,6 @@  PrDoDirective (
 
     return;
 
-
 SyntaxError:
 
     PrError (ASL_ERROR, ASL_MSG_DIRECTIVE_SYNTAX,
@@ -868,3 +905,130 @@  PrMatchDirective (
 
     return (ASL_DIRECTIVE_NOT_FOUND);    /* Command not recognized */
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    PrPushDirective
+ *
+ * PARAMETERS:  Directive           - Encoded directive ID
+ *              Argument            - String containing argument to the
+ *                                    directive
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Push an item onto the directive stack. Used for processing
+ *              nested #if/#else type conditional compilation directives.
+ *              Specifically: Used on detection of #if/#ifdef/#ifndef to open
+ *              a block.
+ *
+ ******************************************************************************/
+
+static void
+PrPushDirective (
+    int                     Directive,
+    char                    *Argument)
+{
+    DIRECTIVE_INFO          *Info;
+
+
+    /* Allocate and populate a stack info item */
+
+    Info = ACPI_ALLOCATE (sizeof (DIRECTIVE_INFO));
+
+    Info->Next = Gbl_DirectiveStack;
+    Info->Directive = Directive;
+    Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock;
+    strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH);
+
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n",
+        Gbl_CurrentLineNumber, Gbl_IfDepth,
+        Gbl_IgnoringThisCodeBlock ? "I" : "E",
+        Gbl_IfDepth * 4, " ",
+        Gbl_DirectiveInfo[Directive].Name,
+        Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
+
+    /* Push new item */
+
+    Gbl_DirectiveStack = Info;
+    Gbl_IfDepth++;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    PrPopDirective
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status. Error if the stack is empty.
+ *
+ * DESCRIPTION: Pop an item off the directive stack. Used for processing
+ *              nested #if/#else type conditional compilation directives.
+ *              Specifically: Used on detection of #elif and #endif to remove
+ *              the original #if/#ifdef/#ifndef from the stack and close
+ *              the block.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+PrPopDirective (
+    void)
+{
+    DIRECTIVE_INFO          *Info;
+
+
+    /* Check for empty stack */
+
+    Info = Gbl_DirectiveStack;
+    if (!Info)
+    {
+        return (AE_ERROR);
+    }
+
+    /* Pop one item, keep globals up-to-date */
+
+    Gbl_IfDepth--;
+    Gbl_IgnoringThisCodeBlock = Info->IgnoringThisCodeBlock;
+    Gbl_DirectiveStack = Info->Next;
+
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "Pr(%.4u) - [%u %s] %*s Popped [#%s %s]: IgnoreFlag now = %s\n",
+        Gbl_CurrentLineNumber, Gbl_IfDepth,
+        Gbl_IgnoringThisCodeBlock ? "I" : "E",
+        Gbl_IfDepth * 4, " ",
+        Gbl_DirectiveInfo[Info->Directive].Name,
+        Info->Argument, Gbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
+
+    ACPI_FREE (Info);
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    PrDbgPrint
+ *
+ * PARAMETERS:  Action              - Action being performed
+ *              DirectiveName       - Directive being processed
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Special debug print for directive processing.
+ *
+ ******************************************************************************/
+
+static void
+PrDbgPrint (
+    char                    *Action,
+    char                    *DirectiveName)
+{
+
+    DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] "
+        "%*s %s #%s, Depth %u\n",
+        Gbl_CurrentLineNumber, Gbl_IfDepth,
+        Gbl_IgnoringThisCodeBlock ? "I" : "E",
+        Gbl_IfDepth * 4, " ",
+        Action, DirectiveName, Gbl_IfDepth);
+}
diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c
index 0e1c49b..54ddf1a 100644
--- a/src/acpica/source/components/debugger/dbcmds.c
+++ b/src/acpica/source/components/debugger/dbcmds.c
@@ -177,13 +177,15 @@  AcpiDbConvertToNode (
     char                    *InString)
 {
     ACPI_NAMESPACE_NODE     *Node;
+    ACPI_SIZE               Address;
 
 
     if ((*InString >= 0x30) && (*InString <= 0x39))
     {
         /* Numeric argument, convert */
 
-        Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
+        Address = ACPI_STRTOUL (InString, NULL, 16);
+        Node = ACPI_TO_POINTER (Address);
         if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
         {
             AcpiOsPrintf ("Address %p is invalid in this address space\n",
diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c
index a42a954..832647d 100644
--- a/src/acpica/source/components/debugger/dbdisply.c
+++ b/src/acpica/source/components/debugger/dbdisply.c
@@ -211,9 +211,11 @@  AcpiDbGetPointer (
     void                    *Target)
 {
     void                    *ObjPtr;
+    ACPI_SIZE               Address;
 
 
-    ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
+    Address = ACPI_STRTOUL (Target, NULL, 16);
+    ObjPtr = ACPI_TO_POINTER (Address);
     return (ObjPtr);
 }
 
diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
index 8f30208..2f6127f 100644
--- a/src/acpica/source/components/debugger/dbinput.c
+++ b/src/acpica/source/components/debugger/dbinput.c
@@ -901,7 +901,7 @@  AcpiDbCommandDispatch (
         break;
 
     case CMD_EVENT:
-        
+
         AcpiOsPrintf ("Event command not implemented\n");
         break;
 
@@ -960,7 +960,7 @@  AcpiDbCommandDispatch (
         return (Status);
 
     case CMD_HISTORY_LAST: /* !! command */
-        
+
         CommandLine = AcpiDbGetFromHistory (NULL);
         if (!CommandLine)
         {
@@ -971,12 +971,12 @@  AcpiDbCommandDispatch (
         return (Status);
 
     case CMD_INFORMATION:
-        
+
         AcpiDbDisplayMethodInfo (Op);
         break;
 
     case CMD_INTEGRITY:
-        
+
         AcpiDbCheckIntegrity ();
         break;
 
@@ -1070,7 +1070,7 @@  AcpiDbCommandDispatch (
         break;
 
     case CMD_OWNER:
-        
+
         AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
         break;
 
diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
index bc37388..9fbe539 100644
--- a/src/acpica/source/components/debugger/dbnames.c
+++ b/src/acpica/source/components/debugger/dbnames.c
@@ -855,11 +855,13 @@  AcpiDbFindReferences (
     char                    *ObjectArg)
 {
     ACPI_OPERAND_OBJECT     *ObjDesc;
+    ACPI_SIZE               Address;
 
 
     /* Convert string to object pointer */
 
-    ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+    Address = ACPI_STRTOUL (ObjectArg, NULL, 16);
+    ObjDesc = ACPI_TO_POINTER (Address);
 
     /* Search all nodes in namespace */
 
diff --git a/src/acpica/source/components/disassembler/dmbuffer.c b/src/acpica/source/components/disassembler/dmbuffer.c
index 4b33c56..9e9f4c4 100644
--- a/src/acpica/source/components/disassembler/dmbuffer.c
+++ b/src/acpica/source/components/disassembler/dmbuffer.c
@@ -249,7 +249,7 @@  AcpiDmByteList (
     case ACPI_DASM_STRING:
 
         AcpiDmIndent (Info->Level);
-        AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX);
+        AcpiUtPrintString ((char *) ByteData, ACPI_UINT16_MAX);
         AcpiOsPrintf ("\n");
         break;
 
@@ -595,11 +595,9 @@  AcpiDmUnicode (
     WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
     WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
 
-
-    AcpiOsPrintf ("\"");
-
     /* Write every other byte as an ASCII character */
 
+    AcpiOsPrintf ("\"");
     for (i = 0; i < (WordCount - 1); i++)
     {
         AcpiOsPrintf ("%c", (int) WordData[i]);
diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
index 36cfd8a..767c2bf 100644
--- a/src/acpica/source/components/disassembler/dmopcode.c
+++ b/src/acpica/source/components/disassembler/dmopcode.c
@@ -705,7 +705,7 @@  AcpiDmDisassembleOneOp (
 
     case AML_STRING_OP:
 
-        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT8_MAX);
+        AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
         break;
 
     case AML_BUFFER_OP:
diff --git a/src/acpica/source/components/disassembler/dmresrcl.c b/src/acpica/source/components/disassembler/dmresrcl.c
index 6d1420d..4096822 100644
--- a/src/acpica/source/components/disassembler/dmresrcl.c
+++ b/src/acpica/source/components/disassembler/dmresrcl.c
@@ -637,7 +637,7 @@  AcpiDmResourceSource (
     if (TotalLength > (MinimumTotalLength + 1))
     {
         AcpiOsPrintf (" ");
-        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
+        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
     }
 
     AcpiOsPrintf (", ");
diff --git a/src/acpica/source/components/disassembler/dmresrcl2.c b/src/acpica/source/components/disassembler/dmresrcl2.c
index b15db88..a5cc7fb 100644
--- a/src/acpica/source/components/disassembler/dmresrcl2.c
+++ b/src/acpica/source/components/disassembler/dmresrcl2.c
@@ -267,7 +267,7 @@  AcpiDmGpioCommon (
     {
         AcpiUtPrintString (
             ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset),
-            ACPI_UINT8_MAX);
+            ACPI_UINT16_MAX);
     }
 
     AcpiOsPrintf (", ");
@@ -570,7 +570,7 @@  AcpiDmI2cSerialBusDescriptor (
 
     AcpiUtPrintString (
         ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
-        ACPI_UINT8_MAX);
+        ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
 
@@ -645,7 +645,7 @@  AcpiDmSpiSerialBusDescriptor (
 
     AcpiUtPrintString (
         ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
-        ACPI_UINT8_MAX);
+        ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
 
@@ -723,7 +723,7 @@  AcpiDmUartSerialBusDescriptor (
 
     AcpiUtPrintString (
         ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
-        ACPI_UINT8_MAX);
+        ACPI_UINT16_MAX);
 
     /* ResourceSourceIndex, ResourceUsage */
 
diff --git a/src/acpica/source/components/events/evgpeinit.c b/src/acpica/source/components/events/evgpeinit.c
index 8cf5730..c9ae57b 100644
--- a/src/acpica/source/components/events/evgpeinit.c
+++ b/src/acpica/source/components/events/evgpeinit.c
@@ -206,7 +206,6 @@  AcpiEvGpeInitialize (
         /* GPE block 0 exists (has both length and address > 0) */
 
         RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
-
         GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
 
         /* Install GPE Block 0 */
@@ -281,16 +280,6 @@  AcpiEvGpeInitialize (
         goto Cleanup;
     }
 
-    /* Check for Max GPE number out-of-range */
-
-    if (GpeNumberMax > ACPI_GPE_MAX)
-    {
-        ACPI_ERROR ((AE_INFO,
-            "Maximum GPE number from FADT is too large: 0x%X",
-            GpeNumberMax));
-        Status = AE_BAD_VALUE;
-        goto Cleanup;
-    }
 
 Cleanup:
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c
index cb93831..af788e2 100644
--- a/src/acpica/source/components/executer/exdump.c
+++ b/src/acpica/source/components/executer/exdump.c
@@ -429,6 +429,7 @@  AcpiExDumpObject (
 {
     UINT8                   *Target;
     char                    *Name;
+    const char              *ReferenceName;
     UINT8                   Count;
 
 
@@ -513,8 +514,8 @@  AcpiExDumpObject (
 
         case ACPI_EXD_REFERENCE:
 
-            AcpiExOutString ("Class Name",
-                ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
+            ReferenceName = AcpiUtGetReferenceName (ObjDesc);
+            AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
             AcpiExDumpReferenceObj (ObjDesc);
             break;
 
diff --git a/src/acpica/source/components/namespace/nsdump.c b/src/acpica/source/components/namespace/nsdump.c
index 45f009d..233ded6 100644
--- a/src/acpica/source/components/namespace/nsdump.c
+++ b/src/acpica/source/components/namespace/nsdump.c
@@ -691,7 +691,7 @@  AcpiNsDumpOneObject (
             break;
 
         case ACPI_TYPE_LOCAL_INDEX_FIELD:
-            
+
             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
             break;
 
diff --git a/src/acpica/source/components/namespace/nsrepair2.c b/src/acpica/source/components/namespace/nsrepair2.c
index e3ec4a6..46f4107 100644
--- a/src/acpica/source/components/namespace/nsrepair2.c
+++ b/src/acpica/source/components/namespace/nsrepair2.c
@@ -573,19 +573,7 @@  AcpiNsRepair_CST (
 
 
     /*
-     * Entries (subpackages) in the _CST Package must be sorted by the
-     * C-state type, in ascending order.
-     */
-    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
-                ACPI_SORT_ASCENDING, "C-State Type");
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    /*
-     * We now know the list is correctly sorted by C-state type. Check if
-     * the C-state type values are proportional.
+     * Check if the C-state type values are proportional.
      */
     OuterElementCount = ReturnObject->Package.Count - 1;
     i = 0;
@@ -599,6 +587,7 @@  AcpiNsRepair_CST (
             ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
                 "SubPackage[%u] - removing entry due to zero count", i));
             Removing = TRUE;
+            goto RemoveElement;
         }
 
         ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */
@@ -609,6 +598,7 @@  AcpiNsRepair_CST (
             Removing = TRUE;
         }
 
+RemoveElement:
         if (Removing)
         {
             AcpiNsRemoveElement (ReturnObject, i + 1);
@@ -624,6 +614,18 @@  AcpiNsRepair_CST (
 
     ObjDesc = ReturnObject->Package.Elements[0];
     ObjDesc->Integer.Value = OuterElementCount;
+
+    /*
+     * Entries (subpackages) in the _CST Package must be sorted by the
+     * C-state type, in ascending order.
+     */
+    Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
+                ACPI_SORT_ASCENDING, "C-State Type");
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
     return (AE_OK);
 }
 
diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c
index 71f1191..530d94a 100644
--- a/src/acpica/source/components/namespace/nsxfname.c
+++ b/src/acpica/source/components/namespace/nsxfname.c
@@ -249,6 +249,7 @@  AcpiGetName (
 {
     ACPI_STATUS             Status;
     ACPI_NAMESPACE_NODE     *Node;
+    char                    *NodeName;
 
 
     /* Parameter validation */
@@ -299,7 +300,8 @@  AcpiGetName (
 
     /* Just copy the ACPI name from the Node and zero terminate it */
 
-    ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node));
+    NodeName = AcpiUtGetNodeName (Node);
+    ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
     ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
     Status = AE_OK;
 
@@ -495,9 +497,14 @@  AcpiGetObjectInfo (
          * Get extra info for ACPI Device/Processor objects only:
          * Run the _STA, _ADR and, SxW, and _SxD methods.
          *
-         * Note: none of these methods are required, so they may or may
+         * Notes: none of these methods are required, so they may or may
          * not be present for this device. The Info->Valid bitfield is used
          * to indicate which methods were found and run successfully.
+         *
+         * For _STA, if the method does not exist, then (as per the ACPI
+         * specification), the returned CurrentStatus flags will indicate
+         * that the device is present/functional/enabled. Otherwise, the
+         * CurrentStatus flags reflect the value returned from _STA.
          */
 
         /* Execute the Device._STA method */
diff --git a/src/acpica/source/components/resources/rsdump.c b/src/acpica/source/components/resources/rsdump.c
index 26f8315..fb1af63 100644
--- a/src/acpica/source/components/resources/rsdump.c
+++ b/src/acpica/source/components/resources/rsdump.c
@@ -275,7 +275,7 @@  AcpiRsDumpDescriptor (
             break;
 
         case ACPI_RSD_UINT64:
-            
+
             AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
             break;
 
diff --git a/src/acpica/source/components/resources/rsutils.c b/src/acpica/source/components/resources/rsutils.c
index c04ebac..bdc5ccf 100644
--- a/src/acpica/source/components/resources/rsutils.c
+++ b/src/acpica/source/components/resources/rsutils.c
@@ -265,7 +265,7 @@  AcpiRsMoveData (
             break;
 
         case ACPI_RSC_MOVE32:
-            
+
             ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
                                 &ACPI_CAST_PTR (UINT32, Source)[i]);
             break;
diff --git a/src/acpica/source/components/tables/tbxfroot.c b/src/acpica/source/components/tables/tbxfroot.c
index 377e2a7..7e6a620 100644
--- a/src/acpica/source/components/tables/tbxfroot.c
+++ b/src/acpica/source/components/tables/tbxfroot.c
@@ -125,11 +125,6 @@ 
 
 /* Local prototypes */
 
-static UINT8 *
-AcpiTbScanMemoryForRsdp (
-    UINT8                   *StartAddress,
-    UINT32                  Length);
-
 static ACPI_STATUS
 AcpiTbValidateRsdp (
     ACPI_TABLE_RSDP         *Rsdp);
@@ -324,7 +319,7 @@  ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
  *
  ******************************************************************************/
 
-static UINT8 *
+UINT8 *
 AcpiTbScanMemoryForRsdp (
     UINT8                   *StartAddress,
     UINT32                  Length)
diff --git a/src/acpica/source/components/utilities/uteval.c b/src/acpica/source/components/utilities/uteval.c
index 90677b9..b8d7b6b 100644
--- a/src/acpica/source/components/utilities/uteval.c
+++ b/src/acpica/source/components/utilities/uteval.c
@@ -332,7 +332,8 @@  AcpiUtEvaluateNumericObject (
  * RETURN:      Status
  *
  * DESCRIPTION: Executes _STA for selected device and stores results in
- *              *Flags.
+ *              *Flags. If _STA does not exist, then the device is assumed
+ *              to be present/functional/enabled (as per the ACPI spec).
  *
  *              NOTE: Internal function, no parameter validation
  *
@@ -356,6 +357,11 @@  AcpiUtExecute_STA (
     {
         if (AE_NOT_FOUND == Status)
         {
+            /*
+             * if _STA does not exist, then (as per the ACPI specification),
+             * the returned flags will indicate that the device is present,
+             * functional, and enabled.
+             */
             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
                 "_STA on %4.4s was not found, assuming device is present\n",
                 AcpiUtGetNodeName (DeviceNode)));
diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
index e38deef..a8c928d 100644
--- a/src/acpica/source/components/utilities/utstring.c
+++ b/src/acpica/source/components/utilities/utstring.c
@@ -467,7 +467,8 @@  ErrorExit:
  * FUNCTION:    AcpiUtPrintString
  *
  * PARAMETERS:  String          - Null terminated ASCII string
- *              MaxLength       - Maximum output length
+ *              MaxLength       - Maximum output length. Used to constrain the
+ *                                length of strings during debug output only.
  *
  * RETURN:      None
  *
@@ -479,7 +480,7 @@  ErrorExit:
 void
 AcpiUtPrintString (
     char                    *String,
-    UINT8                   MaxLength)
+    UINT16                  MaxLength)
 {
     UINT32                  i;
 
diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
index 440103e..d328c2b 100644
--- a/src/acpica/source/include/acdisasm.h
+++ b/src/acpica/source/include/acdisasm.h
@@ -180,6 +180,7 @@  typedef enum
     ACPI_DMT_UINT56,
     ACPI_DMT_UINT64,
     ACPI_DMT_BUF7,
+    ACPI_DMT_BUF10,
     ACPI_DMT_BUF16,
     ACPI_DMT_BUF128,
     ACPI_DMT_SIG,
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 56383de..7042300 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -119,7 +119,7 @@ 
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20130517
+#define ACPI_CA_VERSION                 0x20130626
 
 #include "acconfig.h"
 #include "actypes.h"
diff --git a/src/acpica/source/include/actables.h b/src/acpica/source/include/actables.h
index 3e88f73..dc1bb21 100644
--- a/src/acpica/source/include/actables.h
+++ b/src/acpica/source/include/actables.h
@@ -122,6 +122,15 @@  AcpiAllocateRootTable (
     UINT32                  InitialTableCount);
 
 /*
+ * tbxfroot - Root pointer utilities
+ */
+UINT8 *
+AcpiTbScanMemoryForRsdp (
+    UINT8                   *StartAddress,
+    UINT32                  Length);
+
+
+/*
  * tbfadt - FADT parse/convert/validate
  */
 void
diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
index f8c48a3..50d315b 100644
--- a/src/acpica/source/include/actypes.h
+++ b/src/acpica/source/include/actypes.h
@@ -752,13 +752,6 @@  typedef UINT32                          ACPI_EVENT_STATUS;
 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
 
-/*
- * General Purpose Events (GPE)
- */
-#define ACPI_GPE_INVALID                0xFF
-#define ACPI_GPE_MAX                    0xFF
-#define ACPI_NUM_GPE                    256
-
 /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
 
 #define ACPI_GPE_ENABLE                 0
diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
index fdbc142..62442de 100644
--- a/src/acpica/source/include/acutils.h
+++ b/src/acpica/source/include/acutils.h
@@ -975,7 +975,7 @@  AcpiUtStrtoul64 (
 void
 AcpiUtPrintString (
     char                    *String,
-    UINT8                   MaxLength);
+    UINT16                  MaxLength);
 
 void
 UtConvertBackslashes (
diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
index ef869f6..c5024b5 100644
--- a/src/acpica/source/tools/acpiexec/aehandlers.c
+++ b/src/acpica/source/tools/acpiexec/aehandlers.c
@@ -1264,7 +1264,7 @@  AeRegionHandler (
             case AML_FIELD_ATTRIB_QUICK:
             case AML_FIELD_ATTRIB_SEND_RCV:
             case AML_FIELD_ATTRIB_BYTE:
-                
+
                 Length = 1;
                 break;