ACPICA: Update to version 20190703
diff mbox series

Message ID 20190704132457.26329-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • ACPICA: Update to version 20190703
Related show

Commit Message

Colin King July 4, 2019, 1:24 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Changes in this release of ACPICA are detailed below:

  * Remove legacy module-level support code.
  * Clear status of GPEs on first direct enable.
  * Tool generation process has been migrated to MSVC 2017.
  * iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only
    at the root scope.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/source/compiler/asldefine.h        |  16 ++
 src/acpica/source/compiler/aslglobal.h        |  15 ++
 src/acpica/source/compiler/aslload.c          |  59 ++++-
 src/acpica/source/compiler/aslmessages.c      |   3 +-
 src/acpica/source/compiler/aslmessages.h      |   1 +
 src/acpica/source/compiler/aslstubs.c         |   6 -
 src/acpica/source/compiler/aslsupport.l       |  18 +-
 .../source/components/debugger/dbobject.c     |   1 -
 .../source/components/dispatcher/dsinit.c     |   2 +-
 src/acpica/source/components/events/evgpe.c   |   9 +-
 .../source/components/events/evgpeblk.c       |   2 +-
 src/acpica/source/components/events/evxface.c |   2 +-
 src/acpica/source/components/events/evxfgpe.c |   2 +-
 .../source/components/executer/exconfig.c     |  12 +-
 .../source/components/namespace/nsaccess.c    |  57 ++++-
 .../source/components/namespace/nseval.c      | 210 ------------------
 .../source/components/namespace/nsinit.c      |  51 ++---
 .../source/components/namespace/nsload.c      |  12 -
 .../source/components/namespace/nsutils.c     |  13 --
 src/acpica/source/components/tables/tbdata.c  |  13 --
 .../source/components/tables/tbxfload.c       |   7 +
 .../source/components/utilities/utinit.c      |   1 -
 .../source/components/utilities/utxfinit.c    |  18 +-
 src/acpica/source/include/acevents.h          |   3 +-
 src/acpica/source/include/acglobal.h          |   1 -
 src/acpica/source/include/acnamesp.h          |   4 -
 src/acpica/source/include/acpixf.h            |   2 +-
 27 files changed, 198 insertions(+), 342 deletions(-)

Comments

