ACK: [PATCH 1/2] ACPICA: Update to version 20180427

Alex Hung alex.hung at canonical.com
Fri Apr 27 23:15:29 UTC 2018


On 2018-04-27 02:49 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> changes in this release of ACPICA are detailed at the following
> link on the ACPICA developer mailing list:
> 
> https://lists.acpica.org/pipermail/devel/2018-April/001791.html
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/acpica/source/common/adfile.c             |  56 +++++
>   src/acpica/source/common/dmtbinfo2.c          |   2 +-
>   src/acpica/source/compiler/aslcompiler.h      |   9 +
>   src/acpica/source/compiler/aslglobal.h        |   3 +-
>   src/acpica/source/compiler/aslhex.c           |  23 +-
>   src/acpica/source/compiler/aslload.c          |  72 +++++-
>   src/acpica/source/compiler/aslmessages.c      |   8 +-
>   src/acpica/source/compiler/aslmessages.h      |   2 +
>   src/acpica/source/compiler/asloperands.c      |  15 +-
>   src/acpica/source/compiler/asltypes.h         |   3 +-
>   src/acpica/source/compiler/aslutils.c         |  91 ++++++++
>   src/acpica/source/compiler/aslxref.c          | 220 ++----------------
>   .../source/components/debugger/dbnames.c      |  13 +-
>   .../source/components/debugger/dbtest.c       |  67 +++++-
>   .../source/components/dispatcher/dswscope.c   |   9 +-
>   .../source/components/resources/rsdump.c      |   2 +-
>   .../source/components/tables/tbinstal.c       |   2 +-
>   .../source/components/utilities/utstring.c    |   2 +-
>   src/acpica/source/include/acapps.h            |   4 +
>   src/acpica/source/include/acnames.h           |   7 +-
>   src/acpica/source/include/acpixf.h            |   2 +-
>   src/acpica/source/tools/acpiexec/aecommon.h   |   1 +
>   .../source/tools/acpiexec/aeexception.c       |  13 +-
>   23 files changed, 393 insertions(+), 233 deletions(-)
> 
> diff --git a/src/acpica/source/common/adfile.c b/src/acpica/source/common/adfile.c
> index d05fe40a..5e6dd893 100644
> --- a/src/acpica/source/common/adfile.c
> +++ b/src/acpica/source/common/adfile.c
> @@ -454,3 +454,59 @@ FlSplitInputPathname (
>   
>       return (AE_OK);
>   }
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    FlGetFileBasename
> + *
> + * PARAMETERS:  FilePathname            - File path to be split
> + *
> + * RETURN:      The extracted base name of the file, in upper case
> + *
> + * DESCRIPTION: Extract the file base name (the file name with no extension)
> + *              from the input pathname.
> + *
> + *              Note: Any backslashes in the pathname should be previously
> + *              converted to forward slashes before calling this function.
> + *
> + ******************************************************************************/
> +
> +char *
> +FlGetFileBasename (
> +    char                    *FilePathname)
> +{
> +    char                    *FileBasename;
> +    char                    *Substring;
> +
> +
> +    /* Backup to last slash or colon */
> +
> +    Substring = strrchr (FilePathname, '/');
> +    if (!Substring)
> +    {
> +        Substring = strrchr (FilePathname, ':');
> +    }
> +
> +    /* Extract the full filename (base + extension) */
> +
> +    if (Substring)
> +    {
> +        FileBasename = FlStrdup (Substring + 1);
> +    }
> +    else
> +    {
> +        FileBasename = FlStrdup (FilePathname);
> +    }
> +
> +    /* Remove the filename extension if present */
> +
> +    Substring = strchr (FileBasename, '.');
> +    if (Substring)
> +    {
> +        *Substring = 0;
> +    }
> +
> +    AcpiUtStrupr (FileBasename);
> +    return (FileBasename);
> +}
> diff --git a/src/acpica/source/common/dmtbinfo2.c b/src/acpica/source/common/dmtbinfo2.c
> index a925ac1f..1efd3fd9 100644
> --- a/src/acpica/source/common/dmtbinfo2.c
> +++ b/src/acpica/source/common/dmtbinfo2.c
> @@ -1063,7 +1063,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoNfit7[] =
>       {ACPI_DMT_UINT24,   ACPI_NFIT7_OFFSET (Reserved[0]),            "Reserved", 0},
>       {ACPI_DMT_UINT32,   ACPI_NFIT7_OFFSET (Capabilities),           "Capabilities (decoded below)", DT_FLAG},
>       {ACPI_DMT_FLAG0,    ACPI_NFIT7_FLAG_OFFSET (Capabilities,0),    "Cache Flush to NVDIMM", 0},
> -    {ACPI_DMT_FLAG1,    ACPI_NFIT7_FLAG_OFFSET (Capabilities,0),    "Memory Flush to MVDIMM", 0},
> +    {ACPI_DMT_FLAG1,    ACPI_NFIT7_FLAG_OFFSET (Capabilities,0),    "Memory Flush to NVDIMM", 0},
>       {ACPI_DMT_FLAG2,    ACPI_NFIT7_FLAG_OFFSET (Capabilities,0),    "Memory Mirroring", 0},
>       {ACPI_DMT_UINT32,   ACPI_NFIT7_OFFSET (Reserved2),              "Reserved", 0},
>       ACPI_DMT_TERMINATOR
> diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h
> index ca5fa90e..bd02879d 100644
> --- a/src/acpica/source/compiler/aslcompiler.h
> +++ b/src/acpica/source/compiler/aslcompiler.h
> @@ -1187,6 +1187,15 @@ UtDumpBasicOp (
>       ACPI_PARSE_OBJECT       *Op,
>       UINT32                  Level);
>   
> +void *
> +UtGetParentMethod (
> +    ACPI_NAMESPACE_NODE     *Node);
> +
> +BOOLEAN
> +UtNodeIsDescendantOf (
> +    ACPI_NAMESPACE_NODE     *Node1,
> +    ACPI_NAMESPACE_NODE     *Node2);
> +
>   void
>   UtDisplaySupportedTables (
>       void);
> diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
> index af65a453..93c51fae 100644
> --- a/src/acpica/source/compiler/aslglobal.h
> +++ b/src/acpica/source/compiler/aslglobal.h
> @@ -220,7 +220,8 @@ const char                          *Gbl_OpFlagNames[ACPI_NUM_OP_FLAGS] =
>       "OP_COMPILER_EMITTED",
>       "OP_IS_DUPLICATE",
>       "OP_IS_RESOURCE_DATA",
> -    "OP_IS_NULL_RETURN"
> +    "OP_IS_NULL_RETURN",
> +    "OP_NOT_FOUND_DURING_LOAD"
>   };
>   
>   #else
> diff --git a/src/acpica/source/compiler/aslhex.c b/src/acpica/source/compiler/aslhex.c
> index fe2d58ad..c1e3c761 100644
> --- a/src/acpica/source/compiler/aslhex.c
> +++ b/src/acpica/source/compiler/aslhex.c
> @@ -150,6 +150,7 @@
>    *****************************************************************************/
>   
>   #include "aslcompiler.h"
> +#include "acapps.h"
>   
>   #define _COMPONENT          ACPI_COMPILER
>           ACPI_MODULE_NAME    ("ashex")
> @@ -265,6 +266,9 @@ HxReadAmlOutputFile (
>    *              output file, but formatted into hex/ascii bytes suitable for
>    *              inclusion into a C source file.
>    *
> + *              Note: the base name of the hex output file is prepended to
> + *              all symbols as they are output to the file.
> + *
>    ******************************************************************************/
>   
>   static void
> @@ -276,17 +280,29 @@ HxDoHexOutputC (
>       UINT32                  Offset = 0;
>       UINT32                  AmlFileSize;
>       UINT32                  i;
> +    char                    *FileBasename;
> +
>   
> +    /* Obtain the file basename (filename with no extension) */
> +
> +    FileBasename = FlGetFileBasename (Gbl_Files [ASL_FILE_HEX_OUTPUT].Filename);
>   
>       /* Get AML size, seek back to start */
>   
>       AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
>       FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
>   
> +    /* Finish the file header and emit the non-data symbols */
> +
>       FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
>       FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
>           AmlFileSize);
> -    FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
> +
> +    FlPrintFile (ASL_FILE_HEX_OUTPUT, "#ifndef __%s_HEX__\n", FileBasename);
> +    FlPrintFile (ASL_FILE_HEX_OUTPUT, "#define __%s_HEX__\n\n", FileBasename);
> +
> +    AcpiUtStrlwr (FileBasename);
> +    FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char %s_aml_code[] =\n{\n", FileBasename);
>   
>       while (Offset < AmlFileSize)
>       {
> @@ -303,7 +319,7 @@ HxDoHexOutputC (
>           for (i = 0; i < LineLength; i++)
>           {
>               /*
> -             * Print each hex byte.
> +             * Output each hex byte in the form: "0xnn,"
>                * Add a comma until the very last byte of the AML file
>                * (Some C compilers complain about a trailing comma)
>                */
> @@ -337,7 +353,8 @@ HxDoHexOutputC (
>           Offset += LineLength;
>       }
>   
> -    FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
> +    FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n\n");
> +    FlPrintFile (ASL_FILE_HEX_OUTPUT, "#endif\n");
>   }
>   
>   
> diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
> index f32a7461..4082b388 100644
> --- a/src/acpica/source/compiler/aslload.c
> +++ b/src/acpica/source/compiler/aslload.c
> @@ -153,9 +153,10 @@
>   #include "amlcode.h"
>   #include "acdispat.h"
>   #include "acnamesp.h"
> -
> +#include "acparser.h"
>   #include "aslcompiler.y.h"
>   
> +
>   #define _COMPONENT          ACPI_COMPILER
>           ACPI_MODULE_NAME    ("aslload")
>   
> @@ -470,9 +471,13 @@ LdNamespace1Begin (
>       UINT32                  i;
>       BOOLEAN                 ForceNewScope = FALSE;
>       ACPI_OWNER_ID           OwnerId = 0;
> +    const ACPI_OPCODE_INFO  *OpInfo;
> +    ACPI_PARSE_OBJECT       *ParentOp;
>   
>   
>       ACPI_FUNCTION_NAME (LdNamespace1Begin);
> +
> +
>       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
>           Op, Op->Asl.ParseOpName));
>   
> @@ -548,6 +553,69 @@ LdNamespace1Begin (
>           return (AE_OK);
>       }
>   
> +    /* Check for a possible illegal forward reference */
> +
> +    if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
> +        (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
> +    {
> +        /*
> +         * Op->Asl.Namepath will be NULL for these opcodes.
> +         * These opcodes are guaranteed to have a parent.
> +         * Examine the parent opcode.
> +         */
> +        Status = AE_OK;
> +        ParentOp = Op->Asl.Parent;
> +        OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode);
> +
> +        /*
> +         * Exclude all operators that actually declare a new name:
> +         *      Name (ABCD, 1) -> Ignore (AML_CLASS_NAMED_OBJECT)
> +         * We only want references to named objects:
> +         *      Store (2, WXYZ) -> Attempt to resolve the name
> +         */
> +        if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
> +        {
> +            return (AE_OK);
> +        }
> +
> +        /*
> +         * Check if the referenced object exists at this point during
> +         * the load:
> +         * 1) If it exists, then this cannot be a forward reference.
> +         * 2) If it does not exist, it could be a forward reference or
> +         * it truly does not exist (and no external declaration).
> +         */
> +        Status = AcpiNsLookup (WalkState->ScopeInfo,
> +            Op->Asl.Value.Name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
> +            ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
> +            WalkState, &Node);
> +        if (Status == AE_NOT_FOUND)
> +        {
> +            /*
> +             * This is either a foward reference or the object truly
> +             * does not exist. The two cases can only be differentiated
> +             * during the cross-reference stage later. Mark the Op/Name
> +             * as not-found for now to indicate the need for further
> +             * processing.
> +             *
> +             * Special case: Allow forward references from elements of
> +             * Package objects. This provides compatibility with other
> +             * ACPI implementations. To correctly implement this, the
> +             * ACPICA table load defers package resolution until the entire
> +             * namespace has been loaded.
> +             */
> +            if ((ParentOp->Asl.ParseOpcode != PARSEOP_PACKAGE) &&
> +                (ParentOp->Asl.ParseOpcode != PARSEOP_VAR_PACKAGE))
> +            {
> +                Op->Asl.CompileFlags |= OP_NOT_FOUND_DURING_LOAD;
> +            }
> +
> +            return (AE_OK);
> +        }
> +
> +        return (Status);
> +    }
> +
>       Path = Op->Asl.Namepath;
>       if (!Path)
>       {
> @@ -584,7 +652,6 @@ LdNamespace1Begin (
>           }
>           break;
>   
> -
>       case PARSEOP_EXTERNAL:
>           /*
>            * "External" simply enters a name and type into the namespace.
> @@ -766,7 +833,6 @@ LdNamespace1Begin (
>           Status = AE_OK;
>           goto FinishNode;
>   
> -
>       default:
>   
>           ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
> diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
> index e816b538..7f5cde73 100644
> --- a/src/acpica/source/compiler/aslmessages.c
> +++ b/src/acpica/source/compiler/aslmessages.c
> @@ -342,8 +342,8 @@ const char                      *AslCompilerMsgs [] =
>   /*    ASL_MSG_RANGE */                      "Constant out of range",
>   /*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
>   /*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
> -/*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference within a method",
> -/*    ASL_MSG_ILLEGAL_METHOD_REF */         "Illegal reference across two methods",
> +/*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference",
> +/*    ASL_MSG_ILLEGAL_METHOD_REF */         "Object is declared in a different method",
>   /*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
>   /*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
>   /*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
> @@ -354,7 +354,9 @@ const char                      *AslCompilerMsgs [] =
>   /*    ASL_MSG_FOUND_HERE */                 "Original name creation/declaration below: ",
>   /*    ASL_MSG_ILLEGAL_RECURSION */          "Illegal recursive call to method that creates named objects",
>   /*    ASL_MSG_EXTERN_COLLISION */           "A name cannot be defined and declared external in the same table",
> -/*    ASL_MSG_FOUND_HERE_EXTERN*/           "Remove one of the declarations indicated above or below:"
> +/*    ASL_MSG_FOUND_HERE_EXTERN */          "Remove one of the declarations indicated above or below:",
> +/*    ASL_MSG_OEM_TABLE_ID */               "Invalid OEM Table ID",
> +/*    ASL_MSG_OEM_ID */                     "Invalid OEM ID"
>   };
>   
>   /* Table compiler */
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 3105f0be..18e81445 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -357,6 +357,8 @@ typedef enum
>       ASL_MSG_ILLEGAL_RECURSION,
>       ASL_MSG_EXTERN_COLLISION,
>       ASL_MSG_EXTERN_FOUND_HERE,
> +    ASL_MSG_OEM_TABLE_ID,
> +    ASL_MSG_OEM_ID,
>   
>       /* These messages are used by the Data Table compiler only */
>   
> diff --git a/src/acpica/source/compiler/asloperands.c b/src/acpica/source/compiler/asloperands.c
> index fc0eb0b8..1d1a1a94 100644
> --- a/src/acpica/source/compiler/asloperands.c
> +++ b/src/acpica/source/compiler/asloperands.c
> @@ -1061,7 +1061,7 @@ OpnDoDefinitionBlock (
>           if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE)
>           {
>               AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
> -                "Length is not exactly 4");
> +                "Length must be exactly 4 characters");
>           }
>   
>           for (i = 0; i < ACPI_NAME_SIZE; i++)
> @@ -1078,6 +1078,7 @@ OpnDoDefinitionBlock (
>   
>       Child = Child->Asl.Next;
>       Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
> +
>       /*
>        * We used the revision to set the integer width earlier
>        */
> @@ -1086,6 +1087,12 @@ OpnDoDefinitionBlock (
>   
>       Child = Child->Asl.Next;
>       Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
> +    if (Child->Asl.Value.String &&
> +        strlen (Child->Asl.Value.String) > ACPI_OEM_ID_SIZE)
> +    {
> +        AslError (ASL_ERROR, ASL_MSG_OEM_ID, Child,
> +            "Length cannot exceed 6 characters");
> +    }
>   
>       /* OEM TableID */
>   
> @@ -1094,6 +1101,12 @@ OpnDoDefinitionBlock (
>       if (Child->Asl.Value.String)
>       {
>           Length = strlen (Child->Asl.Value.String);
> +        if (Length > ACPI_OEM_TABLE_ID_SIZE)
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_OEM_TABLE_ID, Child,
> +                "Length cannot exceed 8 characters");
> +        }
> +
>           Gbl_TableId = UtLocalCacheCalloc (Length + 1);
>           strcpy (Gbl_TableId, Child->Asl.Value.String);
>   
> diff --git a/src/acpica/source/compiler/asltypes.h b/src/acpica/source/compiler/asltypes.h
> index 645d00c1..f87358d0 100644
> --- a/src/acpica/source/compiler/asltypes.h
> +++ b/src/acpica/source/compiler/asltypes.h
> @@ -183,8 +183,9 @@
>   #define OP_IS_DUPLICATE             0x00040000
>   #define OP_IS_RESOURCE_DATA         0x00080000
>   #define OP_IS_NULL_RETURN           0x00100000
> +#define OP_NOT_FOUND_DURING_LOAD    0x00200000
>   
> -#define ACPI_NUM_OP_FLAGS           0x21
> +#define ACPI_NUM_OP_FLAGS           0x22
>   
>   /* Keeps information about individual control methods */
>   
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 719ee874..16ef1f47 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -236,6 +236,97 @@ UtQueryForOverwrite (
>   }
>   
>   
> +/*******************************************************************************
> + *
> + * FUNCTION:    UtNodeIsDescendantOf
> + *
> + * PARAMETERS:  Node1                   - Child node
> + *              Node2                   - Possible parent node
> + *
> + * RETURN:      Boolean
> + *
> + * DESCRIPTION: Returns TRUE if Node1 is a descendant of Node2. Otherwise,
> + *              return FALSE. Note, we assume a NULL Node2 element to be the
> + *              topmost (root) scope. All nodes are descendants of the root.
> + *              Note: Nodes at the same level (siblings) are not considered
> + *              descendants.
> + *
> + ******************************************************************************/
> +
> +BOOLEAN
> +UtNodeIsDescendantOf (
> +    ACPI_NAMESPACE_NODE     *Node1,
> +    ACPI_NAMESPACE_NODE     *Node2)
> +{
> +
> +    if (Node1 == Node2)
> +    {
> +        return (FALSE);
> +    }
> +
> +    if (!Node2)
> +    {
> +        return (TRUE); /* All nodes descend from the root */
> +    }
> +
> +    /* Walk upward until the root is reached or parent is found */
> +
> +    while (Node1)
> +    {
> +        if (Node1 == Node2)
> +        {
> +            return (TRUE);
> +        }
> +
> +        Node1 = Node1->Parent;
> +    }
> +
> +    return (FALSE);
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    UtGetParentMethod
> + *
> + * PARAMETERS:  Node                    - Namespace node for any object
> + *
> + * RETURN:      Namespace node for the parent method
> + *              NULL - object is not within a method
> + *
> + * DESCRIPTION: Find the parent (owning) method node for a namespace object
> + *
> + ******************************************************************************/
> +
> +void *
> +UtGetParentMethod (
> +    ACPI_NAMESPACE_NODE     *Node)
> +{
> +    ACPI_NAMESPACE_NODE     *ParentNode;
> +
> +
> +    if (!Node)
> +    {
> +        return (NULL);
> +    }
> +
> +    /* Walk upward until a method is found, or the root is reached */
> +
> +    ParentNode = Node->Parent;
> +    while (ParentNode)
> +    {
> +        if (ParentNode->Type == ACPI_TYPE_METHOD)
> +        {
> +            return (ParentNode);
> +        }
> +
> +        ParentNode = ParentNode->Parent;
> +    }
> +
> +    return (NULL); /* Object is not within a control method */
> +}
> +
> +
>   /*******************************************************************************
>    *
>    * FUNCTION:    UtDisplaySupportedTables
> diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c
> index 94cf15bb..c34ab49c 100644
> --- a/src/acpica/source/compiler/aslxref.c
> +++ b/src/acpica/source/compiler/aslxref.c
> @@ -197,22 +197,6 @@ XfCheckFieldRange (
>       UINT32                  FieldBitLength,
>       UINT32                  AccessBitWidth);
>   
> -#ifdef __UNDER_DEVELOPMENT
> -static ACPI_PARSE_OBJECT *
> -XfGetParentMethod (
> -    ACPI_PARSE_OBJECT       *Op);
> -
> -static void
> -XfCheckIllegalReference (
> -    ACPI_PARSE_OBJECT       *Op,
> -    ACPI_NAMESPACE_NODE     *Node);
> -
> -static BOOLEAN
> -XfIsObjectParental (
> -    ACPI_PARSE_OBJECT       *MethodOp1,
> -    ACPI_PARSE_OBJECT       *MethodOp2);
> -#endif
> -
>   
>   /*******************************************************************************
>    *
> @@ -702,7 +686,7 @@ XfNamespaceLocateBegin (
>       Gbl_NsLookupCount++;
>   
>       Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
> -        ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
> +        ACPI_IMODE_EXECUTE, Flags, WalkState, &Node);
>       if (ACPI_FAILURE (Status))
>       {
>           if (Status == AE_NOT_FOUND)
> @@ -760,6 +744,26 @@ XfNamespaceLocateBegin (
>           return_ACPI_STATUS (Status);
>       }
>   
> +    /* Object was found above, check for an illegal forward reference */
> +
> +    if (Op->Asl.CompileFlags & OP_NOT_FOUND_DURING_LOAD)
> +    {
> +        /*
> +         * During the load phase, this Op was flagged as a possible
> +         * illegal forward reference
> +         *
> +         * Note: Allow "forward references" from within a method to an
> +         * object that is not within any method (module-level code)
> +         */
> +        if (!WalkState->ScopeInfo || (UtGetParentMethod (Node) &&
> +            !UtNodeIsDescendantOf (WalkState->ScopeInfo->Scope.Node,
> +                UtGetParentMethod (Node))))
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
> +                Op->Asl.ExternalName);
> +        }
> +    }
> +
>       /* Check for a reference vs. name declaration */
>   
>       if (!(OpInfo->Flags & AML_NAMED) &&
> @@ -768,13 +772,6 @@ XfNamespaceLocateBegin (
>           /* This node has been referenced, mark it for reference check */
>   
>           Node->Flags |= ANOBJ_IS_REFERENCED;
> -
> -#ifdef __UNDER_DEVELOPMENT
> -
> -        /* Check for an illegal reference */
> -
> -        XfCheckIllegalReference (Op, Node);
> -#endif
>       }
>   
>       /* Attempt to optimize the NamePath */
> @@ -1205,178 +1202,3 @@ XfNamespaceLocateEnd (
>   
>       return_ACPI_STATUS (AE_OK);
>   }
> -
> -
> -#ifdef __UNDER_DEVELOPMENT
> -/*******************************************************************************
> - *
> - * FUNCTION:    XfIsObjectParental
> - *
> - * PARAMETERS:  ChildOp                 - Op to be checked
> - *              PossibleParentOp        - Determine if this op is in the family
> - *
> - * RETURN:      TRUE if ChildOp is a descendent of PossibleParentOp
> - *
> - * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to
> - *              detect if a method is declared within another method.
> - *
> - ******************************************************************************/
> -
> -static BOOLEAN
> -XfIsObjectParental (
> -    ACPI_PARSE_OBJECT       *ChildOp,
> -    ACPI_PARSE_OBJECT       *PossibleParentOp)
> -{
> -    ACPI_PARSE_OBJECT       *ParentOp;
> -
> -
> -    /* Search upwards through the tree for possible parent */
> -
> -    ParentOp = ChildOp;
> -    while (ParentOp)
> -    {
> -        if (ParentOp == PossibleParentOp)
> -        {
> -            return (TRUE);
> -        }
> -
> -        ParentOp = ParentOp->Asl.Parent;
> -    }
> -
> -    return (FALSE);
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    XfGetParentMethod
> - *
> - * PARAMETERS:  Op                      - Op to be checked
> - *
> - * RETURN:      Op for parent method. NULL if object is not within a method.
> - *
> - * DESCRIPTION: Determine if an object is within a control method. Used to
> - *              implement special rules for named references from within a
> - *              control method.
> - *
> - * NOTE: It would be better to have the parser set a flag in the Op if possible.
> - *
> - ******************************************************************************/
> -
> -static ACPI_PARSE_OBJECT *
> -XfGetParentMethod (
> -    ACPI_PARSE_OBJECT       *Op)
> -{
> -    ACPI_PARSE_OBJECT       *ParentOp;
> -
> -
> -    if (!Op)
> -    {
> -        return (NULL);
> -    }
> -
> -    if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
> -    {
> -        return (NULL);
> -    }
> -
> -    /* Walk upwards through the parse tree, up to the root if necessary */
> -
> -    ParentOp = Op;
> -    while (ParentOp)
> -    {
> -        if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD)
> -        {
> -            return (ParentOp);
> -        }
> -
> -        ParentOp = ParentOp->Asl.Parent;
> -    }
> -
> -    /* Object is not within a method */
> -
> -    return (NULL);
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION:    XfCheckIllegalReference
> - *
> - * PARAMETERS:  Op                      - Op referring to the target
> - *              TargetNode              - Target of the reference
> - *
> - * RETURN:      None. Emits error message for an illegal reference
> - *
> - * DESCRIPTION: Determine if a named reference is legal. A "named" reference
> - *              is something like: Store(ABCD, ...), where ABCD is an AML
> - *              Nameseg or Namepath.
> - *
> - * NOTE: Caller must ensure that the name Op is in fact a reference, and not
> - *       an actual name declaration (creation of a named object).
> - *
> - ******************************************************************************/
> -
> -static void
> -XfCheckIllegalReference (
> -    ACPI_PARSE_OBJECT       *Op,
> -    ACPI_NAMESPACE_NODE     *TargetNode)
> -{
> -    ACPI_PARSE_OBJECT       *MethodOp1;
> -    ACPI_PARSE_OBJECT       *MethodOp2;
> -    ACPI_PARSE_OBJECT       *TargetOp;
> -
> -
> -    /*
> -     * Check for an illegal reference to a named object:
> -     *
> -     * 1) References from one control method to another, non-parent
> -     *    method are not allowed, they will fail at runtime.
> -     *
> -     * 2) Forward references within a control method are not allowed.
> -     *    AML interpreters use a one-pass parse of control methods
> -     *    so these forward references will fail at runtime.
> -     */
> -    TargetOp = TargetNode->Op;
> -
> -    MethodOp1 = XfGetParentMethod (Op);
> -    MethodOp2 = XfGetParentMethod (TargetOp);
> -
> -    /* Are both objects within control method(s)? */
> -
> -    if (!MethodOp1 || !MethodOp2)
> -    {
> -        return;
> -    }
> -
> -    /* Objects not in the same method? */
> -
> -    if (MethodOp1 != MethodOp2)
> -    {
> -        /*
> -         * 1) Cross-method named reference
> -         *
> -         * This is OK if and only if the target reference is within in a
> -         * method that is a parent of current method
> -         */
> -        if (!XfIsObjectParental (MethodOp1, MethodOp2))
> -        {
> -            AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op,
> -                Op->Asl.ExternalName);
> -        }
> -    }
> -
> -    /*
> -     * 2) Both reference and target are in the same method. Check if this is
> -     * an (illegal) forward reference by examining the exact source code
> -     * location of each (the referenced object and the object declaration).
> -     * This is a bit nasty, yet effective.
> -     */
> -    else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset)
> -    {
> -        AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
> -            Op->Asl.ExternalName);
> -    }
> -
> -}
> -#endif
> diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
> index 49c40bcc..c151a3ef 100644
> --- a/src/acpica/source/components/debugger/dbnames.c
> +++ b/src/acpica/source/components/debugger/dbnames.c
> @@ -372,8 +372,17 @@ AcpiDbDumpNamespace (
>       }
>   
>       AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
> -    AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
> -        ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
> +
> +    if (((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Parent)
> +    {
> +        AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
> +            ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
> +    }
> +    else
> +    {
> +        AcpiOsPrintf ("ACPI Namespace (from %s):\n",
> +            ACPI_NAMESPACE_ROOT);
> +    }
>   
>       /* Display the subtree */
>   
> diff --git a/src/acpica/source/components/debugger/dbtest.c b/src/acpica/source/components/debugger/dbtest.c
> index 0969f9b0..04f93892 100644
> --- a/src/acpica/source/components/debugger/dbtest.c
> +++ b/src/acpica/source/components/debugger/dbtest.c
> @@ -188,6 +188,10 @@ AcpiDbTestStringType (
>       ACPI_NAMESPACE_NODE     *Node,
>       UINT32                  ByteLength);
>   
> +static ACPI_STATUS
> +AcpiDbTestPackageType (
> +    ACPI_NAMESPACE_NODE     *Node);
> +
>   static ACPI_STATUS
>   AcpiDbReadFromObject (
>       ACPI_NAMESPACE_NODE     *Node,
> @@ -456,6 +460,11 @@ AcpiDbTestOneObject (
>           BitLength = ByteLength * 8;
>           break;
>   
> +    case ACPI_TYPE_PACKAGE:
> +
> +        LocalType = ACPI_TYPE_PACKAGE;
> +        break;
> +
>       case ACPI_TYPE_FIELD_UNIT:
>       case ACPI_TYPE_BUFFER_FIELD:
>       case ACPI_TYPE_LOCAL_REGION_FIELD:
> @@ -490,6 +499,7 @@ AcpiDbTestOneObject (
>   
>       AcpiOsPrintf ("%14s: %4.4s",
>           AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);
> +
>       if (!ObjDesc)
>       {
>           AcpiOsPrintf (" Ignoring, no attached object\n");
> @@ -510,13 +520,12 @@ AcpiDbTestOneObject (
>           case ACPI_ADR_SPACE_SYSTEM_MEMORY:
>           case ACPI_ADR_SPACE_SYSTEM_IO:
>           case ACPI_ADR_SPACE_PCI_CONFIG:
> -        case ACPI_ADR_SPACE_EC:
>   
>               break;
>   
>           default:
>   
> -            AcpiOsPrintf ("      %s space is not supported [%4.4s]\n",
> +            AcpiOsPrintf ("      %s space is not supported in this command [%4.4s]\n",
>                   AcpiUtGetRegionName (RegionObj->Region.SpaceId),
>                   RegionObj->Region.Node->Name.Ascii);
>               return (AE_OK);
> @@ -546,6 +555,11 @@ AcpiDbTestOneObject (
>           Status = AcpiDbTestBufferType (Node, BitLength);
>           break;
>   
> +    case ACPI_TYPE_PACKAGE:
> +
> +        Status = AcpiDbTestPackageType (Node);
> +        break;
> +
>       default:
>   
>           AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)",
> @@ -553,6 +567,14 @@ AcpiDbTestOneObject (
>           break;
>       }
>   
> +    /* Exit on error, but don't abort the namespace walk */
> +
> +    if (ACPI_FAILURE (Status))
> +    {
> +        Status = AE_OK;
> +        goto Exit;
> +    }
> +
>       switch (Node->Type)
>       {
>       case ACPI_TYPE_LOCAL_REGION_FIELD:
> @@ -560,12 +582,14 @@ AcpiDbTestOneObject (
>           RegionObj = ObjDesc->Field.RegionObj;
>           AcpiOsPrintf (" (%s)",
>               AcpiUtGetRegionName (RegionObj->Region.SpaceId));
> +
>           break;
>   
>       default:
>           break;
>       }
>   
> +Exit:
>       AcpiOsPrintf ("\n");
>       return (Status);
>   }
> @@ -624,7 +648,6 @@ AcpiDbTestIntegerType (
>       {
>           ValueToWrite = 0;
>       }
> -
>       /* Write a new value */
>   
>       WriteValue.Type = ACPI_TYPE_INTEGER;
> @@ -915,6 +938,40 @@ Exit:
>   }
>   
>   
> +/*******************************************************************************
> + *
> + * FUNCTION:    AcpiDbTestPackageType
> + *
> + * PARAMETERS:  Node                - Parent NS node for the object
> + *
> + * RETURN:      Status
> + *
> + * DESCRIPTION: Test read for a Package object.
> + *
> + ******************************************************************************/
> +
> +static ACPI_STATUS
> +AcpiDbTestPackageType (
> +    ACPI_NAMESPACE_NODE     *Node)
> +{
> +    ACPI_OBJECT             *Temp1 = NULL;
> +    ACPI_STATUS             Status;
> +
> +
> +    /* Read the original value */
> +
> +    Status = AcpiDbReadFromObject (Node, ACPI_TYPE_PACKAGE, &Temp1);
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (Status);
> +    }
> +
> +    AcpiOsPrintf (" %8.8X Elements", Temp1->Package.Count);
> +    AcpiOsFree (Temp1);
> +    return (Status);
> +}
> +
> +
>   /*******************************************************************************
>    *
>    * FUNCTION:    AcpiDbReadFromObject
> @@ -957,8 +1014,8 @@ AcpiDbReadFromObject (
>       AcpiGbl_MethodExecuting = TRUE;
>       Status = AcpiEvaluateObject (ReadHandle, NULL,
>           &ParamObjects, &ReturnObj);
> -    AcpiGbl_MethodExecuting = FALSE;
>   
> +    AcpiGbl_MethodExecuting = FALSE;
>       if (ACPI_FAILURE (Status))
>       {
>           AcpiOsPrintf ("Could not read from object, %s",
> @@ -973,6 +1030,7 @@ AcpiDbReadFromObject (
>       case ACPI_TYPE_INTEGER:
>       case ACPI_TYPE_BUFFER:
>       case ACPI_TYPE_STRING:
> +    case ACPI_TYPE_PACKAGE:
>           /*
>            * Did we receive the type we wanted? Most important for the
>            * Integer/Buffer case (when a field is larger than an Integer,
> @@ -984,6 +1042,7 @@ AcpiDbReadFromObject (
>                   AcpiUtGetTypeName (ExpectedType),
>                   AcpiUtGetTypeName (RetValue->Type));
>   
> +            AcpiOsFree (ReturnObj.Pointer);
>               return (AE_TYPE);
>           }
>   
> diff --git a/src/acpica/source/components/dispatcher/dswscope.c b/src/acpica/source/components/dispatcher/dswscope.c
> index 3aa5e192..36ff8205 100644
> --- a/src/acpica/source/components/dispatcher/dswscope.c
> +++ b/src/acpica/source/components/dispatcher/dswscope.c
> @@ -269,8 +269,7 @@ AcpiDsScopeStackPush (
>       }
>       else
>       {
> -        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
> -            "[\\___] (%s)", "ROOT"));
> +        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_NAMESPACE_ROOT));
>       }
>   
>       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
> @@ -328,15 +327,13 @@ AcpiDsScopeStackPop (
>       NewScopeInfo = WalkState->ScopeInfo;
>       if (NewScopeInfo)
>       {
> -        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
> -            "[%4.4s] (%s)\n",
> +        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "[%4.4s] (%s)\n",
>               AcpiUtGetNodeName (NewScopeInfo->Scope.Node),
>               AcpiUtGetTypeName (NewScopeInfo->Common.Value)));
>       }
>       else
>       {
> -        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
> -            "[\\___] (ROOT)\n"));
> +        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%s\n", ACPI_NAMESPACE_ROOT));
>       }
>   
>       AcpiUtDeleteGenericState (ScopeInfo);
> diff --git a/src/acpica/source/components/resources/rsdump.c b/src/acpica/source/components/resources/rsdump.c
> index b36c38d4..6f3e2c9e 100644
> --- a/src/acpica/source/components/resources/rsdump.c
> +++ b/src/acpica/source/components/resources/rsdump.c
> @@ -768,7 +768,7 @@ AcpiRsDumpByteList (
>       UINT16                  Length,
>       UINT8                   *Data)
>   {
> -    UINT8                   i;
> +    UINT16                  i;
>   
>   
>       for (i = 0; i < Length; i++)
> diff --git a/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c
> index 63944803..581737dd 100644
> --- a/src/acpica/source/components/tables/tbinstal.c
> +++ b/src/acpica/source/components/tables/tbinstal.c
> @@ -236,7 +236,7 @@ AcpiTbInstallTableWithOverride (
>    * DESCRIPTION: This function is called to verify and install an ACPI table.
>    *              When this function is called by "Load" or "LoadTable" opcodes,
>    *              or by AcpiLoadTable() API, the "Reload" parameter is set.
> - *              After sucessfully returning from this function, table is
> + *              After successfully returning from this function, table is
>    *              "INSTALLED" but not "VALIDATED".
>    *
>    ******************************************************************************/
> diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
> index 13f75c0b..6e4458af 100644
> --- a/src/acpica/source/components/utilities/utstring.c
> +++ b/src/acpica/source/components/utilities/utstring.c
> @@ -303,7 +303,7 @@ AcpiUtRepairName (
>        * Special case for the root node. This can happen if we get an
>        * error during the execution of module-level code.
>        */
> -    if (ACPI_COMPARE_NAME (Name, "\\___"))
> +    if (ACPI_COMPARE_NAME (Name, ACPI_ROOT_PATHNAME))
>       {
>           return;
>       }
> diff --git a/src/acpica/source/include/acapps.h b/src/acpica/source/include/acapps.h
> index 94a40187..dcaebd79 100644
> --- a/src/acpica/source/include/acapps.h
> +++ b/src/acpica/source/include/acapps.h
> @@ -324,6 +324,10 @@ FlSplitInputPathname (
>       char                    **OutDirectoryPath,
>       char                    **OutFilename);
>   
> +char *
> +FlGetFileBasename (
> +    char                    *FilePathname);
> +
>   char *
>   AdGenerateFilename (
>       char                    *Prefix,
> diff --git a/src/acpica/source/include/acnames.h b/src/acpica/source/include/acnames.h
> index 1f8adff0..506ff624 100644
> --- a/src/acpica/source/include/acnames.h
> +++ b/src/acpica/source/include/acnames.h
> @@ -191,11 +191,14 @@
>   /* Definitions of the predefined namespace names  */
>   
>   #define ACPI_UNKNOWN_NAME       (UINT32) 0x3F3F3F3F     /* Unknown name is "????" */
> -#define ACPI_ROOT_NAME          (UINT32) 0x5F5F5F5C     /* Root name is    "\___" */
> -
>   #define ACPI_PREFIX_MIXED       (UINT32) 0x69706341     /* "Acpi" */
>   #define ACPI_PREFIX_LOWER       (UINT32) 0x69706361     /* "acpi" */
>   
> +/* Root name stuff */
> +
> +#define ACPI_ROOT_NAME          (UINT32) 0x5F5F5F5C     /* Root name is    "\___" */
> +#define ACPI_ROOT_PATHNAME      "\\___"
> +#define ACPI_NAMESPACE_ROOT     "Namespace Root"
>   #define ACPI_NS_ROOT_PATH       "\\"
>   
>   #endif  /* __ACNAMES_H__  */
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index 0ba43049..2fee13a5 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                 0x20180313
> +#define ACPI_CA_VERSION                 0x20180427
>   
>   #include "acconfig.h"
>   #include "actypes.h"
> diff --git a/src/acpica/source/tools/acpiexec/aecommon.h b/src/acpica/source/tools/acpiexec/aecommon.h
> index 4f560a22..49a386be 100644
> --- a/src/acpica/source/tools/acpiexec/aecommon.h
> +++ b/src/acpica/source/tools/acpiexec/aecommon.h
> @@ -189,6 +189,7 @@ typedef struct ae_debug_regions
>   } AE_DEBUG_REGIONS;
>   
>   
> +extern BOOLEAN              AcpiGbl_UseLocalFaultHandler;
>   extern BOOLEAN              AcpiGbl_IgnoreErrors;
>   extern BOOLEAN              AcpiGbl_AbortLoopOnTimeout;
>   extern UINT8                AcpiGbl_RegionFillValue;
> diff --git a/src/acpica/source/tools/acpiexec/aeexception.c b/src/acpica/source/tools/acpiexec/aeexception.c
> index b5bb4aec..2f5bfb22 100644
> --- a/src/acpica/source/tools/acpiexec/aeexception.c
> +++ b/src/acpica/source/tools/acpiexec/aeexception.c
> @@ -199,9 +199,16 @@ AeExceptionHandler (
>   
>       if (Name)
>       {
> -        AcpiOsPrintf (AE_PREFIX
> -            "Evaluating Method or Node: [%4.4s]\n",
> -            (char *) &Name);
> +        if (ACPI_COMPARE_NAME (&Name, ACPI_ROOT_PATHNAME))
> +        {
> +            AcpiOsPrintf (AE_PREFIX
> +                "Evaluating executable code at [%s]\n", ACPI_NAMESPACE_ROOT);
> +        }
> +        else
> +        {
> +            AcpiOsPrintf (AE_PREFIX
> +                "Evaluating Method or Node: [%4.4s]\n", (char *) &Name);
> +        }
>       }
>   
>       /* Be terse about loop timeouts */
> 

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



More information about the fwts-devel mailing list