Alex Hung July 4, 2019, 3:47 p.m. UTC | #1
On 2019-07-04 7:24 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Changes in this release of ACPICA are detailed below:
> 
>   * Remove legacy module-level support code.
>   * Clear status of GPEs on first direct enable.
>   * Tool generation process has been migrated to MSVC 2017.
>   * iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only
>     at the root scope.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/source/compiler/asldefine.h        |  16 ++
>  src/acpica/source/compiler/aslglobal.h        |  15 ++
>  src/acpica/source/compiler/aslload.c          |  59 ++++-
>  src/acpica/source/compiler/aslmessages.c      |   3 +-
>  src/acpica/source/compiler/aslmessages.h      |   1 +
>  src/acpica/source/compiler/aslstubs.c         |   6 -
>  src/acpica/source/compiler/aslsupport.l       |  18 +-
>  .../source/components/debugger/dbobject.c     |   1 -
>  .../source/components/dispatcher/dsinit.c     |   2 +-
>  src/acpica/source/components/events/evgpe.c   |   9 +-
>  .../source/components/events/evgpeblk.c       |   2 +-
>  src/acpica/source/components/events/evxface.c |   2 +-
>  src/acpica/source/components/events/evxfgpe.c |   2 +-
>  .../source/components/executer/exconfig.c     |  12 +-
>  .../source/components/namespace/nsaccess.c    |  57 ++++-
>  .../source/components/namespace/nseval.c      | 210 ------------------
>  .../source/components/namespace/nsinit.c      |  51 ++---
>  .../source/components/namespace/nsload.c      |  12 -
>  .../source/components/namespace/nsutils.c     |  13 --
>  src/acpica/source/components/tables/tbdata.c  |  13 --
>  .../source/components/tables/tbxfload.c       |   7 +
>  .../source/components/utilities/utinit.c      |   1 -
>  .../source/components/utilities/utxfinit.c    |  18 +-
>  src/acpica/source/include/acevents.h          |   3 +-
>  src/acpica/source/include/acglobal.h          |   1 -
>  src/acpica/source/include/acnamesp.h          |   4 -
>  src/acpica/source/include/acpixf.h            |   2 +-
>  27 files changed, 198 insertions(+), 342 deletions(-)
> 
> diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h
> index cffb0af1..c5111875 100644
> --- a/src/acpica/source/compiler/asldefine.h
> +++ b/src/acpica/source/compiler/asldefine.h
> @@ -298,4 +298,20 @@
>  #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
>  #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
>  
> +/*
> + * Special name segments - these must only be declared at the root scope
> + */
> +#define NAMESEG__PTS    "_PTS"
> +#define NAMESEG__WAK    "_WAK"
> +#define NAMESEG__S0     "_S0_"
> +#define NAMESEG__S1     "_S1_"
> +#define NAMESEG__S2     "_S2_"
> +#define NAMESEG__S3     "_S3_"
> +#define NAMESEG__S4     "_S4_"
> +#define NAMESEG__S5     "_S5_"
> +#define NAMESEG__TTS    "_TTS"
> +
> +#define MAX_SPECIAL_NAMES      9
> +
> +
>  #endif /* ASLDEFINE.H */
> diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
> index 213c5408..740f7f34 100644
> --- a/src/acpica/source/compiler/aslglobal.h
> +++ b/src/acpica/source/compiler/aslglobal.h
> @@ -223,13 +223,28 @@ const char                          *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] =
>      "OP_NOT_FOUND_DURING_LOAD"
>  };
>  
> +const char                          *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] =
> +{
> +    NAMESEG__PTS,
> +    NAMESEG__WAK,
> +    NAMESEG__S0,
> +    NAMESEG__S1,
> +    NAMESEG__S2,
> +    NAMESEG__S3,
> +    NAMESEG__S4,
> +    NAMESEG__S5,
> +    NAMESEG__TTS
> +};
> +
>  #else
>  extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
>  extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
>  extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
> +extern const char                   *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
>  #endif
>  
>  
> +
>  /*
>   * Parser and other externals
>   */
> diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
> index d1523ab6..4dd2dfd0 100644
> --- a/src/acpica/source/compiler/aslload.c
> +++ b/src/acpica/source/compiler/aslload.c
> @@ -164,6 +164,7 @@
>  
>  static ACPI_STATUS
>  LdLoadFieldElements (
> +    UINT32                  AmlType,
>      ACPI_PARSE_OBJECT       *Op,
>      ACPI_WALK_STATE         *WalkState);
>  
> @@ -190,6 +191,10 @@ LdCommonNamespaceEnd (
>      UINT32                  Level,
>      void                    *Context);
>  
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op);
>  
>  /*******************************************************************************
>   *
> @@ -247,7 +252,8 @@ LdLoadNamespace (
>   *
>   * FUNCTION:    LdLoadFieldElements
>   *
> - * PARAMETERS:  Op              - Parent node (Field)
> + * PARAMETERS:  AmlType         - Type to search
> + *              Op              - Parent node (Field)
>   *              WalkState       - Current walk state
>   *
>   * RETURN:      Status
> @@ -259,6 +265,7 @@ LdLoadNamespace (
>  
>  static ACPI_STATUS
>  LdLoadFieldElements (
> +    UINT32                  AmlType,
>      ACPI_PARSE_OBJECT       *Op,
>      ACPI_WALK_STATE         *WalkState)
>  {
> @@ -274,7 +281,7 @@ LdLoadFieldElements (
>      {
>          Status = AcpiNsLookup (WalkState->ScopeInfo,
>              SourceRegion->Asl.Value.String,
> -            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
> +            AmlType, ACPI_IMODE_EXECUTE,
>              ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
>          if (Status == AE_NOT_FOUND)
>          {
> @@ -507,11 +514,15 @@ LdNamespace1Begin (
>       */
>      switch (Op->Asl.AmlOpcode)
>      {
> -    case AML_BANK_FIELD_OP:
>      case AML_INDEX_FIELD_OP:
> +
> +        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
> +        return (Status);
> +
> +    case AML_BANK_FIELD_OP:
>      case AML_FIELD_OP:
>  
> -        Status = LdLoadFieldElements (Op, WalkState);
> +        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
>          return (Status);
>  
>      case AML_INT_CONNECTION_OP:
> @@ -966,6 +977,10 @@ LdNamespace1Begin (
>          }
>      }
>  
> +    /* Check special names like _WAK and _PTS */
> +
> +    LdCheckSpecialNames (Node, Op);
> +
>      if (ForceNewScope)
>      {
>          Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
> @@ -1004,6 +1019,42 @@ FinishNode:
>  }
>  
>  
> +/*******************************************************************************
> + *
> + * FUNCTION:    LdCheckSpecialNames
> + *
> + * PARAMETERS:  Node        - Node that represents the named object
> + *              Op          - Named object declaring this named object
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Check if certain named objects are declared in the incorrect
> + *              scope. Special named objects are listed in
> + *              AslGbl_SpecialNamedObjects and can only be declared at the root
> + *              scope.
> + *
> + ******************************************************************************/
> +
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op)
> +{
> +    UINT32                  i;
> +
> +
> +    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
> +    {
> +        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
> +            Node->Parent != AcpiGbl_RootNode)
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
> +            return;
> +        }
> +    }
> +}
> +
> +
>  /*******************************************************************************
>   *
>   * FUNCTION:    LdNamespace2Begin
> diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
> index cf7a7a4f..48c4dbab 100644
> --- a/src/acpica/source/compiler/aslmessages.c
> +++ b/src/acpica/source/compiler/aslmessages.c
> @@ -365,7 +365,8 @@ const char                      *AslCompilerMsgs [] =
>  /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
>  /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
>  /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
> -/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends beyond end of target buffer"
> +/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
> +/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal"
>  };
>  
>  /* Table compiler */
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 15613685..d998f0fe 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -368,6 +368,7 @@ typedef enum
>      ASL_MSG_TEMPORARY_OBJECT,
>      ASL_MSG_UNDEFINED_EXTERNAL,
>      ASL_MSG_BUFFER_FIELD_OVERFLOW,
> +    ASL_MSG_INVALID_SPECIAL_NAME,
>  
>      /* These messages are used by the Data Table compiler only */
>  
> diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c
> index a54c498c..a8f22bd8 100644
> --- a/src/acpica/source/compiler/aslstubs.c
> +++ b/src/acpica/source/compiler/aslstubs.c
> @@ -166,12 +166,6 @@
>   * Things like Events, Global Lock, etc. are not used
>   * by the compiler, so they are stubbed out here.
>   */
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -}
> -
>  ACPI_STATUS
>  AcpiNsInitializeObjects (
>      void)
> diff --git a/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l
> index 69c1399a..297bf2ee 100644
> --- a/src/acpica/source/compiler/aslsupport.l
> +++ b/src/acpica/source/compiler/aslsupport.l
> @@ -220,7 +220,7 @@ AslDoLineDirective (
>  
>      while ((c = input()) != '\n' && c != EOF)
>      {
> -        *AslGbl_LineBufPtr = c;
> +        *AslGbl_LineBufPtr = (char) c;
>          AslGbl_LineBufPtr++;
>      }
>      *AslGbl_LineBufPtr = 0;
> @@ -498,7 +498,7 @@ AslInsertLineBuffer (
>  
>          if (AcpiGbl_CaptureComments)
>          {
> -            CvProcessCommentState (SourceChar);
> +            CvProcessCommentState ((char) SourceChar);
>          }
>      }
>  }
> @@ -601,7 +601,7 @@ loop:
>          AslInsertLineBuffer (c);
>          if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>          {
> -            *StringBuffer = c;
> +            *StringBuffer = (char) c;
>              ++StringBuffer;
>          }
>          c1 = c;
> @@ -629,7 +629,7 @@ loop:
>      AslInsertLineBuffer (c);
>      if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>      {
> -        *StringBuffer = c;
> +        *StringBuffer = (char) c;
>          ++StringBuffer;
>      }
>  
> @@ -720,7 +720,7 @@ AslDoCommentType2 (
>          AslInsertLineBuffer (c);
>          if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>          {
> -            *StringBuffer = c;
> +            *StringBuffer = (char) c;
>              ++StringBuffer;
>          }
>      }
> @@ -878,7 +878,7 @@ DoCharacter:
>                  if (ACPI_IS_OCTAL_DIGIT (StringChar))
>                  {
>                      State = ASL_OCTAL_CONSTANT;
> -                    ConvertBuffer[0] = StringChar;
> +                    ConvertBuffer[0] = (char) StringChar;
>                      i = 1;
>                      continue;
>                  }
> @@ -934,7 +934,7 @@ DoCharacter:
>  
>              /* Append another digit of the constant */
>  
> -            ConvertBuffer[i] = StringChar;
> +            ConvertBuffer[i] = (char) StringChar;
>              i++;
>              continue;
>  
> @@ -978,7 +978,7 @@ DoCharacter:
>  
>              /* Append another digit of the constant */
>  
> -            ConvertBuffer[i] = StringChar;
> +            ConvertBuffer[i] = (char) StringChar;
>              i++;
>              continue;
>  
> @@ -989,7 +989,7 @@ DoCharacter:
>  
>          /* Save the finished character */
>  
> -        *StringBuffer = StringChar;
> +        *StringBuffer = (char) StringChar;
>          StringBuffer++;
>          if (StringBuffer >= EndBuffer)
>          {
> diff --git a/src/acpica/source/components/debugger/dbobject.c b/src/acpica/source/components/debugger/dbobject.c
> index f9dc6687..cebf4420 100644
> --- a/src/acpica/source/components/debugger/dbobject.c
> +++ b/src/acpica/source/components/debugger/dbobject.c
> @@ -567,7 +567,6 @@ AcpiDbDecodeLocals (
>  
>  
>      Node = WalkState->MethodNode;
> -    ObjDesc = WalkState->MethodDesc;
>  
>      /* There are no locals for the module-level code case */
>  
> diff --git a/src/acpica/source/components/dispatcher/dsinit.c b/src/acpica/source/components/dispatcher/dsinit.c
> index e7045f46..9810f9ff 100644
> --- a/src/acpica/source/components/dispatcher/dsinit.c
> +++ b/src/acpica/source/components/dispatcher/dsinit.c
> @@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
>      if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
>      {
>          ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -            "\nInitializing Namespace objects:\n"));
> +            "\nACPI table initialization:\n"));
>      }
>  
>      /* Summary of objects initialized */
> diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
> index f5ea992a..a7ee84c9 100644
> --- a/src/acpica/source/components/events/evgpe.c
> +++ b/src/acpica/source/components/events/evgpe.c
> @@ -316,6 +316,7 @@ AcpiEvMaskGpe (
>   * FUNCTION:    AcpiEvAddGpeReference
>   *
>   * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
> + *              ClearOnEnable           - Clear GPE status before enabling it
>   *
>   * RETURN:      Status
>   *
> @@ -326,7 +327,8 @@ AcpiEvMaskGpe (
>  
>  ACPI_STATUS
>  AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> +    BOOLEAN                 ClearOnEnable)
>  {
>      ACPI_STATUS             Status = AE_OK;
>  
> @@ -344,6 +346,11 @@ AcpiEvAddGpeReference (
>      {
>          /* Enable on first reference */
>  
> +        if (ClearOnEnable)
> +        {
> +            (void) AcpiHwClearGpe (GpeEventInfo);
> +        }
> +
>          Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
>          if (ACPI_SUCCESS (Status))
>          {
> diff --git a/src/acpica/source/components/events/evgpeblk.c b/src/acpica/source/components/events/evgpeblk.c
> index 7e1dd196..80157dcd 100644
> --- a/src/acpica/source/components/events/evgpeblk.c
> +++ b/src/acpica/source/components/events/evgpeblk.c
> @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
>                  continue;
>              }
>  
> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
> +            Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>              if (ACPI_FAILURE (Status))
>              {
>                  ACPI_EXCEPTION ((AE_INFO, Status,
> diff --git a/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c
> index 8577a6d0..8e8eacf7 100644
> --- a/src/acpica/source/components/events/evxface.c
> +++ b/src/acpica/source/components/events/evxface.c
> @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
>              ACPI_GPE_DISPATCH_NOTIFY)) &&
>          Handler->OriginallyEnabled)
>      {
> -        (void) AcpiEvAddGpeReference (GpeEventInfo);
> +        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>          if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>          {
>              /* Poll edge triggered GPEs to handle existing events */
> diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
> index 52061db1..1dc0fe1d 100644
> --- a/src/acpica/source/components/events/evxfgpe.c
> +++ b/src/acpica/source/components/events/evxfgpe.c
> @@ -267,7 +267,7 @@ AcpiEnableGpe (
>          if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
>              ACPI_GPE_DISPATCH_NONE)
>          {
> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
> +            Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE);
>              if (ACPI_SUCCESS (Status) &&
>                  ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>              {
> diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
> index 84a058ad..eba1a6d2 100644
> --- a/src/acpica/source/components/executer/exconfig.c
> +++ b/src/acpica/source/components/executer/exconfig.c
> @@ -342,10 +342,9 @@ AcpiExLoadTableOp (
>          return_ACPI_STATUS (Status);
>      }
>  
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>  
> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiNsInitializeObjects ();
>  
>      /* Parameter Data (optional) */
>  
> @@ -620,10 +619,11 @@ AcpiExLoadOp (
>          return_ACPI_STATUS (Status);
>      }
>  
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>  
> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiExExitInterpreter ();
> +    AcpiNsInitializeObjects ();
> +    AcpiExEnterInterpreter ();
>  
>      /* Store the DdbHandle into the Target operand */
>  
> diff --git a/src/acpica/source/components/namespace/nsaccess.c b/src/acpica/source/components/namespace/nsaccess.c
> index 94dba130..4be555c0 100644
> --- a/src/acpica/source/components/namespace/nsaccess.c
> +++ b/src/acpica/source/components/namespace/nsaccess.c
> @@ -184,6 +184,7 @@ AcpiNsRootInitialize (
>      ACPI_STATUS                 Status;
>      const ACPI_PREDEFINED_NAMES *InitVal = NULL;
>      ACPI_NAMESPACE_NODE         *NewNode;
> +    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
>      ACPI_OPERAND_OBJECT         *ObjDesc;
>      ACPI_STRING                 Val = NULL;
>  
> @@ -213,13 +214,30 @@ AcpiNsRootInitialize (
>       */
>      AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
>  
> -    /* Enter the pre-defined names in the name table */
> +    /* Enter the predefined names in the name table */
>  
>      ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>          "Entering predefined entries into namespace\n"));
>  
> +    /*
> +     * Create the initial (default) namespace.
> +     * This namespace looks like something similar to this:
> +     *
> +     *   ACPI Namespace (from Namespace Root):
> +     *    0  _GPE Scope        00203160 00
> +     *    0  _PR_ Scope        002031D0 00
> +     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
> +     *    0  _SI_ Scope        002032B0 00
> +     *    0  _TZ_ Device       00203320 00
> +     *    0  _REV Integer      00203390 00 = 0000000000000002
> +     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
> +     *    0  _GL_ Mutex        00203580 00 Object 002035F0
> +     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
> +     */
>      for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
>      {
> +        Status = AE_OK;
> +
>          /* _OSI is optional for now, will be permanent later */
>  
>          if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
> @@ -227,17 +245,35 @@ AcpiNsRootInitialize (
>              continue;
>          }
>  
> -        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
> -            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
> -            NULL, &NewNode);
> -        if (ACPI_FAILURE (Status))
> +        /*
> +         * Create, init, and link the new predefined name
> +         * Note: No need to use AcpiNsLookup here because all the
> +         * predefined names are at the root level. It is much easier to
> +         * just create and link the new node(s) here.
> +         */
> +        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
> +        if (!NewNode)
>          {
> -            ACPI_EXCEPTION ((AE_INFO, Status,
> -                "Could not create predefined name %s",
> -                InitVal->Name));
> -            continue;
> +            Status = AE_NO_MEMORY;
> +            goto UnlockAndExit;
>          }
>  
> +        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
> +        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
> +        NewNode->Type = InitVal->Type;
> +
> +        if (!PrevNode)
> +        {
> +            AcpiGbl_RootNodeStruct.Child = NewNode;
> +        }
> +        else
> +        {
> +            PrevNode->Peer = NewNode;
> +        }
> +
> +        NewNode->Parent = &AcpiGbl_RootNodeStruct;
> +        PrevNode = NewNode;
> +
>          /*
>           * Name entered successfully. If entry in PreDefinedNames[] specifies
>           * an initial value, create the initial value.
> @@ -286,7 +322,7 @@ AcpiNsRootInitialize (
>  
>                  NewNode->Value = ObjDesc->Method.ParamCount;
>  #else
> -                /* Mark this as a very SPECIAL method */
> +                /* Mark this as a very SPECIAL method (_OSI) */
>  
>                  ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
>                  ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
> @@ -359,7 +395,6 @@ AcpiNsRootInitialize (
>          }
>      }
>  
> -
>  UnlockAndExit:
>      (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
>  
> diff --git a/src/acpica/source/components/namespace/nseval.c b/src/acpica/source/components/namespace/nseval.c
> index 2ecba639..af6a6d45 100644
> --- a/src/acpica/source/components/namespace/nseval.c
> +++ b/src/acpica/source/components/namespace/nseval.c
> @@ -160,13 +160,6 @@
>  #define _COMPONENT          ACPI_NAMESPACE
>          ACPI_MODULE_NAME    ("nseval")
>  
> -/* Local prototypes */
> -
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info);
> -
>  
>  /*******************************************************************************
>   *
> @@ -465,206 +458,3 @@ Cleanup:
>      Info->FullPathname = NULL;
>      return_ACPI_STATUS (Status);
>  }
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    AcpiNsExecModuleCodeList
> - *
> - * PARAMETERS:  None
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute all elements of the global module-level code list.
> - *              Each element is executed as a single control method.
> - *
> - * NOTE: With this option enabled, each block of detected executable AML
> - * code that is outside of any control method is wrapped with a temporary
> - * control method object and placed on a global list. The methods on this
> - * list are executed below.
> - *
> - * This function executes the module-level code for all tables only after
> - * all of the tables have been loaded. It is a legacy option and is
> - * not compatible with other ACPI implementations. See AcpiNsLoadTable.
> - *
> - * This function will be removed when the legacy option is removed.
> - *
> - ******************************************************************************/
> -
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
> -    ACPI_EVALUATE_INFO      *Info;
> -    UINT32                  MethodCount = 0;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
> -
> -
> -    /* Exit now if the list is empty */
> -
> -    Next = AcpiGbl_ModuleCodeList;
> -    if (!Next)
> -    {
> -        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -            "Legacy MLC block list is empty\n"));
> -
> -        return_VOID;
> -    }
> -
> -    /* Allocate the evaluation information block */
> -
> -    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
> -    if (!Info)
> -    {
> -        return_VOID;
> -    }
> -
> -    /* Walk the list, executing each "method" */
> -
> -    while (Next)
> -    {
> -        Prev = Next;
> -        Next = Next->Method.Mutex;
> -
> -        /* Clear the link field and execute the method */
> -
> -        Prev->Method.Mutex = NULL;
> -        AcpiNsExecModuleCode (Prev, Info);
> -        MethodCount++;
> -
> -        /* Delete the (temporary) method object */
> -
> -        AcpiUtRemoveReference (Prev);
> -    }
> -
> -    ACPI_INFO ((
> -        "Executed %u blocks of module-level executable AML code",
> -        MethodCount));
> -
> -    ACPI_FREE (Info);
> -    AcpiGbl_ModuleCodeList = NULL;
> -    return_VOID;
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    AcpiNsExecModuleCode
> - *
> - * PARAMETERS:  MethodObj           - Object container for the module-level code
> - *              Info                - Info block for method evaluation
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute a control method containing a block of module-level
> - *              executable AML code. The control method is temporarily
> - *              installed to the root node, then evaluated.
> - *
> - ******************************************************************************/
> -
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info)
> -{
> -    ACPI_OPERAND_OBJECT     *ParentObj;
> -    ACPI_NAMESPACE_NODE     *ParentNode;
> -    ACPI_OBJECT_TYPE        Type;
> -    ACPI_STATUS             Status;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCode);
> -
> -
> -    /*
> -     * Get the parent node. We cheat by using the NextObject field
> -     * of the method object descriptor.
> -     */
> -    ParentNode = ACPI_CAST_PTR (
> -        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
> -    Type = AcpiNsGetType (ParentNode);
> -
> -    /*
> -     * Get the region handler and save it in the method object. We may need
> -     * this if an operation region declaration causes a _REG method to be run.
> -     *
> -     * We can't do this in AcpiPsLinkModuleCode because
> -     * AcpiGbl_RootNode->Object is NULL at PASS1.
> -     */
> -    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
> -    {
> -        MethodObj->Method.Dispatch.Handler =
> -            ParentNode->Object->Device.Handler;
> -    }
> -
> -    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
> -
> -    MethodObj->Method.NextObject = NULL;
> -
> -    /* Initialize the evaluation information block */
> -
> -    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
> -    Info->PrefixNode = ParentNode;
> -
> -    /*
> -     * Get the currently attached parent object. Add a reference,
> -     * because the ref count will be decreased when the method object
> -     * is installed to the parent node.
> -     */
> -    ParentObj = AcpiNsGetAttachedObject (ParentNode);
> -    if (ParentObj)
> -    {
> -        AcpiUtAddReference (ParentObj);
> -    }
> -
> -    /* Install the method (module-level code) in the parent node */
> -
> -    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
> -    if (ACPI_FAILURE (Status))
> -    {
> -        goto Exit;
> -    }
> -
> -    /* Execute the parent node as a control method */
> -
> -    Status = AcpiNsEvaluate (Info);
> -
> -    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -        "Executed module-level code at %p\n",
> -        MethodObj->Method.AmlStart));
> -
> -    /* Delete a possible implicit return value (in slack mode) */
> -
> -    if (Info->ReturnObject)
> -    {
> -        AcpiUtRemoveReference (Info->ReturnObject);
> -    }
> -
> -    /* Detach the temporary method object */
> -
> -    AcpiNsDetachObject (ParentNode);
> -
> -    /* Restore the original parent object */
> -
> -    if (ParentObj)
> -    {
> -        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
> -    }
> -    else
> -    {
> -        ParentNode->Type = (UINT8) Type;
> -    }
> -
> -Exit:
> -    if (ParentObj)
> -    {
> -        AcpiUtRemoveReference (ParentObj);
> -    }
> -    return_VOID;
> -}
> diff --git a/src/acpica/source/components/namespace/nsinit.c b/src/acpica/source/components/namespace/nsinit.c
> index 4dd28fd4..51f98339 100644
> --- a/src/acpica/source/components/namespace/nsinit.c
> +++ b/src/acpica/source/components/namespace/nsinit.c
> @@ -212,29 +212,30 @@ AcpiNsInitializeObjects (
>      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>          "**** Starting initialization of namespace objects ****\n"));
>      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "Completing Region/Field/Buffer/Package initialization:\n"));
> +        "Final data object initialization: "));
>  
> -    /* Set all init info to zero */
> +    /* Clear the info block */
>  
>      memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
>  
>      /* Walk entire namespace from the supplied root */
>  
> +    /*
> +     * TBD: will become ACPI_TYPE_PACKAGE as this type object
> +     * is now the only one that supports deferred initialization
> +     * (forward references).
> +     */
>      Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
> -        &Info, NULL);
> +        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
>      if (ACPI_FAILURE (Status))
>      {
>          ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
>      }
>  
>      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
> -        "Buffers %u/%u Packages (%u nodes)\n",
> -        Info.OpRegionInit,  Info.OpRegionCount,
> -        Info.FieldInit,     Info.FieldCount,
> -        Info.BufferInit,    Info.BufferCount,
> -        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
> +        "Namespace contains %u (0x%X) objects\n",
> +        Info.ObjectCount,
> +        Info.ObjectCount));
>  
>      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>          "%u Control Methods found\n%u Op Regions found\n",
> @@ -561,35 +562,19 @@ AcpiNsInitOneObject (
>      AcpiExEnterInterpreter ();
>  
>      /*
> -     * Each of these types can contain executable AML code within the
> -     * declaration.
> +     * Only initialization of Package objects can be deferred, in order
> +     * to support forward references.
>       */
>      switch (Type)
>      {
> -    case ACPI_TYPE_REGION:
> -
> -        Info->OpRegionInit++;
> -        Status = AcpiDsGetRegionArguments (ObjDesc);
> -        break;
> -
> -    case ACPI_TYPE_BUFFER_FIELD:
> -
> -        Info->FieldInit++;
> -        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
> -        break;
> -
>      case ACPI_TYPE_LOCAL_BANK_FIELD:
>  
> +        /* TBD: BankFields do not require deferred init, remove this code */
> +
>          Info->FieldInit++;
>          Status = AcpiDsGetBankFieldArguments (ObjDesc);
>          break;
>  
> -    case ACPI_TYPE_BUFFER:
> -
> -        Info->BufferInit++;
> -        Status = AcpiDsGetBufferArguments (ObjDesc);
> -        break;
> -
>      case ACPI_TYPE_PACKAGE:
>  
>          /* Complete the initialization/resolution of the package object */
> @@ -600,8 +585,12 @@ AcpiNsInitOneObject (
>  
>      default:
>  
> -        /* No other types can get here */
> +        /* No other types should get here */
>  
> +        Status = AE_TYPE;
> +        ACPI_EXCEPTION ((AE_INFO, Status,
> +            "Opcode is not deferred [%4.4s] (%s)",
> +            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
>          break;
>      }
>  
> diff --git a/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c
> index f5a82347..f7aaa11d 100644
> --- a/src/acpica/source/components/namespace/nsload.c
> +++ b/src/acpica/source/components/namespace/nsload.c
> @@ -268,18 +268,6 @@ Unlock:
>      ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>          "**** Completed Table Object Initialization\n"));
>  
> -    /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> -     */
> -    AcpiNsExecModuleCodeList ();
>      return_ACPI_STATUS (Status);
>  }
>  
> diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c
> index 85732ff8..581ad5f3 100644
> --- a/src/acpica/source/components/namespace/nsutils.c
> +++ b/src/acpica/source/components/namespace/nsutils.c
> @@ -802,24 +802,11 @@ AcpiNsTerminate (
>      void)
>  {
>      ACPI_STATUS             Status;
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
>  
>  
>      ACPI_FUNCTION_TRACE (NsTerminate);
>  
>  
> -    /* Delete any module-level code blocks */
> -
> -    Next = AcpiGbl_ModuleCodeList;
> -    while (Next)
> -    {
> -        Prev = Next;
> -        Next = Next->Method.Mutex;
> -        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
> -        AcpiUtRemoveReference (Prev);
> -    }
> -
>      /*
>       * Free the entire namespace -- all nodes and all objects
>       * attached to the nodes
> diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
> index 9d86fdbc..ba0c9108 100644
> --- a/src/acpica/source/components/tables/tbdata.c
> +++ b/src/acpica/source/components/tables/tbdata.c
> @@ -1190,19 +1190,6 @@ AcpiTbLoadTable (
>  
>      Status = AcpiNsLoadTable (TableIndex, ParentNode);
>  
> -    /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> -     */
> -    AcpiNsExecModuleCodeList ();
> -
>      /*
>       * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
>       * responsible for discovering any new wake GPEs by running _PRW methods
> diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
> index 217d54bf..1e17db6c 100644
> --- a/src/acpica/source/components/tables/tbxfload.c
> +++ b/src/acpica/source/components/tables/tbxfload.c
> @@ -479,6 +479,13 @@ AcpiLoadTable (
>      ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
>      Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
>          ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
> +    if (ACPI_SUCCESS (Status))
> +    {
> +        /* Complete the initialization/resolution of new objects */
> +
> +        AcpiNsInitializeObjects ();
> +    }
> +
>      return_ACPI_STATUS (Status);
>  }
>  
> diff --git a/src/acpica/source/components/utilities/utinit.c b/src/acpica/source/components/utilities/utinit.c
> index d83d7dab..3e7ed41f 100644
> --- a/src/acpica/source/components/utilities/utinit.c
> +++ b/src/acpica/source/components/utilities/utinit.c
> @@ -342,7 +342,6 @@ AcpiUtInitGlobals (
>  
>      /* Namespace */
>  
> -    AcpiGbl_ModuleCodeList              = NULL;
>      AcpiGbl_RootNode                    = NULL;
>      AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
>      AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
> diff --git a/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c
> index f0c46c02..d0b49bba 100644
> --- a/src/acpica/source/components/utilities/utxfinit.c
> +++ b/src/acpica/source/components/utilities/utxfinit.c
> @@ -381,24 +381,17 @@ AcpiInitializeObjects (
>      ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
>  
>  
> +#ifdef ACPI_OBSOLETE_BEHAVIOR
>      /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> +     * 05/2019: Removed, initialization now happens at both object
> +     * creation and table load time
>       */
> -    AcpiNsExecModuleCodeList ();
>  
>      /*
>       * Initialize the objects that remain uninitialized. This
>       * runs the executable AML that may be part of the
> -     * declaration of these objects:
> -     * OperationRegions, BufferFields, Buffers, and Packages.
> +     * declaration of these objects: OperationRegions, BufferFields,
> +     * BankFields, Buffers, and Packages.
>       */
>      if (!(Flags & ACPI_NO_OBJECT_INIT))
>      {
> @@ -408,6 +401,7 @@ AcpiInitializeObjects (
>              return_ACPI_STATUS (Status);
>          }
>      }
> +#endif
>  
>      /*
>       * Initialize all device/region objects in the namespace. This runs
> diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
> index f1092342..c2eb7324 100644
> --- a/src/acpica/source/include/acevents.h
> +++ b/src/acpica/source/include/acevents.h
> @@ -245,7 +245,8 @@ AcpiEvMaskGpe (
>  
>  ACPI_STATUS
>  AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> +    BOOLEAN                 ClearOnEnable);
>  
>  ACPI_STATUS
>  AcpiEvRemoveGpeReference (
> diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
> index 78bc7ca0..e9e3206a 100644
> --- a/src/acpica/source/include/acglobal.h
> +++ b/src/acpica/source/include/acglobal.h
> @@ -323,7 +323,6 @@ ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_VerboseLeakDump);
>  ACPI_GLOBAL (ACPI_NAMESPACE_NODE,       AcpiGbl_RootNodeStruct);
>  ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_RootNode);
>  ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_FadtGpeDevice);
> -ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_ModuleCodeList);
>  
>  extern const UINT8                      AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
>  extern const ACPI_PREDEFINED_NAMES      AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
> diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
> index eaa2f1b4..6d148fea 100644
> --- a/src/acpica/source/include/acnamesp.h
> +++ b/src/acpica/source/include/acnamesp.h
> @@ -419,10 +419,6 @@ ACPI_STATUS
>  AcpiNsEvaluate (
>      ACPI_EVALUATE_INFO      *Info);
>  
> -void
> -AcpiNsExecModuleCodeList (
> -    void);
> -
>  
>  /*
>   * nsarguments - Argument count/type checking for predefined/reserved names
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 8778da72..2893bf23 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -154,7 +154,7 @@
>  
>  /* Current ACPICA subsystem version in YYYYMMDD format */
>  
> -#define ACPI_CA_VERSION                 0x20190509
> +#define ACPI_CA_VERSION                 0x20190703
>  
>  #include "acconfig.h"
>  #include "actypes.h"
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu July 24, 2019, 6:16 a.m. UTC | #2
On 7/4/19 9:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Changes in this release of ACPICA are detailed below:
> 
>    * Remove legacy module-level support code.
>    * Clear status of GPEs on first direct enable.
>    * Tool generation process has been migrated to MSVC 2017.
>    * iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only
>      at the root scope.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpica/source/compiler/asldefine.h        |  16 ++
>   src/acpica/source/compiler/aslglobal.h        |  15 ++
>   src/acpica/source/compiler/aslload.c          |  59 ++++-
>   src/acpica/source/compiler/aslmessages.c      |   3 +-
>   src/acpica/source/compiler/aslmessages.h      |   1 +
>   src/acpica/source/compiler/aslstubs.c         |   6 -
>   src/acpica/source/compiler/aslsupport.l       |  18 +-
>   .../source/components/debugger/dbobject.c     |   1 -
>   .../source/components/dispatcher/dsinit.c     |   2 +-
>   src/acpica/source/components/events/evgpe.c   |   9 +-
>   .../source/components/events/evgpeblk.c       |   2 +-
>   src/acpica/source/components/events/evxface.c |   2 +-
>   src/acpica/source/components/events/evxfgpe.c |   2 +-
>   .../source/components/executer/exconfig.c     |  12 +-
>   .../source/components/namespace/nsaccess.c    |  57 ++++-
>   .../source/components/namespace/nseval.c      | 210 ------------------
>   .../source/components/namespace/nsinit.c      |  51 ++---
>   .../source/components/namespace/nsload.c      |  12 -
>   .../source/components/namespace/nsutils.c     |  13 --
>   src/acpica/source/components/tables/tbdata.c  |  13 --
>   .../source/components/tables/tbxfload.c       |   7 +
>   .../source/components/utilities/utinit.c      |   1 -
>   .../source/components/utilities/utxfinit.c    |  18 +-
>   src/acpica/source/include/acevents.h          |   3 +-
>   src/acpica/source/include/acglobal.h          |   1 -
>   src/acpica/source/include/acnamesp.h          |   4 -
>   src/acpica/source/include/acpixf.h            |   2 +-
>   27 files changed, 198 insertions(+), 342 deletions(-)
> 
> diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h
> index cffb0af1..c5111875 100644
> --- a/src/acpica/source/compiler/asldefine.h
> +++ b/src/acpica/source/compiler/asldefine.h
> @@ -298,4 +298,20 @@
>   #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
>   #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
>   
> +/*
> + * Special name segments - these must only be declared at the root scope
> + */
> +#define NAMESEG__PTS    "_PTS"
> +#define NAMESEG__WAK    "_WAK"
> +#define NAMESEG__S0     "_S0_"
> +#define NAMESEG__S1     "_S1_"
> +#define NAMESEG__S2     "_S2_"
> +#define NAMESEG__S3     "_S3_"
> +#define NAMESEG__S4     "_S4_"
> +#define NAMESEG__S5     "_S5_"
> +#define NAMESEG__TTS    "_TTS"
> +
> +#define MAX_SPECIAL_NAMES      9
> +
> +
>   #endif /* ASLDEFINE.H */
> diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
> index 213c5408..740f7f34 100644
> --- a/src/acpica/source/compiler/aslglobal.h
> +++ b/src/acpica/source/compiler/aslglobal.h
> @@ -223,13 +223,28 @@ const char                          *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] =
>       "OP_NOT_FOUND_DURING_LOAD"
>   };
>   
> +const char                          *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] =
> +{
> +    NAMESEG__PTS,
> +    NAMESEG__WAK,
> +    NAMESEG__S0,
> +    NAMESEG__S1,
> +    NAMESEG__S2,
> +    NAMESEG__S3,
> +    NAMESEG__S4,
> +    NAMESEG__S5,
> +    NAMESEG__TTS
> +};
> +
>   #else
>   extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
>   extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
>   extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
> +extern const char                   *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
>   #endif
>   
>   
> +
>   /*
>    * Parser and other externals
>    */
> diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
> index d1523ab6..4dd2dfd0 100644
> --- a/src/acpica/source/compiler/aslload.c
> +++ b/src/acpica/source/compiler/aslload.c
> @@ -164,6 +164,7 @@
>   
>   static ACPI_STATUS
>   LdLoadFieldElements (
> +    UINT32                  AmlType,
>       ACPI_PARSE_OBJECT       *Op,
>       ACPI_WALK_STATE         *WalkState);
>   
> @@ -190,6 +191,10 @@ LdCommonNamespaceEnd (
>       UINT32                  Level,
>       void                    *Context);
>   
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op);
>   
>   /*******************************************************************************
>    *
> @@ -247,7 +252,8 @@ LdLoadNamespace (
>    *
>    * FUNCTION:    LdLoadFieldElements
>    *
> - * PARAMETERS:  Op              - Parent node (Field)
> + * PARAMETERS:  AmlType         - Type to search
> + *              Op              - Parent node (Field)
>    *              WalkState       - Current walk state
>    *
>    * RETURN:      Status
> @@ -259,6 +265,7 @@ LdLoadNamespace (
>   
>   static ACPI_STATUS
>   LdLoadFieldElements (
> +    UINT32                  AmlType,
>       ACPI_PARSE_OBJECT       *Op,
>       ACPI_WALK_STATE         *WalkState)
>   {
> @@ -274,7 +281,7 @@ LdLoadFieldElements (
>       {
>           Status = AcpiNsLookup (WalkState->ScopeInfo,
>               SourceRegion->Asl.Value.String,
> -            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
> +            AmlType, ACPI_IMODE_EXECUTE,
>               ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
>           if (Status == AE_NOT_FOUND)
>           {
> @@ -507,11 +514,15 @@ LdNamespace1Begin (
>        */
>       switch (Op->Asl.AmlOpcode)
>       {
> -    case AML_BANK_FIELD_OP:
>       case AML_INDEX_FIELD_OP:
> +
> +        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
> +        return (Status);
> +
> +    case AML_BANK_FIELD_OP:
>       case AML_FIELD_OP:
>   
> -        Status = LdLoadFieldElements (Op, WalkState);
> +        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
>           return (Status);
>   
>       case AML_INT_CONNECTION_OP:
> @@ -966,6 +977,10 @@ LdNamespace1Begin (
>           }
>       }
>   
> +    /* Check special names like _WAK and _PTS */
> +
> +    LdCheckSpecialNames (Node, Op);
> +
>       if (ForceNewScope)
>       {
>           Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
> @@ -1004,6 +1019,42 @@ FinishNode:
>   }
>   
>   
> +/*******************************************************************************
> + *
> + * FUNCTION:    LdCheckSpecialNames
> + *
> + * PARAMETERS:  Node        - Node that represents the named object
> + *              Op          - Named object declaring this named object
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Check if certain named objects are declared in the incorrect
> + *              scope. Special named objects are listed in
> + *              AslGbl_SpecialNamedObjects and can only be declared at the root
> + *              scope.
> + *
> + ******************************************************************************/
> +
> +static void
> +LdCheckSpecialNames (
> +    ACPI_NAMESPACE_NODE     *Node,
> +    ACPI_PARSE_OBJECT       *Op)
> +{
> +    UINT32                  i;
> +
> +
> +    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
> +    {
> +        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
> +            Node->Parent != AcpiGbl_RootNode)
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
> +            return;
> +        }
> +    }
> +}
> +
> +
>   /*******************************************************************************
>    *
>    * FUNCTION:    LdNamespace2Begin
> diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
> index cf7a7a4f..48c4dbab 100644
> --- a/src/acpica/source/compiler/aslmessages.c
> +++ b/src/acpica/source/compiler/aslmessages.c
> @@ -365,7 +365,8 @@ const char                      *AslCompilerMsgs [] =
>   /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
>   /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
>   /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
> -/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends beyond end of target buffer"
> +/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
> +/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal"
>   };
>   
>   /* Table compiler */
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 15613685..d998f0fe 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -368,6 +368,7 @@ typedef enum
>       ASL_MSG_TEMPORARY_OBJECT,
>       ASL_MSG_UNDEFINED_EXTERNAL,
>       ASL_MSG_BUFFER_FIELD_OVERFLOW,
> +    ASL_MSG_INVALID_SPECIAL_NAME,
>   
>       /* These messages are used by the Data Table compiler only */
>   
> diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c
> index a54c498c..a8f22bd8 100644
> --- a/src/acpica/source/compiler/aslstubs.c
> +++ b/src/acpica/source/compiler/aslstubs.c
> @@ -166,12 +166,6 @@
>    * Things like Events, Global Lock, etc. are not used
>    * by the compiler, so they are stubbed out here.
>    */
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -}
> -
>   ACPI_STATUS
>   AcpiNsInitializeObjects (
>       void)
> diff --git a/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l
> index 69c1399a..297bf2ee 100644
> --- a/src/acpica/source/compiler/aslsupport.l
> +++ b/src/acpica/source/compiler/aslsupport.l
> @@ -220,7 +220,7 @@ AslDoLineDirective (
>   
>       while ((c = input()) != '\n' && c != EOF)
>       {
> -        *AslGbl_LineBufPtr = c;
> +        *AslGbl_LineBufPtr = (char) c;
>           AslGbl_LineBufPtr++;
>       }
>       *AslGbl_LineBufPtr = 0;
> @@ -498,7 +498,7 @@ AslInsertLineBuffer (
>   
>           if (AcpiGbl_CaptureComments)
>           {
> -            CvProcessCommentState (SourceChar);
> +            CvProcessCommentState ((char) SourceChar);
>           }
>       }
>   }
> @@ -601,7 +601,7 @@ loop:
>           AslInsertLineBuffer (c);
>           if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>           {
> -            *StringBuffer = c;
> +            *StringBuffer = (char) c;
>               ++StringBuffer;
>           }
>           c1 = c;
> @@ -629,7 +629,7 @@ loop:
>       AslInsertLineBuffer (c);
>       if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>       {
> -        *StringBuffer = c;
> +        *StringBuffer = (char) c;
>           ++StringBuffer;
>       }
>   
> @@ -720,7 +720,7 @@ AslDoCommentType2 (
>           AslInsertLineBuffer (c);
>           if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
>           {
> -            *StringBuffer = c;
> +            *StringBuffer = (char) c;
>               ++StringBuffer;
>           }
>       }
> @@ -878,7 +878,7 @@ DoCharacter:
>                   if (ACPI_IS_OCTAL_DIGIT (StringChar))
>                   {
>                       State = ASL_OCTAL_CONSTANT;
> -                    ConvertBuffer[0] = StringChar;
> +                    ConvertBuffer[0] = (char) StringChar;
>                       i = 1;
>                       continue;
>                   }
> @@ -934,7 +934,7 @@ DoCharacter:
>   
>               /* Append another digit of the constant */
>   
> -            ConvertBuffer[i] = StringChar;
> +            ConvertBuffer[i] = (char) StringChar;
>               i++;
>               continue;
>   
> @@ -978,7 +978,7 @@ DoCharacter:
>   
>               /* Append another digit of the constant */
>   
> -            ConvertBuffer[i] = StringChar;
> +            ConvertBuffer[i] = (char) StringChar;
>               i++;
>               continue;
>   
> @@ -989,7 +989,7 @@ DoCharacter:
>   
>           /* Save the finished character */
>   
> -        *StringBuffer = StringChar;
> +        *StringBuffer = (char) StringChar;
>           StringBuffer++;
>           if (StringBuffer >= EndBuffer)
>           {
> diff --git a/src/acpica/source/components/debugger/dbobject.c b/src/acpica/source/components/debugger/dbobject.c
> index f9dc6687..cebf4420 100644
> --- a/src/acpica/source/components/debugger/dbobject.c
> +++ b/src/acpica/source/components/debugger/dbobject.c
> @@ -567,7 +567,6 @@ AcpiDbDecodeLocals (
>   
>   
>       Node = WalkState->MethodNode;
> -    ObjDesc = WalkState->MethodDesc;
>   
>       /* There are no locals for the module-level code case */
>   
> diff --git a/src/acpica/source/components/dispatcher/dsinit.c b/src/acpica/source/components/dispatcher/dsinit.c
> index e7045f46..9810f9ff 100644
> --- a/src/acpica/source/components/dispatcher/dsinit.c
> +++ b/src/acpica/source/components/dispatcher/dsinit.c
> @@ -362,7 +362,7 @@ AcpiDsInitializeObjects (
>       if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
>       {
>           ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -            "\nInitializing Namespace objects:\n"));
> +            "\nACPI table initialization:\n"));
>       }
>   
>       /* Summary of objects initialized */
> diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
> index f5ea992a..a7ee84c9 100644
> --- a/src/acpica/source/components/events/evgpe.c
> +++ b/src/acpica/source/components/events/evgpe.c
> @@ -316,6 +316,7 @@ AcpiEvMaskGpe (
>    * FUNCTION:    AcpiEvAddGpeReference
>    *
>    * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
> + *              ClearOnEnable           - Clear GPE status before enabling it
>    *
>    * RETURN:      Status
>    *
> @@ -326,7 +327,8 @@ AcpiEvMaskGpe (
>   
>   ACPI_STATUS
>   AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> +    BOOLEAN                 ClearOnEnable)
>   {
>       ACPI_STATUS             Status = AE_OK;
>   
> @@ -344,6 +346,11 @@ AcpiEvAddGpeReference (
>       {
>           /* Enable on first reference */
>   
> +        if (ClearOnEnable)
> +        {
> +            (void) AcpiHwClearGpe (GpeEventInfo);
> +        }
> +
>           Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
>           if (ACPI_SUCCESS (Status))
>           {
> diff --git a/src/acpica/source/components/events/evgpeblk.c b/src/acpica/source/components/events/evgpeblk.c
> index 7e1dd196..80157dcd 100644
> --- a/src/acpica/source/components/events/evgpeblk.c
> +++ b/src/acpica/source/components/events/evgpeblk.c
> @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock (
>                   continue;
>               }
>   
> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
> +            Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>               if (ACPI_FAILURE (Status))
>               {
>                   ACPI_EXCEPTION ((AE_INFO, Status,
> diff --git a/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c
> index 8577a6d0..8e8eacf7 100644
> --- a/src/acpica/source/components/events/evxface.c
> +++ b/src/acpica/source/components/events/evxface.c
> @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler (
>               ACPI_GPE_DISPATCH_NOTIFY)) &&
>           Handler->OriginallyEnabled)
>       {
> -        (void) AcpiEvAddGpeReference (GpeEventInfo);
> +        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
>           if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>           {
>               /* Poll edge triggered GPEs to handle existing events */
> diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
> index 52061db1..1dc0fe1d 100644
> --- a/src/acpica/source/components/events/evxfgpe.c
> +++ b/src/acpica/source/components/events/evxfgpe.c
> @@ -267,7 +267,7 @@ AcpiEnableGpe (
>           if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
>               ACPI_GPE_DISPATCH_NONE)
>           {
> -            Status = AcpiEvAddGpeReference (GpeEventInfo);
> +            Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE);
>               if (ACPI_SUCCESS (Status) &&
>                   ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
>               {
> diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
> index 84a058ad..eba1a6d2 100644
> --- a/src/acpica/source/components/executer/exconfig.c
> +++ b/src/acpica/source/components/executer/exconfig.c
> @@ -342,10 +342,9 @@ AcpiExLoadTableOp (
>           return_ACPI_STATUS (Status);
>       }
>   
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>   
> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiNsInitializeObjects ();
>   
>       /* Parameter Data (optional) */
>   
> @@ -620,10 +619,11 @@ AcpiExLoadOp (
>           return_ACPI_STATUS (Status);
>       }
>   
> -    /* Complete the initialization/resolution of package objects */
> +    /* Complete the initialization/resolution of new objects */
>   
> -    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
> +    AcpiExExitInterpreter ();
> +    AcpiNsInitializeObjects ();
> +    AcpiExEnterInterpreter ();
>   
>       /* Store the DdbHandle into the Target operand */
>   
> diff --git a/src/acpica/source/components/namespace/nsaccess.c b/src/acpica/source/components/namespace/nsaccess.c
> index 94dba130..4be555c0 100644
> --- a/src/acpica/source/components/namespace/nsaccess.c
> +++ b/src/acpica/source/components/namespace/nsaccess.c
> @@ -184,6 +184,7 @@ AcpiNsRootInitialize (
>       ACPI_STATUS                 Status;
>       const ACPI_PREDEFINED_NAMES *InitVal = NULL;
>       ACPI_NAMESPACE_NODE         *NewNode;
> +    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
>       ACPI_OPERAND_OBJECT         *ObjDesc;
>       ACPI_STRING                 Val = NULL;
>   
> @@ -213,13 +214,30 @@ AcpiNsRootInitialize (
>        */
>       AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
>   
> -    /* Enter the pre-defined names in the name table */
> +    /* Enter the predefined names in the name table */
>   
>       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>           "Entering predefined entries into namespace\n"));
>   
> +    /*
> +     * Create the initial (default) namespace.
> +     * This namespace looks like something similar to this:
> +     *
> +     *   ACPI Namespace (from Namespace Root):
> +     *    0  _GPE Scope        00203160 00
> +     *    0  _PR_ Scope        002031D0 00
> +     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
> +     *    0  _SI_ Scope        002032B0 00
> +     *    0  _TZ_ Device       00203320 00
> +     *    0  _REV Integer      00203390 00 = 0000000000000002
> +     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
> +     *    0  _GL_ Mutex        00203580 00 Object 002035F0
> +     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
> +     */
>       for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
>       {
> +        Status = AE_OK;
> +
>           /* _OSI is optional for now, will be permanent later */
>   
>           if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
> @@ -227,17 +245,35 @@ AcpiNsRootInitialize (
>               continue;
>           }
>   
> -        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
> -            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
> -            NULL, &NewNode);
> -        if (ACPI_FAILURE (Status))
> +        /*
> +         * Create, init, and link the new predefined name
> +         * Note: No need to use AcpiNsLookup here because all the
> +         * predefined names are at the root level. It is much easier to
> +         * just create and link the new node(s) here.
> +         */
> +        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
> +        if (!NewNode)
>           {
> -            ACPI_EXCEPTION ((AE_INFO, Status,
> -                "Could not create predefined name %s",
> -                InitVal->Name));
> -            continue;
> +            Status = AE_NO_MEMORY;
> +            goto UnlockAndExit;
>           }
>   
> +        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
> +        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
> +        NewNode->Type = InitVal->Type;
> +
> +        if (!PrevNode)
> +        {
> +            AcpiGbl_RootNodeStruct.Child = NewNode;
> +        }
> +        else
> +        {
> +            PrevNode->Peer = NewNode;
> +        }
> +
> +        NewNode->Parent = &AcpiGbl_RootNodeStruct;
> +        PrevNode = NewNode;
> +
>           /*
>            * Name entered successfully. If entry in PreDefinedNames[] specifies
>            * an initial value, create the initial value.
> @@ -286,7 +322,7 @@ AcpiNsRootInitialize (
>   
>                   NewNode->Value = ObjDesc->Method.ParamCount;
>   #else
> -                /* Mark this as a very SPECIAL method */
> +                /* Mark this as a very SPECIAL method (_OSI) */
>   
>                   ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
>                   ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
> @@ -359,7 +395,6 @@ AcpiNsRootInitialize (
>           }
>       }
>   
> -
>   UnlockAndExit:
>       (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
>   
> diff --git a/src/acpica/source/components/namespace/nseval.c b/src/acpica/source/components/namespace/nseval.c
> index 2ecba639..af6a6d45 100644
> --- a/src/acpica/source/components/namespace/nseval.c
> +++ b/src/acpica/source/components/namespace/nseval.c
> @@ -160,13 +160,6 @@
>   #define _COMPONENT          ACPI_NAMESPACE
>           ACPI_MODULE_NAME    ("nseval")
>   
> -/* Local prototypes */
> -
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info);
> -
>   
>   /*******************************************************************************
>    *
> @@ -465,206 +458,3 @@ Cleanup:
>       Info->FullPathname = NULL;
>       return_ACPI_STATUS (Status);
>   }
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    AcpiNsExecModuleCodeList
> - *
> - * PARAMETERS:  None
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute all elements of the global module-level code list.
> - *              Each element is executed as a single control method.
> - *
> - * NOTE: With this option enabled, each block of detected executable AML
> - * code that is outside of any control method is wrapped with a temporary
> - * control method object and placed on a global list. The methods on this
> - * list are executed below.
> - *
> - * This function executes the module-level code for all tables only after
> - * all of the tables have been loaded. It is a legacy option and is
> - * not compatible with other ACPI implementations. See AcpiNsLoadTable.
> - *
> - * This function will be removed when the legacy option is removed.
> - *
> - ******************************************************************************/
> -
> -void
> -AcpiNsExecModuleCodeList (
> -    void)
> -{
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
> -    ACPI_EVALUATE_INFO      *Info;
> -    UINT32                  MethodCount = 0;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
> -
> -
> -    /* Exit now if the list is empty */
> -
> -    Next = AcpiGbl_ModuleCodeList;
> -    if (!Next)
> -    {
> -        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -            "Legacy MLC block list is empty\n"));
> -
> -        return_VOID;
> -    }
> -
> -    /* Allocate the evaluation information block */
> -
> -    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
> -    if (!Info)
> -    {
> -        return_VOID;
> -    }
> -
> -    /* Walk the list, executing each "method" */
> -
> -    while (Next)
> -    {
> -        Prev = Next;
> -        Next = Next->Method.Mutex;
> -
> -        /* Clear the link field and execute the method */
> -
> -        Prev->Method.Mutex = NULL;
> -        AcpiNsExecModuleCode (Prev, Info);
> -        MethodCount++;
> -
> -        /* Delete the (temporary) method object */
> -
> -        AcpiUtRemoveReference (Prev);
> -    }
> -
> -    ACPI_INFO ((
> -        "Executed %u blocks of module-level executable AML code",
> -        MethodCount));
> -
> -    ACPI_FREE (Info);
> -    AcpiGbl_ModuleCodeList = NULL;
> -    return_VOID;
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    AcpiNsExecModuleCode
> - *
> - * PARAMETERS:  MethodObj           - Object container for the module-level code
> - *              Info                - Info block for method evaluation
> - *
> - * RETURN:      None. Exceptions during method execution are ignored, since
> - *              we cannot abort a table load.
> - *
> - * DESCRIPTION: Execute a control method containing a block of module-level
> - *              executable AML code. The control method is temporarily
> - *              installed to the root node, then evaluated.
> - *
> - ******************************************************************************/
> -
> -static void
> -AcpiNsExecModuleCode (
> -    ACPI_OPERAND_OBJECT     *MethodObj,
> -    ACPI_EVALUATE_INFO      *Info)
> -{
> -    ACPI_OPERAND_OBJECT     *ParentObj;
> -    ACPI_NAMESPACE_NODE     *ParentNode;
> -    ACPI_OBJECT_TYPE        Type;
> -    ACPI_STATUS             Status;
> -
> -
> -    ACPI_FUNCTION_TRACE (NsExecModuleCode);
> -
> -
> -    /*
> -     * Get the parent node. We cheat by using the NextObject field
> -     * of the method object descriptor.
> -     */
> -    ParentNode = ACPI_CAST_PTR (
> -        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
> -    Type = AcpiNsGetType (ParentNode);
> -
> -    /*
> -     * Get the region handler and save it in the method object. We may need
> -     * this if an operation region declaration causes a _REG method to be run.
> -     *
> -     * We can't do this in AcpiPsLinkModuleCode because
> -     * AcpiGbl_RootNode->Object is NULL at PASS1.
> -     */
> -    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
> -    {
> -        MethodObj->Method.Dispatch.Handler =
> -            ParentNode->Object->Device.Handler;
> -    }
> -
> -    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
> -
> -    MethodObj->Method.NextObject = NULL;
> -
> -    /* Initialize the evaluation information block */
> -
> -    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
> -    Info->PrefixNode = ParentNode;
> -
> -    /*
> -     * Get the currently attached parent object. Add a reference,
> -     * because the ref count will be decreased when the method object
> -     * is installed to the parent node.
> -     */
> -    ParentObj = AcpiNsGetAttachedObject (ParentNode);
> -    if (ParentObj)
> -    {
> -        AcpiUtAddReference (ParentObj);
> -    }
> -
> -    /* Install the method (module-level code) in the parent node */
> -
> -    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
> -    if (ACPI_FAILURE (Status))
> -    {
> -        goto Exit;
> -    }
> -
> -    /* Execute the parent node as a control method */
> -
> -    Status = AcpiNsEvaluate (Info);
> -
> -    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
> -        "Executed module-level code at %p\n",
> -        MethodObj->Method.AmlStart));
> -
> -    /* Delete a possible implicit return value (in slack mode) */
> -
> -    if (Info->ReturnObject)
> -    {
> -        AcpiUtRemoveReference (Info->ReturnObject);
> -    }
> -
> -    /* Detach the temporary method object */
> -
> -    AcpiNsDetachObject (ParentNode);
> -
> -    /* Restore the original parent object */
> -
> -    if (ParentObj)
> -    {
> -        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
> -    }
> -    else
> -    {
> -        ParentNode->Type = (UINT8) Type;
> -    }
> -
> -Exit:
> -    if (ParentObj)
> -    {
> -        AcpiUtRemoveReference (ParentObj);
> -    }
> -    return_VOID;
> -}
> diff --git a/src/acpica/source/components/namespace/nsinit.c b/src/acpica/source/components/namespace/nsinit.c
> index 4dd28fd4..51f98339 100644
> --- a/src/acpica/source/components/namespace/nsinit.c
> +++ b/src/acpica/source/components/namespace/nsinit.c
> @@ -212,29 +212,30 @@ AcpiNsInitializeObjects (
>       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>           "**** Starting initialization of namespace objects ****\n"));
>       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "Completing Region/Field/Buffer/Package initialization:\n"));
> +        "Final data object initialization: "));
>   
> -    /* Set all init info to zero */
> +    /* Clear the info block */
>   
>       memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
>   
>       /* Walk entire namespace from the supplied root */
>   
> +    /*
> +     * TBD: will become ACPI_TYPE_PACKAGE as this type object
> +     * is now the only one that supports deferred initialization
> +     * (forward references).
> +     */
>       Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
> -        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
> -        &Info, NULL);
> +        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
>       if (ACPI_FAILURE (Status))
>       {
>           ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
>       }
>   
>       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
> -        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
> -        "Buffers %u/%u Packages (%u nodes)\n",
> -        Info.OpRegionInit,  Info.OpRegionCount,
> -        Info.FieldInit,     Info.FieldCount,
> -        Info.BufferInit,    Info.BufferCount,
> -        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
> +        "Namespace contains %u (0x%X) objects\n",
> +        Info.ObjectCount,
> +        Info.ObjectCount));
>   
>       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
>           "%u Control Methods found\n%u Op Regions found\n",
> @@ -561,35 +562,19 @@ AcpiNsInitOneObject (
>       AcpiExEnterInterpreter ();
>   
>       /*
> -     * Each of these types can contain executable AML code within the
> -     * declaration.
> +     * Only initialization of Package objects can be deferred, in order
> +     * to support forward references.
>        */
>       switch (Type)
>       {
> -    case ACPI_TYPE_REGION:
> -
> -        Info->OpRegionInit++;
> -        Status = AcpiDsGetRegionArguments (ObjDesc);
> -        break;
> -
> -    case ACPI_TYPE_BUFFER_FIELD:
> -
> -        Info->FieldInit++;
> -        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
> -        break;
> -
>       case ACPI_TYPE_LOCAL_BANK_FIELD:
>   
> +        /* TBD: BankFields do not require deferred init, remove this code */
> +
>           Info->FieldInit++;
>           Status = AcpiDsGetBankFieldArguments (ObjDesc);
>           break;
>   
> -    case ACPI_TYPE_BUFFER:
> -
> -        Info->BufferInit++;
> -        Status = AcpiDsGetBufferArguments (ObjDesc);
> -        break;
> -
>       case ACPI_TYPE_PACKAGE:
>   
>           /* Complete the initialization/resolution of the package object */
> @@ -600,8 +585,12 @@ AcpiNsInitOneObject (
>   
>       default:
>   
> -        /* No other types can get here */
> +        /* No other types should get here */
>   
> +        Status = AE_TYPE;
> +        ACPI_EXCEPTION ((AE_INFO, Status,
> +            "Opcode is not deferred [%4.4s] (%s)",
> +            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
>           break;
>       }
>   
> diff --git a/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c
> index f5a82347..f7aaa11d 100644
> --- a/src/acpica/source/components/namespace/nsload.c
> +++ b/src/acpica/source/components/namespace/nsload.c
> @@ -268,18 +268,6 @@ Unlock:
>       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
>           "**** Completed Table Object Initialization\n"));
>   
> -    /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> -     */
> -    AcpiNsExecModuleCodeList ();
>       return_ACPI_STATUS (Status);
>   }
>   
> diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c
> index 85732ff8..581ad5f3 100644
> --- a/src/acpica/source/components/namespace/nsutils.c
> +++ b/src/acpica/source/components/namespace/nsutils.c
> @@ -802,24 +802,11 @@ AcpiNsTerminate (
>       void)
>   {
>       ACPI_STATUS             Status;
> -    ACPI_OPERAND_OBJECT     *Prev;
> -    ACPI_OPERAND_OBJECT     *Next;
>   
>   
>       ACPI_FUNCTION_TRACE (NsTerminate);
>   
>   
> -    /* Delete any module-level code blocks */
> -
> -    Next = AcpiGbl_ModuleCodeList;
> -    while (Next)
> -    {
> -        Prev = Next;
> -        Next = Next->Method.Mutex;
> -        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
> -        AcpiUtRemoveReference (Prev);
> -    }
> -
>       /*
>        * Free the entire namespace -- all nodes and all objects
>        * attached to the nodes
> diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
> index 9d86fdbc..ba0c9108 100644
> --- a/src/acpica/source/components/tables/tbdata.c
> +++ b/src/acpica/source/components/tables/tbdata.c
> @@ -1190,19 +1190,6 @@ AcpiTbLoadTable (
>   
>       Status = AcpiNsLoadTable (TableIndex, ParentNode);
>   
> -    /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> -     */
> -    AcpiNsExecModuleCodeList ();
> -
>       /*
>        * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
>        * responsible for discovering any new wake GPEs by running _PRW methods
> diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
> index 217d54bf..1e17db6c 100644
> --- a/src/acpica/source/components/tables/tbxfload.c
> +++ b/src/acpica/source/components/tables/tbxfload.c
> @@ -479,6 +479,13 @@ AcpiLoadTable (
>       ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
>       Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
>           ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
> +    if (ACPI_SUCCESS (Status))
> +    {
> +        /* Complete the initialization/resolution of new objects */
> +
> +        AcpiNsInitializeObjects ();
> +    }
> +
>       return_ACPI_STATUS (Status);
>   }
>   
> diff --git a/src/acpica/source/components/utilities/utinit.c b/src/acpica/source/components/utilities/utinit.c
> index d83d7dab..3e7ed41f 100644
> --- a/src/acpica/source/components/utilities/utinit.c
> +++ b/src/acpica/source/components/utilities/utinit.c
> @@ -342,7 +342,6 @@ AcpiUtInitGlobals (
>   
>       /* Namespace */
>   
> -    AcpiGbl_ModuleCodeList              = NULL;
>       AcpiGbl_RootNode                    = NULL;
>       AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
>       AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
> diff --git a/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c
> index f0c46c02..d0b49bba 100644
> --- a/src/acpica/source/components/utilities/utxfinit.c
> +++ b/src/acpica/source/components/utilities/utxfinit.c
> @@ -381,24 +381,17 @@ AcpiInitializeObjects (
>       ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
>   
>   
> +#ifdef ACPI_OBSOLETE_BEHAVIOR
>       /*
> -     * This case handles the legacy option that groups all module-level
> -     * code blocks together and defers execution until all of the tables
> -     * are loaded. Execute all of these blocks at this time.
> -     * Execute any module-level code that was detected during the table
> -     * load phase.
> -     *
> -     * Note: this option is deprecated and will be eliminated in the
> -     * future. Use of this option can cause problems with AML code that
> -     * depends upon in-order immediate execution of module-level code.
> +     * 05/2019: Removed, initialization now happens at both object
> +     * creation and table load time
>        */
> -    AcpiNsExecModuleCodeList ();
>   
>       /*
>        * Initialize the objects that remain uninitialized. This
>        * runs the executable AML that may be part of the
> -     * declaration of these objects:
> -     * OperationRegions, BufferFields, Buffers, and Packages.
> +     * declaration of these objects: OperationRegions, BufferFields,
> +     * BankFields, Buffers, and Packages.
>        */
>       if (!(Flags & ACPI_NO_OBJECT_INIT))
>       {
> @@ -408,6 +401,7 @@ AcpiInitializeObjects (
>               return_ACPI_STATUS (Status);
>           }
>       }
> +#endif
>   
>       /*
>        * Initialize all device/region objects in the namespace. This runs
> diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
> index f1092342..c2eb7324 100644
> --- a/src/acpica/source/include/acevents.h
> +++ b/src/acpica/source/include/acevents.h
> @@ -245,7 +245,8 @@ AcpiEvMaskGpe (
>   
>   ACPI_STATUS
>   AcpiEvAddGpeReference (
> -    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
> +    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
> +    BOOLEAN                 ClearOnEnable);
>   
>   ACPI_STATUS
>   AcpiEvRemoveGpeReference (
> diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
> index 78bc7ca0..e9e3206a 100644
> --- a/src/acpica/source/include/acglobal.h
> +++ b/src/acpica/source/include/acglobal.h
> @@ -323,7 +323,6 @@ ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_VerboseLeakDump);
>   ACPI_GLOBAL (ACPI_NAMESPACE_NODE,       AcpiGbl_RootNodeStruct);
>   ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_RootNode);
>   ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_FadtGpeDevice);
> -ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_ModuleCodeList);
>   
>   extern const UINT8                      AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
>   extern const ACPI_PREDEFINED_NAMES      AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
> diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
> index eaa2f1b4..6d148fea 100644
> --- a/src/acpica/source/include/acnamesp.h
> +++ b/src/acpica/source/include/acnamesp.h
> @@ -419,10 +419,6 @@ ACPI_STATUS
>   AcpiNsEvaluate (
>       ACPI_EVALUATE_INFO      *Info);
>   
> -void
> -AcpiNsExecModuleCodeList (
> -    void);
> -
>   
>   /*
>    * nsarguments - Argument count/type checking for predefined/reserved names
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 8778da72..2893bf23 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -154,7 +154,7 @@
>   
>   /* Current ACPICA subsystem version in YYYYMMDD format */
>   
> -#define ACPI_CA_VERSION                 0x20190509
> +#define ACPI_CA_VERSION                 0x20190703
>   
>   #include "acconfig.h"
>   #include "actypes.h"
> 

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

Patch
diff mbox series

diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h
index cffb0af1..c5111875 100644
--- a/src/acpica/source/compiler/asldefine.h
+++ b/src/acpica/source/compiler/asldefine.h
@@ -298,4 +298,20 @@ 
 #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
 #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
 
+/*
+ * Special name segments - these must only be declared at the root scope
+ */
+#define NAMESEG__PTS    "_PTS"
+#define NAMESEG__WAK    "_WAK"
+#define NAMESEG__S0     "_S0_"
+#define NAMESEG__S1     "_S1_"
+#define NAMESEG__S2     "_S2_"
+#define NAMESEG__S3     "_S3_"
+#define NAMESEG__S4     "_S4_"
+#define NAMESEG__S5     "_S5_"
+#define NAMESEG__TTS    "_TTS"
+
+#define MAX_SPECIAL_NAMES      9
+
+
 #endif /* ASLDEFINE.H */
diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
index 213c5408..740f7f34 100644
--- a/src/acpica/source/compiler/aslglobal.h
+++ b/src/acpica/source/compiler/aslglobal.h
@@ -223,13 +223,28 @@  const char                          *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] =
     "OP_NOT_FOUND_DURING_LOAD"
 };
 
+const char                          *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] =
+{
+    NAMESEG__PTS,
+    NAMESEG__WAK,
+    NAMESEG__S0,
+    NAMESEG__S1,
+    NAMESEG__S2,
+    NAMESEG__S3,
+    NAMESEG__S4,
+    NAMESEG__S5,
+    NAMESEG__TTS
+};
+
 #else
 extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
 extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
 extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
+extern const char                   *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES];
 #endif
 
 
+
 /*
  * Parser and other externals
  */
diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
index d1523ab6..4dd2dfd0 100644
--- a/src/acpica/source/compiler/aslload.c
+++ b/src/acpica/source/compiler/aslload.c
@@ -164,6 +164,7 @@ 
 
 static ACPI_STATUS
 LdLoadFieldElements (
+    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState);
 
@@ -190,6 +191,10 @@  LdCommonNamespaceEnd (
     UINT32                  Level,
     void                    *Context);
 
+static void
+LdCheckSpecialNames (
+    ACPI_NAMESPACE_NODE     *Node,
+    ACPI_PARSE_OBJECT       *Op);
 
 /*******************************************************************************
  *
@@ -247,7 +252,8 @@  LdLoadNamespace (
  *
  * FUNCTION:    LdLoadFieldElements
  *
- * PARAMETERS:  Op              - Parent node (Field)
+ * PARAMETERS:  AmlType         - Type to search
+ *              Op              - Parent node (Field)
  *              WalkState       - Current walk state
  *
  * RETURN:      Status
@@ -259,6 +265,7 @@  LdLoadNamespace (
 
 static ACPI_STATUS
 LdLoadFieldElements (
+    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState)
 {
@@ -274,7 +281,7 @@  LdLoadFieldElements (
     {
         Status = AcpiNsLookup (WalkState->ScopeInfo,
             SourceRegion->Asl.Value.String,
-            ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+            AmlType, ACPI_IMODE_EXECUTE,
             ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
         if (Status == AE_NOT_FOUND)
         {
@@ -507,11 +514,15 @@  LdNamespace1Begin (
      */
     switch (Op->Asl.AmlOpcode)
     {
-    case AML_BANK_FIELD_OP:
     case AML_INDEX_FIELD_OP:
+
+        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
+        return (Status);
+
+    case AML_BANK_FIELD_OP:
     case AML_FIELD_OP:
 
-        Status = LdLoadFieldElements (Op, WalkState);
+        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
         return (Status);
 
     case AML_INT_CONNECTION_OP:
@@ -966,6 +977,10 @@  LdNamespace1Begin (
         }
     }
 
+    /* Check special names like _WAK and _PTS */
+
+    LdCheckSpecialNames (Node, Op);
+
     if (ForceNewScope)
     {
         Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
@@ -1004,6 +1019,42 @@  FinishNode:
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    LdCheckSpecialNames
+ *
+ * PARAMETERS:  Node        - Node that represents the named object
+ *              Op          - Named object declaring this named object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check if certain named objects are declared in the incorrect
+ *              scope. Special named objects are listed in
+ *              AslGbl_SpecialNamedObjects and can only be declared at the root
+ *              scope.
+ *
+ ******************************************************************************/
+
+static void
+LdCheckSpecialNames (
+    ACPI_NAMESPACE_NODE     *Node,
+    ACPI_PARSE_OBJECT       *Op)
+{
+    UINT32                  i;
+
+
+    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
+    {
+        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
+            Node->Parent != AcpiGbl_RootNode)
+        {
+            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
+            return;
+        }
+    }
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    LdNamespace2Begin
diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
index cf7a7a4f..48c4dbab 100644
--- a/src/acpica/source/compiler/aslmessages.c
+++ b/src/acpica/source/compiler/aslmessages.c
@@ -365,7 +365,8 @@  const char                      *AslCompilerMsgs [] =
 /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
 /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
 /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
-/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */        "Buffer field extends beyond end of target buffer"
+/*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
+/*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal"
 };
 
 /* Table compiler */
diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
index 15613685..d998f0fe 100644
--- a/src/acpica/source/compiler/aslmessages.h
+++ b/src/acpica/source/compiler/aslmessages.h
@@ -368,6 +368,7 @@  typedef enum
     ASL_MSG_TEMPORARY_OBJECT,
     ASL_MSG_UNDEFINED_EXTERNAL,
     ASL_MSG_BUFFER_FIELD_OVERFLOW,
+    ASL_MSG_INVALID_SPECIAL_NAME,
 
     /* These messages are used by the Data Table compiler only */
 
diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c
index a54c498c..a8f22bd8 100644
--- a/src/acpica/source/compiler/aslstubs.c
+++ b/src/acpica/source/compiler/aslstubs.c
@@ -166,12 +166,6 @@ 
  * Things like Events, Global Lock, etc. are not used
  * by the compiler, so they are stubbed out here.
  */
-void
-AcpiNsExecModuleCodeList (
-    void)
-{
-}
-
 ACPI_STATUS
 AcpiNsInitializeObjects (
     void)
diff --git a/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l
index 69c1399a..297bf2ee 100644
--- a/src/acpica/source/compiler/aslsupport.l
+++ b/src/acpica/source/compiler/aslsupport.l
@@ -220,7 +220,7 @@  AslDoLineDirective (
 
     while ((c = input()) != '\n' && c != EOF)
     {
-        *AslGbl_LineBufPtr = c;
+        *AslGbl_LineBufPtr = (char) c;
         AslGbl_LineBufPtr++;
     }
     *AslGbl_LineBufPtr = 0;
@@ -498,7 +498,7 @@  AslInsertLineBuffer (
 
         if (AcpiGbl_CaptureComments)
         {
-            CvProcessCommentState (SourceChar);
+            CvProcessCommentState ((char) SourceChar);
         }
     }
 }
@@ -601,7 +601,7 @@  loop:
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = c;
+            *StringBuffer = (char) c;
             ++StringBuffer;
         }
         c1 = c;
@@ -629,7 +629,7 @@  loop:
     AslInsertLineBuffer (c);
     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
     {
-        *StringBuffer = c;
+        *StringBuffer = (char) c;
         ++StringBuffer;
     }
 
@@ -720,7 +720,7 @@  AslDoCommentType2 (
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = c;
+            *StringBuffer = (char) c;
             ++StringBuffer;
         }
     }
@@ -878,7 +878,7 @@  DoCharacter:
                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
                 {
                     State = ASL_OCTAL_CONSTANT;
-                    ConvertBuffer[0] = StringChar;
+                    ConvertBuffer[0] = (char) StringChar;
                     i = 1;
                     continue;
                 }
@@ -934,7 +934,7 @@  DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = StringChar;
+            ConvertBuffer[i] = (char) StringChar;
             i++;
             continue;
 
@@ -978,7 +978,7 @@  DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = StringChar;
+            ConvertBuffer[i] = (char) StringChar;
             i++;
             continue;
 
@@ -989,7 +989,7 @@  DoCharacter:
 
         /* Save the finished character */
 
-        *StringBuffer = StringChar;
+        *StringBuffer = (char) StringChar;
         StringBuffer++;
         if (StringBuffer >= EndBuffer)
         {
diff --git a/src/acpica/source/components/debugger/dbobject.c b/src/acpica/source/components/debugger/dbobject.c
index f9dc6687..cebf4420 100644
--- a/src/acpica/source/components/debugger/dbobject.c
+++ b/src/acpica/source/components/debugger/dbobject.c
@@ -567,7 +567,6 @@  AcpiDbDecodeLocals (
 
 
     Node = WalkState->MethodNode;
-    ObjDesc = WalkState->MethodDesc;
 
     /* There are no locals for the module-level code case */
 
diff --git a/src/acpica/source/components/dispatcher/dsinit.c b/src/acpica/source/components/dispatcher/dsinit.c
index e7045f46..9810f9ff 100644
--- a/src/acpica/source/components/dispatcher/dsinit.c
+++ b/src/acpica/source/components/dispatcher/dsinit.c
@@ -362,7 +362,7 @@  AcpiDsInitializeObjects (
     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
     {
         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-            "\nInitializing Namespace objects:\n"));
+            "\nACPI table initialization:\n"));
     }
 
     /* Summary of objects initialized */
diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
index f5ea992a..a7ee84c9 100644
--- a/src/acpica/source/components/events/evgpe.c
+++ b/src/acpica/source/components/events/evgpe.c
@@ -316,6 +316,7 @@  AcpiEvMaskGpe (
  * FUNCTION:    AcpiEvAddGpeReference
  *
  * PARAMETERS:  GpeEventInfo            - Add a reference to this GPE
+ *              ClearOnEnable           - Clear GPE status before enabling it
  *
  * RETURN:      Status
  *
@@ -326,7 +327,8 @@  AcpiEvMaskGpe (
 
 ACPI_STATUS
 AcpiEvAddGpeReference (
-    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
+    BOOLEAN                 ClearOnEnable)
 {
     ACPI_STATUS             Status = AE_OK;
 
@@ -344,6 +346,11 @@  AcpiEvAddGpeReference (
     {
         /* Enable on first reference */
 
+        if (ClearOnEnable)
+        {
+            (void) AcpiHwClearGpe (GpeEventInfo);
+        }
+
         Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
         if (ACPI_SUCCESS (Status))
         {
diff --git a/src/acpica/source/components/events/evgpeblk.c b/src/acpica/source/components/events/evgpeblk.c
index 7e1dd196..80157dcd 100644
--- a/src/acpica/source/components/events/evgpeblk.c
+++ b/src/acpica/source/components/events/evgpeblk.c
@@ -637,7 +637,7 @@  AcpiEvInitializeGpeBlock (
                 continue;
             }
 
-            Status = AcpiEvAddGpeReference (GpeEventInfo);
+            Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE);
             if (ACPI_FAILURE (Status))
             {
                 ACPI_EXCEPTION ((AE_INFO, Status,
diff --git a/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c
index 8577a6d0..8e8eacf7 100644
--- a/src/acpica/source/components/events/evxface.c
+++ b/src/acpica/source/components/events/evxface.c
@@ -1256,7 +1256,7 @@  AcpiRemoveGpeHandler (
             ACPI_GPE_DISPATCH_NOTIFY)) &&
         Handler->OriginallyEnabled)
     {
-        (void) AcpiEvAddGpeReference (GpeEventInfo);
+        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
         {
             /* Poll edge triggered GPEs to handle existing events */
diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
index 52061db1..1dc0fe1d 100644
--- a/src/acpica/source/components/events/evxfgpe.c
+++ b/src/acpica/source/components/events/evxfgpe.c
@@ -267,7 +267,7 @@  AcpiEnableGpe (
         if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
             ACPI_GPE_DISPATCH_NONE)
         {
-            Status = AcpiEvAddGpeReference (GpeEventInfo);
+            Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE);
             if (ACPI_SUCCESS (Status) &&
                 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
             {
diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
index 84a058ad..eba1a6d2 100644
--- a/src/acpica/source/components/executer/exconfig.c
+++ b/src/acpica/source/components/executer/exconfig.c
@@ -342,10 +342,9 @@  AcpiExLoadTableOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of package objects */
+    /* Complete the initialization/resolution of new objects */
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
+    AcpiNsInitializeObjects ();
 
     /* Parameter Data (optional) */
 
@@ -620,10 +619,11 @@  AcpiExLoadOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of package objects */
+    /* Complete the initialization/resolution of new objects */
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
+    AcpiExExitInterpreter ();
+    AcpiNsInitializeObjects ();
+    AcpiExEnterInterpreter ();
 
     /* Store the DdbHandle into the Target operand */
 
diff --git a/src/acpica/source/components/namespace/nsaccess.c b/src/acpica/source/components/namespace/nsaccess.c
index 94dba130..4be555c0 100644
--- a/src/acpica/source/components/namespace/nsaccess.c
+++ b/src/acpica/source/components/namespace/nsaccess.c
@@ -184,6 +184,7 @@  AcpiNsRootInitialize (
     ACPI_STATUS                 Status;
     const ACPI_PREDEFINED_NAMES *InitVal = NULL;
     ACPI_NAMESPACE_NODE         *NewNode;
+    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
     ACPI_OPERAND_OBJECT         *ObjDesc;
     ACPI_STRING                 Val = NULL;
 
@@ -213,13 +214,30 @@  AcpiNsRootInitialize (
      */
     AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
 
-    /* Enter the pre-defined names in the name table */
+    /* Enter the predefined names in the name table */
 
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
         "Entering predefined entries into namespace\n"));
 
+    /*
+     * Create the initial (default) namespace.
+     * This namespace looks like something similar to this:
+     *
+     *   ACPI Namespace (from Namespace Root):
+     *    0  _GPE Scope        00203160 00
+     *    0  _PR_ Scope        002031D0 00
+     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
+     *    0  _SI_ Scope        002032B0 00
+     *    0  _TZ_ Device       00203320 00
+     *    0  _REV Integer      00203390 00 = 0000000000000002
+     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
+     *    0  _GL_ Mutex        00203580 00 Object 002035F0
+     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
+     */
     for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
     {
+        Status = AE_OK;
+
         /* _OSI is optional for now, will be permanent later */
 
         if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
@@ -227,17 +245,35 @@  AcpiNsRootInitialize (
             continue;
         }
 
-        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
-            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
-            NULL, &NewNode);
-        if (ACPI_FAILURE (Status))
+        /*
+         * Create, init, and link the new predefined name
+         * Note: No need to use AcpiNsLookup here because all the
+         * predefined names are at the root level. It is much easier to
+         * just create and link the new node(s) here.
+         */
+        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
+        if (!NewNode)
         {
-            ACPI_EXCEPTION ((AE_INFO, Status,
-                "Could not create predefined name %s",
-                InitVal->Name));
-            continue;
+            Status = AE_NO_MEMORY;
+            goto UnlockAndExit;
         }
 
+        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
+        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
+        NewNode->Type = InitVal->Type;
+
+        if (!PrevNode)
+        {
+            AcpiGbl_RootNodeStruct.Child = NewNode;
+        }
+        else
+        {
+            PrevNode->Peer = NewNode;
+        }
+
+        NewNode->Parent = &AcpiGbl_RootNodeStruct;
+        PrevNode = NewNode;
+
         /*
          * Name entered successfully. If entry in PreDefinedNames[] specifies
          * an initial value, create the initial value.
@@ -286,7 +322,7 @@  AcpiNsRootInitialize (
 
                 NewNode->Value = ObjDesc->Method.ParamCount;
 #else
-                /* Mark this as a very SPECIAL method */
+                /* Mark this as a very SPECIAL method (_OSI) */
 
                 ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
                 ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
@@ -359,7 +395,6 @@  AcpiNsRootInitialize (
         }
     }
 
-
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 
diff --git a/src/acpica/source/components/namespace/nseval.c b/src/acpica/source/components/namespace/nseval.c
index 2ecba639..af6a6d45 100644
--- a/src/acpica/source/components/namespace/nseval.c
+++ b/src/acpica/source/components/namespace/nseval.c
@@ -160,13 +160,6 @@ 
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nseval")
 
-/* Local prototypes */
-
-static void
-AcpiNsExecModuleCode (
-    ACPI_OPERAND_OBJECT     *MethodObj,
-    ACPI_EVALUATE_INFO      *Info);
-
 
 /*******************************************************************************
  *
@@ -465,206 +458,3 @@  Cleanup:
     Info->FullPathname = NULL;
     return_ACPI_STATUS (Status);
 }
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsExecModuleCodeList
- *
- * PARAMETERS:  None
- *
- * RETURN:      None. Exceptions during method execution are ignored, since
- *              we cannot abort a table load.
- *
- * DESCRIPTION: Execute all elements of the global module-level code list.
- *              Each element is executed as a single control method.
- *
- * NOTE: With this option enabled, each block of detected executable AML
- * code that is outside of any control method is wrapped with a temporary
- * control method object and placed on a global list. The methods on this
- * list are executed below.
- *
- * This function executes the module-level code for all tables only after
- * all of the tables have been loaded. It is a legacy option and is
- * not compatible with other ACPI implementations. See AcpiNsLoadTable.
- *
- * This function will be removed when the legacy option is removed.
- *
- ******************************************************************************/
-
-void
-AcpiNsExecModuleCodeList (
-    void)
-{
-    ACPI_OPERAND_OBJECT     *Prev;
-    ACPI_OPERAND_OBJECT     *Next;
-    ACPI_EVALUATE_INFO      *Info;
-    UINT32                  MethodCount = 0;
-
-
-    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
-
-
-    /* Exit now if the list is empty */
-
-    Next = AcpiGbl_ModuleCodeList;
-    if (!Next)
-    {
-        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
-            "Legacy MLC block list is empty\n"));
-
-        return_VOID;
-    }
-
-    /* Allocate the evaluation information block */
-
-    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
-    if (!Info)
-    {
-        return_VOID;
-    }
-
-    /* Walk the list, executing each "method" */
-
-    while (Next)
-    {
-        Prev = Next;
-        Next = Next->Method.Mutex;
-
-        /* Clear the link field and execute the method */
-
-        Prev->Method.Mutex = NULL;
-        AcpiNsExecModuleCode (Prev, Info);
-        MethodCount++;
-
-        /* Delete the (temporary) method object */
-
-        AcpiUtRemoveReference (Prev);
-    }
-
-    ACPI_INFO ((
-        "Executed %u blocks of module-level executable AML code",
-        MethodCount));
-
-    ACPI_FREE (Info);
-    AcpiGbl_ModuleCodeList = NULL;
-    return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsExecModuleCode
- *
- * PARAMETERS:  MethodObj           - Object container for the module-level code
- *              Info                - Info block for method evaluation
- *
- * RETURN:      None. Exceptions during method execution are ignored, since
- *              we cannot abort a table load.
- *
- * DESCRIPTION: Execute a control method containing a block of module-level
- *              executable AML code. The control method is temporarily
- *              installed to the root node, then evaluated.
- *
- ******************************************************************************/
-
-static void
-AcpiNsExecModuleCode (
-    ACPI_OPERAND_OBJECT     *MethodObj,
-    ACPI_EVALUATE_INFO      *Info)
-{
-    ACPI_OPERAND_OBJECT     *ParentObj;
-    ACPI_NAMESPACE_NODE     *ParentNode;
-    ACPI_OBJECT_TYPE        Type;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (NsExecModuleCode);
-
-
-    /*
-     * Get the parent node. We cheat by using the NextObject field
-     * of the method object descriptor.
-     */
-    ParentNode = ACPI_CAST_PTR (
-        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
-    Type = AcpiNsGetType (ParentNode);
-
-    /*
-     * Get the region handler and save it in the method object. We may need
-     * this if an operation region declaration causes a _REG method to be run.
-     *
-     * We can't do this in AcpiPsLinkModuleCode because
-     * AcpiGbl_RootNode->Object is NULL at PASS1.
-     */
-    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
-    {
-        MethodObj->Method.Dispatch.Handler =
-            ParentNode->Object->Device.Handler;
-    }
-
-    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
-
-    MethodObj->Method.NextObject = NULL;
-
-    /* Initialize the evaluation information block */
-
-    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
-    Info->PrefixNode = ParentNode;
-
-    /*
-     * Get the currently attached parent object. Add a reference,
-     * because the ref count will be decreased when the method object
-     * is installed to the parent node.
-     */
-    ParentObj = AcpiNsGetAttachedObject (ParentNode);
-    if (ParentObj)
-    {
-        AcpiUtAddReference (ParentObj);
-    }
-
-    /* Install the method (module-level code) in the parent node */
-
-    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
-    if (ACPI_FAILURE (Status))
-    {
-        goto Exit;
-    }
-
-    /* Execute the parent node as a control method */
-
-    Status = AcpiNsEvaluate (Info);
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
-        "Executed module-level code at %p\n",
-        MethodObj->Method.AmlStart));
-
-    /* Delete a possible implicit return value (in slack mode) */
-
-    if (Info->ReturnObject)
-    {
-        AcpiUtRemoveReference (Info->ReturnObject);
-    }
-
-    /* Detach the temporary method object */
-
-    AcpiNsDetachObject (ParentNode);
-
-    /* Restore the original parent object */
-
-    if (ParentObj)
-    {
-        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
-    }
-    else
-    {
-        ParentNode->Type = (UINT8) Type;
-    }
-
-Exit:
-    if (ParentObj)
-    {
-        AcpiUtRemoveReference (ParentObj);
-    }
-    return_VOID;
-}
diff --git a/src/acpica/source/components/namespace/nsinit.c b/src/acpica/source/components/namespace/nsinit.c
index 4dd28fd4..51f98339 100644
--- a/src/acpica/source/components/namespace/nsinit.c
+++ b/src/acpica/source/components/namespace/nsinit.c
@@ -212,29 +212,30 @@  AcpiNsInitializeObjects (
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "**** Starting initialization of namespace objects ****\n"));
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Completing Region/Field/Buffer/Package initialization:\n"));
+        "Final data object initialization: "));
 
-    /* Set all init info to zero */
+    /* Clear the info block */
 
     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 
     /* Walk entire namespace from the supplied root */
 
+    /*
+     * TBD: will become ACPI_TYPE_PACKAGE as this type object
+     * is now the only one that supports deferred initialization
+     * (forward references).
+     */
     Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
-        &Info, NULL);
+        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
-        "Buffers %u/%u Packages (%u nodes)\n",
-        Info.OpRegionInit,  Info.OpRegionCount,
-        Info.FieldInit,     Info.FieldCount,
-        Info.BufferInit,    Info.BufferCount,
-        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
+        "Namespace contains %u (0x%X) objects\n",
+        Info.ObjectCount,
+        Info.ObjectCount));
 
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "%u Control Methods found\n%u Op Regions found\n",
@@ -561,35 +562,19 @@  AcpiNsInitOneObject (
     AcpiExEnterInterpreter ();
 
     /*
-     * Each of these types can contain executable AML code within the
-     * declaration.
+     * Only initialization of Package objects can be deferred, in order
+     * to support forward references.
      */
     switch (Type)
     {
-    case ACPI_TYPE_REGION:
-
-        Info->OpRegionInit++;
-        Status = AcpiDsGetRegionArguments (ObjDesc);
-        break;
-
-    case ACPI_TYPE_BUFFER_FIELD:
-
-        Info->FieldInit++;
-        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
-        break;
-
     case ACPI_TYPE_LOCAL_BANK_FIELD:
 
+        /* TBD: BankFields do not require deferred init, remove this code */
+
         Info->FieldInit++;
         Status = AcpiDsGetBankFieldArguments (ObjDesc);
         break;
 
-    case ACPI_TYPE_BUFFER:
-
-        Info->BufferInit++;
-        Status = AcpiDsGetBufferArguments (ObjDesc);
-        break;
-
     case ACPI_TYPE_PACKAGE:
 
         /* Complete the initialization/resolution of the package object */
@@ -600,8 +585,12 @@  AcpiNsInitOneObject (
 
     default:
 
-        /* No other types can get here */
+        /* No other types should get here */
 
+        Status = AE_TYPE;
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "Opcode is not deferred [%4.4s] (%s)",
+            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
         break;
     }
 
diff --git a/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c
index f5a82347..f7aaa11d 100644
--- a/src/acpica/source/components/namespace/nsload.c
+++ b/src/acpica/source/components/namespace/nsload.c
@@ -268,18 +268,6 @@  Unlock:
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
         "**** Completed Table Object Initialization\n"));
 
-    /*
-     * This case handles the legacy option that groups all module-level
-     * code blocks together and defers execution until all of the tables
-     * are loaded. Execute all of these blocks at this time.
-     * Execute any module-level code that was detected during the table
-     * load phase.
-     *
-     * Note: this option is deprecated and will be eliminated in the
-     * future. Use of this option can cause problems with AML code that
-     * depends upon in-order immediate execution of module-level code.
-     */
-    AcpiNsExecModuleCodeList ();
     return_ACPI_STATUS (Status);
 }
 
diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c
index 85732ff8..581ad5f3 100644
--- a/src/acpica/source/components/namespace/nsutils.c
+++ b/src/acpica/source/components/namespace/nsutils.c
@@ -802,24 +802,11 @@  AcpiNsTerminate (
     void)
 {
     ACPI_STATUS             Status;
-    ACPI_OPERAND_OBJECT     *Prev;
-    ACPI_OPERAND_OBJECT     *Next;
 
 
     ACPI_FUNCTION_TRACE (NsTerminate);
 
 
-    /* Delete any module-level code blocks */
-
-    Next = AcpiGbl_ModuleCodeList;
-    while (Next)
-    {
-        Prev = Next;
-        Next = Next->Method.Mutex;
-        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
-        AcpiUtRemoveReference (Prev);
-    }
-
     /*
      * Free the entire namespace -- all nodes and all objects
      * attached to the nodes
diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
index 9d86fdbc..ba0c9108 100644
--- a/src/acpica/source/components/tables/tbdata.c
+++ b/src/acpica/source/components/tables/tbdata.c
@@ -1190,19 +1190,6 @@  AcpiTbLoadTable (
 
     Status = AcpiNsLoadTable (TableIndex, ParentNode);
 
-    /*
-     * This case handles the legacy option that groups all module-level
-     * code blocks together and defers execution until all of the tables
-     * are loaded. Execute all of these blocks at this time.
-     * Execute any module-level code that was detected during the table
-     * load phase.
-     *
-     * Note: this option is deprecated and will be eliminated in the
-     * future. Use of this option can cause problems with AML code that
-     * depends upon in-order immediate execution of module-level code.
-     */
-    AcpiNsExecModuleCodeList ();
-
     /*
      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
      * responsible for discovering any new wake GPEs by running _PRW methods
diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
index 217d54bf..1e17db6c 100644
--- a/src/acpica/source/components/tables/tbxfload.c
+++ b/src/acpica/source/components/tables/tbxfload.c
@@ -479,6 +479,13 @@  AcpiLoadTable (
     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
     Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
+    if (ACPI_SUCCESS (Status))
+    {
+        /* Complete the initialization/resolution of new objects */
+
+        AcpiNsInitializeObjects ();
+    }
+
     return_ACPI_STATUS (Status);
 }
 
diff --git a/src/acpica/source/components/utilities/utinit.c b/src/acpica/source/components/utilities/utinit.c
index d83d7dab..3e7ed41f 100644
--- a/src/acpica/source/components/utilities/utinit.c
+++ b/src/acpica/source/components/utilities/utinit.c
@@ -342,7 +342,6 @@  AcpiUtInitGlobals (
 
     /* Namespace */
 
-    AcpiGbl_ModuleCodeList              = NULL;
     AcpiGbl_RootNode                    = NULL;
     AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
     AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
diff --git a/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c
index f0c46c02..d0b49bba 100644
--- a/src/acpica/source/components/utilities/utxfinit.c
+++ b/src/acpica/source/components/utilities/utxfinit.c
@@ -381,24 +381,17 @@  AcpiInitializeObjects (
     ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
 
 
+#ifdef ACPI_OBSOLETE_BEHAVIOR
     /*
-     * This case handles the legacy option that groups all module-level
-     * code blocks together and defers execution until all of the tables
-     * are loaded. Execute all of these blocks at this time.
-     * Execute any module-level code that was detected during the table
-     * load phase.
-     *
-     * Note: this option is deprecated and will be eliminated in the
-     * future. Use of this option can cause problems with AML code that
-     * depends upon in-order immediate execution of module-level code.
+     * 05/2019: Removed, initialization now happens at both object
+     * creation and table load time
      */
-    AcpiNsExecModuleCodeList ();
 
     /*
      * Initialize the objects that remain uninitialized. This
      * runs the executable AML that may be part of the
-     * declaration of these objects:
-     * OperationRegions, BufferFields, Buffers, and Packages.
+     * declaration of these objects: OperationRegions, BufferFields,
+     * BankFields, Buffers, and Packages.
      */
     if (!(Flags & ACPI_NO_OBJECT_INIT))
     {
@@ -408,6 +401,7 @@  AcpiInitializeObjects (
             return_ACPI_STATUS (Status);
         }
     }
+#endif
 
     /*
      * Initialize all device/region objects in the namespace. This runs
diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
index f1092342..c2eb7324 100644
--- a/src/acpica/source/include/acevents.h
+++ b/src/acpica/source/include/acevents.h
@@ -245,7 +245,8 @@  AcpiEvMaskGpe (
 
 ACPI_STATUS
 AcpiEvAddGpeReference (
-    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
+    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
+    BOOLEAN                 ClearOnEnable);
 
 ACPI_STATUS
 AcpiEvRemoveGpeReference (
diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
index 78bc7ca0..e9e3206a 100644
--- a/src/acpica/source/include/acglobal.h
+++ b/src/acpica/source/include/acglobal.h
@@ -323,7 +323,6 @@  ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_VerboseLeakDump);
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE,       AcpiGbl_RootNodeStruct);
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_RootNode);
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_FadtGpeDevice);
-ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_ModuleCodeList);
 
 extern const UINT8                      AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
 extern const ACPI_PREDEFINED_NAMES      AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
index eaa2f1b4..6d148fea 100644
--- a/src/acpica/source/include/acnamesp.h
+++ b/src/acpica/source/include/acnamesp.h
@@ -419,10 +419,6 @@  ACPI_STATUS
 AcpiNsEvaluate (
     ACPI_EVALUATE_INFO      *Info);
 
-void
-AcpiNsExecModuleCodeList (
-    void);
-
 
 /*
  * nsarguments - Argument count/type checking for predefined/reserved names
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 8778da72..2893bf23 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -154,7 +154,7 @@ 
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20190509
+#define ACPI_CA_VERSION                 0x20190703
 
 #include "acconfig.h"
 #include "actypes.h"