[PATCH] ACPICA: Update to version 20191213

Colin King colin.king at canonical.com
Fri Dec 13 20:26:23 UTC 2019


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/hyperkitty/list/devel@acpica.org/thread/77GOY6VXDWVVCSS3KLPCLRFVWIKYKTI3/

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpica/source/common/dmtables.c           |   3 +-
 src/acpica/source/compiler/aslcompile.c       |  39 ++--
 src/acpica/source/compiler/asldefine.h        |  10 +-
 src/acpica/source/compiler/aslerror.c         |  45 ++--
 src/acpica/source/compiler/aslfiles.c         |  18 +-
 src/acpica/source/compiler/aslload.c          |  15 +-
 src/acpica/source/compiler/aslmessages.c      |   4 +-
 src/acpica/source/compiler/aslmessages.h      |   2 +
 src/acpica/source/compiler/asloptions.c       |   2 +-
 src/acpica/source/compiler/aslstartup.c       |   4 -
 src/acpica/source/compiler/asltransform.c     | 204 +++++++++++++++++-
 src/acpica/source/compiler/aslutils.c         |   5 -
 src/acpica/source/compiler/aslxref.c          |  31 ++-
 src/acpica/source/compiler/dtcompile.c        |  17 +-
 src/acpica/source/compiler/dtcompiler.h       |   1 -
 .../source/components/debugger/dbconvert.c    |   4 -
 .../source/components/debugger/dbnames.c      |   1 -
 .../source/components/dispatcher/dsfield.c    |   2 +-
 .../source/components/dispatcher/dsopcode.c   |   1 +
 .../source/components/dispatcher/dswload.c    |  22 ++
 .../source/components/executer/exfield.c      |  10 +-
 .../source/components/hardware/hwxfsleep.c    |   2 +-
 .../source/components/utilities/utids.c       |   3 +-
 src/acpica/source/include/acobject.h          |   1 +
 src/acpica/source/include/acpixf.h            |   2 +-
 src/acpica/source/include/platform/acenv.h    |  15 ++
 26 files changed, 374 insertions(+), 89 deletions(-)

diff --git a/src/acpica/source/common/dmtables.c b/src/acpica/source/common/dmtables.c
index e5536ecf..2c779494 100644
--- a/src/acpica/source/common/dmtables.c
+++ b/src/acpica/source/common/dmtables.c
@@ -508,6 +508,8 @@ AdParseTable (
     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
     ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
 
+    AcpiUtSetIntegerWidth (Table->Revision);
+
     /* Create the root object */
 
     AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
@@ -543,7 +545,6 @@ AdParseTable (
     }
 
     WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
 
     Status = AcpiPsParseAml (WalkState);
     if (ACPI_FAILURE (Status))
diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
index 9214cfdf..ce60b2da 100644
--- a/src/acpica/source/compiler/aslcompile.c
+++ b/src/acpica/source/compiler/aslcompile.c
@@ -220,6 +220,7 @@ CmDoCompile (
         PrDoPreprocess ();
         AslGbl_CurrentLineNumber = 1;
         AslGbl_LogicalLineNumber = 1;
+        AslGbl_CurrentLineOffset = 0;
 
         if (AslGbl_PreprocessOnly)
         {
@@ -282,25 +283,6 @@ CmDoCompile (
 
     LsDumpParseTree ();
 
-    OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
-    UtEndEvent (Event);
-
-    /* Pre-process parse tree for any operator transforms */
-
-    Event = UtBeginEvent ("Parse tree transforms");
-    DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
-    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
-        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
-    UtEndEvent (Event);
-
-    /* Generate AML opcodes corresponding to the parse tokens */
-
-    Event = UtBeginEvent ("Generate AML opcodes");
-    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
-    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
-        OpcAmlOpcodeWalk, NULL);
-    UtEndEvent (Event);
-
     UtEndEvent (FullCompile);
     return (AE_OK);
 
@@ -331,6 +313,25 @@ CmDoAslMiddleAndBackEnd (
     ACPI_STATUS             Status;
 
 
+    OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
+
+    /* Pre-process parse tree for any operator transforms */
+
+    Event = UtBeginEvent ("Parse tree transforms");
+    DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
+    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
+    UtEndEvent (Event);
+
+    /* Generate AML opcodes corresponding to the parse tokens */
+
+    Event = UtBeginEvent ("Generate AML opcodes");
+    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
+    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+        NULL, OpcAmlOpcodeWalk, NULL);
+    UtEndEvent (Event);
+
+
     /* Interpret and generate all compile-time constants */
 
     Event = UtBeginEvent ("Constant folding via AML interpreter");
diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h
index 0ba08962..675a5870 100644
--- a/src/acpica/source/compiler/asldefine.h
+++ b/src/acpica/source/compiler/asldefine.h
@@ -222,11 +222,11 @@
 
 /* Misc */
 
-#define ASL_EXTERNAL_METHOD         255
-#define ASL_ABORT                   TRUE
-#define ASL_NO_ABORT                FALSE
-#define ASL_EOF                     ACPI_UINT32_MAX
-#define ASL_IGNORE_LINE            (ACPI_UINT32_MAX -1)
+#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS  255
+#define ASL_ABORT                           TRUE
+#define ASL_NO_ABORT                        FALSE
+#define ASL_EOF                             ACPI_UINT32_MAX
+#define ASL_IGNORE_LINE                     (ACPI_UINT32_MAX -1)
 
 
 /* Listings */
diff --git a/src/acpica/source/compiler/aslerror.c b/src/acpica/source/compiler/aslerror.c
index ae1f38ac..f6eab921 100644
--- a/src/acpica/source/compiler/aslerror.c
+++ b/src/acpica/source/compiler/aslerror.c
@@ -335,7 +335,7 @@ AeAddToErrorLog (
  * PARAMETERS:  OutputFile      - Output file
  *              Enode           - Error node to print
  *              PrematureEOF    - True = PrematureEOF has been reached
- *              Total           - Total legth of line
+ *              Total           - Total length of line
  *
  * RETURN:      None
  *
@@ -445,7 +445,7 @@ AeDecodeErrorMessageId (
  * PARAMETERS:  OutputFile      - Output file
  *              Enode           - Error node to print
  *              PrematureEOF    - True = PrematureEOF has been reached
- *              Total           - amount of characters printed so far
+ *              Total           - Number of characters printed so far
  *
  *
  * RETURN:      Status
@@ -527,6 +527,7 @@ AePrintErrorSourceLine (
                 fprintf (OutputFile, "\n");
                 return AE_OK;
             }
+
             /*
              * Seek to the offset in the combined source file,
              * read the source line, and write it to the output.
@@ -550,7 +551,8 @@ AePrintErrorSourceLine (
                     AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
                 return AE_IO_ERROR;
             }
-                /* Read/write the source line, up to the maximum line length */
+
+            /* Read/write the source line, up to the maximum line length */
 
             while (RActual && SourceByte && (SourceByte != '\n'))
             {
@@ -732,7 +734,7 @@ AePrintException (
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print the contents of an error nodes. This function is tailored
+ * DESCRIPTION: Print the contents of an error node. This function is tailored
  *              to print error nodes that are SubErrors within ASL_ERROR_MSG
  *
  ******************************************************************************/
@@ -795,8 +797,8 @@ AePrintErrorLog (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *              SourceLine          - Line of error source code
  *              SubError            - SubError of this InputEnode
  *
@@ -863,10 +865,17 @@ static void AslInitEnode (
             Enode->FilenameLength = 6;
         }
 
-        FileNode = FlGetCurrentFileNode ();
+        /*
+         * Attempt to get the file node of the filename listed in the parse
+         * node. If the name doesn't exist in the global file node, it is
+         * because the file is included by #include or ASL include. In this
+         * case, get the current file node. The source output of the current
+         * file will contain the contents of the file listed in the parse node.
+         */
+        FileNode = FlGetFileNode (ASL_FILE_INPUT, Filename);
         if (!FileNode)
         {
-            return;
+            FileNode = FlGetCurrentFileNode ();
         }
 
         Enode->SourceFilename =
@@ -884,8 +893,8 @@ static void AslInitEnode (
  *              LineNumber          - Actual file line number
  *              Column              - Column in current line
  *              SourceLine          - Actual source code line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -918,8 +927,8 @@ AslCommonError2 (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -961,8 +970,8 @@ AslCommonError (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              Message             - additional error message
+ *              Filename            - Source filename
+ *              Message             - Additional error message
  *              SourceLine          - Actual line of source code
  *              SubError            - Sub-error associated with this error
  *
@@ -1025,7 +1034,7 @@ AslLogNewError (
  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
  *              MessageId       - Index into global message buffer
  *
- * RETURN:      UINT8           - modified level
+ * RETURN:      UINT8           - Modified level
  *
  * DESCRIPTION: Get the modified level of exception codes that are reported as
  *              errors from the -ww option.
@@ -1369,7 +1378,7 @@ AslIsExceptionDisabled (
  *              MainMsg         - Message pertaining to the MainOp
  *              SubMsgId        - Index into global message buffer
  *              SubOp           - Additional parse node for better message
- *              SubMsg          - Message pertainint to SubOp
+ *              SubMsg          - Message pertaining to SubOp
  *
  *
  * RETURN:      None
@@ -1421,7 +1430,7 @@ AslDualParseOpError (
  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
  *              MessageId           - Index into global message buffer
  *              Op                  - Parse node where error happened
- *              ExtraMessage        - additional error message
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -1459,7 +1468,7 @@ AslError (
  *
  * PARAMETERS:  Op                  - Parse node where error happened
  *              Status              - The ACPICA Exception
- *              ExtraMessage        - additional error message
+ *              ExtraMessage        - Additional error message
  *              Abort               - TRUE -> Abort compilation
  *
  * RETURN:      None
diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c
index 23acc470..dba05d35 100644
--- a/src/acpica/source/compiler/aslfiles.c
+++ b/src/acpica/source/compiler/aslfiles.c
@@ -414,8 +414,22 @@ ASL_GLOBAL_FILE_NODE *
 FlGetCurrentFileNode (
     void)
 {
-    return (FlGetFileNode (
-        ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename));
+    ASL_GLOBAL_FILE_NODE    *FileNode =
+        FlGetFileNode (ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename);
+
+
+    if (!FileNode)
+    {
+        /*
+         * If the current file node does not exist after initializing the file
+         * node structures, something went wrong and this is an unrecoverable
+         * condition.
+         */
+        FlFileError (ASL_FILE_INPUT, ASL_MSG_COMPILER_INTERNAL);
+        AslAbort ();
+    }
+
+    return (FileNode);
 }
 
 
diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
index db6c2d41..6e3d7e7d 100644
--- a/src/acpica/source/compiler/aslload.c
+++ b/src/acpica/source/compiler/aslload.c
@@ -357,7 +357,7 @@ LdLoadFieldElements (
                      * The name already exists in this scope
                      * But continue processing the elements
                      */
-                    AslDualParseOpError (ASL_WARNING, ASL_MSG_NAME_EXISTS, Child,
+                    AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
                         Child->Asl.Value.String, ASL_MSG_FOUND_HERE, Node->Op,
                         Node->Op->Asl.ExternalName);
                 }
@@ -986,12 +986,19 @@ FinishNode:
     Op->Asl.Node = Node;
     Node->Op = Op;
 
-    /* Set the actual data type if appropriate (EXTERNAL term only) */
-
+    /*
+     * Set the actual data type if appropriate (EXTERNAL term only)
+     * As of 11/19/2019, ASL External() does not support parameter
+     * counts. When an External method is loaded, the parameter count is
+     * unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS
+     * indicates that the parameter count for this method is unknown.
+     * This information is used in ASL cross reference to help determine the
+     * parameter count through method calls.
+     */
     if (ActualObjectType != ACPI_TYPE_ANY)
     {
         Node->Type = (UINT8) ActualObjectType;
-        Node->Value = ASL_EXTERNAL_METHOD;
+        Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
     }
 
     if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
index d1329352..ea118c0d 100644
--- a/src/acpica/source/compiler/aslmessages.c
+++ b/src/acpica/source/compiler/aslmessages.c
@@ -368,7 +368,9 @@ const char                      *AslCompilerMsgs [] =
 /*    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",
 /*    ASL_MSG_INVALID_PROCESSOR_UID */      "_UID inside processor declaration must be an integer",
-/*    ASL_MSG_LEGACY_PROCESSOR_OP */        "Legacy Processor() keyword detected. Use Device() keyword instead."
+/*    ASL_MSG_LEGACY_PROCESSOR_OP */        "Legacy Processor() keyword detected. Use Device() keyword instead.",
+/*    ASL_MSG_NAMESTRING_LENGTH */          "NameString contains too many NameSegs (>255)",
+/*    ASL_MSG_CASE_FOUND_HERE */            "Original Case value below:"
 };
 
 /* Table compiler */
diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
index 47e5bf43..385b730f 100644
--- a/src/acpica/source/compiler/aslmessages.h
+++ b/src/acpica/source/compiler/aslmessages.h
@@ -371,6 +371,8 @@ typedef enum
     ASL_MSG_INVALID_SPECIAL_NAME,
     ASL_MSG_INVALID_PROCESSOR_UID,
     ASL_MSG_LEGACY_PROCESSOR_OP,
+    ASL_MSG_NAMESTRING_LENGTH,
+    ASL_MSG_CASE_FOUND_HERE,
 
     /* These messages are used by the Data Table compiler only */
 
diff --git a/src/acpica/source/compiler/asloptions.c b/src/acpica/source/compiler/asloptions.c
index 7c178149..7758610c 100644
--- a/src/acpica/source/compiler/asloptions.c
+++ b/src/acpica/source/compiler/asloptions.c
@@ -219,7 +219,7 @@ AslCommandLine (
         {
             exit (-1);
         }
-        exit (1);
+        exit (0);
     }
 
     /* Next parameter must be the input filename */
diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c
index c43c1a97..73c555a6 100644
--- a/src/acpica/source/compiler/aslstartup.c
+++ b/src/acpica/source/compiler/aslstartup.c
@@ -457,10 +457,6 @@ AslDoOneFile (
     }
 
     FileNode = FlGetCurrentFileNode();
-    if (!FileNode)
-    {
-        return (AE_ERROR);
-    }
 
     FileNode->OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
 
diff --git a/src/acpica/source/compiler/asltransform.c b/src/acpica/source/compiler/asltransform.c
index 7dc642d8..c80afe3a 100644
--- a/src/acpica/source/compiler/asltransform.c
+++ b/src/acpica/source/compiler/asltransform.c
@@ -151,6 +151,7 @@
 
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("asltransform")
@@ -194,6 +195,16 @@ static void
 TrDoSwitch (
     ACPI_PARSE_OBJECT       *StartNode);
 
+static void
+TrCheckForDuplicateCase (
+    ACPI_PARSE_OBJECT       *CaseOp,
+    ACPI_PARSE_OBJECT       *Predicate1);
+
+static BOOLEAN
+TrCheckForBufferMatch (
+    ACPI_PARSE_OBJECT       *Next1,
+    ACPI_PARSE_OBJECT       *Next2);
+
 
 /*******************************************************************************
  *
@@ -431,6 +442,7 @@ TrTransformSubtree (
     ACPI_PARSE_OBJECT           *Op)
 {
     ACPI_PARSE_OBJECT           *MethodOp;
+    ACPI_NAMESTRING_INFO        Info;
 
 
     if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
@@ -492,6 +504,22 @@ TrTransformSubtree (
         Op->Asl.Value.String = "\\";
         break;
 
+    case PARSEOP_NAMESTRING:
+        /*
+         * A NameString can be up to 255 (0xFF) individual NameSegs maximum
+         * (with 254 dot separators) - as per the ACPI specification. Note:
+         * Cannot check for NumSegments == 0 because things like
+         * Scope(\) are legal and OK.
+         */
+        Info.ExternalName = Op->Asl.Value.String;
+        AcpiNsGetInternalNameLength (&Info);
+
+        if (Info.NumSegments > 255)
+        {
+            AslError (ASL_ERROR, ASL_MSG_NAMESTRING_LENGTH, Op, NULL);
+        }
+        break;
+
     case PARSEOP_UNLOAD:
 
         AslError (ASL_WARNING, ASL_MSG_UNLOAD, Op, NULL);
@@ -510,7 +538,6 @@ TrTransformSubtree (
     case PARSEOP_PROCESSOR:
 
         AslError (ASL_WARNING, ASL_MSG_LEGACY_PROCESSOR_OP, Op, Op->Asl.ExternalName);
-
         break;
 
     default:
@@ -646,6 +673,8 @@ TrDoSwitch (
 
         if (Next->Asl.ParseOpcode == PARSEOP_CASE)
         {
+            TrCheckForDuplicateCase (Next, Next->Asl.Child);
+
             if (CaseOp)
             {
                 /* Add an ELSE to complete the previous CASE */
@@ -977,3 +1006,176 @@ TrDoSwitch (
     BreakOp->Asl.Parent = StartNode;
     TrAmlInsertPeer (Conditional, BreakOp);
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    TrCheckForDuplicateCase
+ *
+ * PARAMETERS:  CaseOp          - Parse node for first Case statement in list
+ *              Predicate1      - Case value for the input CaseOp
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check for duplicate case values. Currently, only handles
+ *              Integers, Strings and Buffers. No support for Package objects.
+ *
+ ******************************************************************************/
+
+static void
+TrCheckForDuplicateCase (
+    ACPI_PARSE_OBJECT       *CaseOp,
+    ACPI_PARSE_OBJECT       *Predicate1)
+{
+    ACPI_PARSE_OBJECT       *Next;
+    ACPI_PARSE_OBJECT       *Predicate2;
+
+
+    /* Walk the list of CASE opcodes */
+
+    Next = CaseOp->Asl.Next;
+    while (Next)
+    {
+        if (Next->Asl.ParseOpcode == PARSEOP_CASE)
+        {
+            /* Emit error only once */
+
+            if (Next->Asl.CompileFlags & OP_IS_DUPLICATE)
+            {
+                goto NextCase;
+            }
+
+            /* Check for a duplicate plain integer */
+
+            Predicate2 = Next->Asl.Child;
+            if ((Predicate1->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_INTEGER))
+            {
+                if (Predicate1->Asl.Value.Integer == Predicate2->Asl.Value.Integer)
+                {
+                    goto FoundDuplicate;
+                }
+            }
+
+            /* Check for pairs of the constants ZERO, ONE, ONES */
+
+            else if (((Predicate1->Asl.ParseOpcode == PARSEOP_ZERO) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_ZERO)) ||
+                ((Predicate1->Asl.ParseOpcode == PARSEOP_ONE) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_ONE)) ||
+                ((Predicate1->Asl.ParseOpcode == PARSEOP_ONES) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_ONES)))
+            {
+                goto FoundDuplicate;
+            }
+
+            /* Check for a duplicate string constant (literal) */
+
+            else if ((Predicate1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL))
+            {
+                if (!strcmp (Predicate1->Asl.Value.String,
+                        Predicate2->Asl.Value.String))
+                {
+                    goto FoundDuplicate;
+                }
+            }
+
+            /* Check for a duplicate buffer constant */
+
+            else if ((Predicate1->Asl.ParseOpcode == PARSEOP_BUFFER) &&
+                (Predicate2->Asl.ParseOpcode == PARSEOP_BUFFER))
+            {
+                if (TrCheckForBufferMatch (Predicate1->Asl.Child,
+                        Predicate2->Asl.Child))
+                {
+                    goto FoundDuplicate;
+                }
+            }
+        }
+        goto NextCase;
+
+FoundDuplicate:
+        /* Emit error message only once */
+
+        Next->Asl.CompileFlags |= OP_IS_DUPLICATE;
+
+        AslDualParseOpError (ASL_ERROR, ASL_MSG_DUPLICATE_CASE, Next,
+            Next->Asl.Value.String, ASL_MSG_CASE_FOUND_HERE, CaseOp,
+            CaseOp->Asl.ExternalName);
+
+NextCase:
+        Next = Next->Asl.Next;
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    TrCheckForBufferMatch
+ *
+ * PARAMETERS:  Next1       - Parse node for first opcode in first buffer list
+ *                              (The DEFAULT_ARG or INTEGER node)
+ *              Next2       - Parse node for first opcode in second buffer list
+ *                              (The DEFAULT_ARG or INTEGER node)
+ *
+ * RETURN:      TRUE if buffers match, FALSE otherwise
+ *
+ * DESCRIPTION: Check for duplicate Buffer case values.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+TrCheckForBufferMatch (
+    ACPI_PARSE_OBJECT       *NextOp1,
+    ACPI_PARSE_OBJECT       *NextOp2)
+{
+
+    if (NextOp1->Asl.Value.Integer != NextOp2->Asl.Value.Integer)
+    {
+        return (FALSE);
+    }
+
+    /* Start at the BYTECONST initializer node list */
+
+    NextOp1 = NextOp1->Asl.Next;
+    NextOp2 = NextOp2->Asl.Next;
+
+    /*
+     * Walk both lists until either a mismatch is found, or one or more
+     * end-of-lists are found
+     */
+    while (NextOp1 && NextOp2)
+    {
+        if ((NextOp1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) &&
+            (NextOp2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL))
+        {
+            if (!strcmp (NextOp1->Asl.Value.String, NextOp2->Asl.Value.String))
+            {
+                return (TRUE);
+            }
+            else
+            {
+                return (FALSE);
+            }
+        }
+        if ((UINT8) NextOp1->Asl.Value.Integer != (UINT8) NextOp2->Asl.Value.Integer)
+        {
+            return (FALSE);
+        }
+
+        NextOp1 = NextOp1->Asl.Next;
+        NextOp2 = NextOp2->Asl.Next;
+    }
+
+    /* Not a match if one of the lists is not at end-of-list */
+
+    if (NextOp1 || NextOp2)
+    {
+        return (FALSE);
+    }
+
+    /* Otherwise, the buffers match */
+
+    return (TRUE);
+}
diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
index 0faaec03..0ee94d6a 100644
--- a/src/acpica/source/compiler/aslutils.c
+++ b/src/acpica/source/compiler/aslutils.c
@@ -567,11 +567,6 @@ UtDisplayOneSummary (
     /* Summary of main input and output files */
 
     FileNode = FlGetCurrentFileNode ();
-    if (!FileNode)
-    {
-        fprintf (stderr, "Summary could not be generated");
-        return;
-    }
 
     if (FileNode->ParserErrorDetected)
     {
diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c
index d903ef1b..8a1f1a4c 100644
--- a/src/acpica/source/compiler/aslxref.c
+++ b/src/acpica/source/compiler/aslxref.c
@@ -1055,7 +1055,7 @@ XfNamespaceLocateBegin (
             NextOp = NextOp->Asl.Next;
         }
 
-        if (Node->Value != ASL_EXTERNAL_METHOD &&
+        if (Node->Value != ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
             Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
         {
             /*
@@ -1064,8 +1064,17 @@ XfNamespaceLocateBegin (
              */
             if (PassedArgs != Node->Value)
             {
-                sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
-                    Node->Value);
+                if (Node->Flags & ANOBJ_IS_EXTERNAL)
+                {
+                    sprintf (AslGbl_MsgBuffer,
+                        "according to previous use, %s requires %u",
+                        Op->Asl.ExternalName, Node->Value);
+                }
+                else
+                {
+                    sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
+                        Node->Value);
+                }
 
                 if (PassedArgs < Node->Value)
                 {
@@ -1077,6 +1086,22 @@ XfNamespaceLocateBegin (
                 }
             }
         }
+
+        /*
+         * At this point, a method call to an external method has been
+         * detected. As of 11/19/2019, iASL does not support parameter counts
+         * for methods declared as external. Therefore, save the parameter
+         * count of the first method call and use this count check other
+         * method calls to ensure that the methods are being called with the
+         * same amount of parameters.
+         */
+        else if (Node->Type == ACPI_TYPE_METHOD &&
+            (Node->Flags & ANOBJ_IS_EXTERNAL) &&
+            Node->Value == ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
+            Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
+        {
+            Node->Value = PassedArgs;
+        }
     }
 
     /* 4) Check for an ASL Field definition */
diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c
index 80970822..6c52f989 100644
--- a/src/acpica/source/compiler/dtcompile.c
+++ b/src/acpica/source/compiler/dtcompile.c
@@ -261,18 +261,11 @@ DtDoCompile (
     UtEndEvent (Event);
 
     FileNode = FlGetCurrentFileNode ();
-    if (!FileNode)
-    {
-        fprintf (stderr, "Summary for %s could not be generated",
-            AslGbl_Files[ASL_FILE_INPUT].Filename);
-    }
-    else
-    {
-        FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
-        FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
-        DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
-                FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
-    }
+
+    FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
+    FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
+    DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
+            FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
 
     if (ACPI_FAILURE (Status))
     {
diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h
index 7c78b55b..427051c3 100644
--- a/src/acpica/source/compiler/dtcompiler.h
+++ b/src/acpica/source/compiler/dtcompiler.h
@@ -459,7 +459,6 @@ DtCreateTableUnit (
     UINT32                  Column);
 
 
-
 /* dtparser - lex/yacc files */
 
 UINT64                      DtCompilerParserResult; /* Expression return value */
diff --git a/src/acpica/source/components/debugger/dbconvert.c b/src/acpica/source/components/debugger/dbconvert.c
index a9014b8f..6b58bf5f 100644
--- a/src/acpica/source/components/debugger/dbconvert.c
+++ b/src/acpica/source/components/debugger/dbconvert.c
@@ -354,10 +354,6 @@ AcpiDbConvertToPackage (
 
     Elements = ACPI_ALLOCATE_ZEROED (
         DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT));
-    if (!Elements)
-    {
-        return (AE_NO_MEMORY);
-    }
 
     This = String;
     for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++)
diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
index ac366ab0..5521562a 100644
--- a/src/acpica/source/components/debugger/dbnames.c
+++ b/src/acpica/source/components/debugger/dbnames.c
@@ -807,7 +807,6 @@ AcpiDbWalkForFields (
 }
 
 
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDbWalkForSpecificObjects
diff --git a/src/acpica/source/components/dispatcher/dsfield.c b/src/acpica/source/components/dispatcher/dsfield.c
index 5477686f..b81aaeb9 100644
--- a/src/acpica/source/components/dispatcher/dsfield.c
+++ b/src/acpica/source/components/dispatcher/dsfield.c
@@ -413,7 +413,7 @@ Cleanup:
  * FUNCTION:    AcpiDsGetFieldNames
  *
  * PARAMETERS:  Info            - CreateField info structure
- *  `           WalkState       - Current method state
+ *              WalkState       - Current method state
  *              Arg             - First parser arg for the field name list
  *
  * RETURN:      Status
diff --git a/src/acpica/source/components/dispatcher/dsopcode.c b/src/acpica/source/components/dispatcher/dsopcode.c
index acf1ff4e..526fc847 100644
--- a/src/acpica/source/components/dispatcher/dsopcode.c
+++ b/src/acpica/source/components/dispatcher/dsopcode.c
@@ -374,6 +374,7 @@ AcpiDsInitBufferField (
     }
 
     ObjDesc->BufferField.BufferObj = BufferDesc;
+    ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
 
     /* Reference count for BufferDesc inherits ObjDesc count */
 
diff --git a/src/acpica/source/components/dispatcher/dswload.c b/src/acpica/source/components/dispatcher/dswload.c
index b5579428..fa6b80e9 100644
--- a/src/acpica/source/components/dispatcher/dswload.c
+++ b/src/acpica/source/components/dispatcher/dswload.c
@@ -567,6 +567,28 @@ AcpiDsLoad1EndOp (
     Op = WalkState->Op;
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
 
+    /*
+     * Disassembler: handle create field operators here.
+     *
+     * CreateBufferField is a deferred op that is typically processed in load
+     * pass 2. However, disassembly of control method contents walk the parse
+     * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed
+     * in a later walk. This is a problem when there is a control method that
+     * has the same name as the AML_CREATE object. In this case, any use of the
+     * name segment will be detected as a method call rather than a reference
+     * to a buffer field.
+     *
+     * This earlier creation during disassembly solves this issue by inserting
+     * the named object in the ACPI namespace so that references to this name
+     * would be a name string rather than a method call.
+     */
+    if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) &&
+        (WalkState->OpInfo->Flags & AML_CREATE))
+    {
+        Status = AcpiDsCreateBufferField (Op, WalkState);
+        return_ACPI_STATUS (Status);
+    }
+
     /* We are only interested in opcodes that have an associated name */
 
     if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
diff --git a/src/acpica/source/components/executer/exfield.c b/src/acpica/source/components/executer/exfield.c
index b35e6a4e..dc97d404 100644
--- a/src/acpica/source/components/executer/exfield.c
+++ b/src/acpica/source/components/executer/exfield.c
@@ -246,7 +246,8 @@ AcpiExGetProtocolBufferLength (
  * RETURN:      Status
  *
  * DESCRIPTION: Read from a named field. Returns either an Integer or a
- *              Buffer, depending on the size of the field.
+ *              Buffer, depending on the size of the field and whether if a
+ *              field is created by the CreateField() operator.
  *
  ******************************************************************************/
 
@@ -310,12 +311,17 @@ AcpiExReadDataFromField (
      * the use of arithmetic operators on the returned value if the
      * field size is equal or smaller than an Integer.
      *
+     * However, all buffer fields created by CreateField operator needs to
+     * remain as a buffer to match other AML interpreter implementations.
+     *
      * Note: Field.length is in bits.
      */
     BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES (
         ObjDesc->Field.BitLength);
 
-    if (BufferLength > AcpiGbl_IntegerByteWidth)
+    if (BufferLength > AcpiGbl_IntegerByteWidth ||
+        (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD &&
+        ObjDesc->BufferField.IsCreateField))
     {
         /* Field is too large for an Integer, create a Buffer instead */
 
diff --git a/src/acpica/source/components/hardware/hwxfsleep.c b/src/acpica/source/components/hardware/hwxfsleep.c
index 78dc1902..6eff7f6a 100644
--- a/src/acpica/source/components/hardware/hwxfsleep.c
+++ b/src/acpica/source/components/hardware/hwxfsleep.c
@@ -192,7 +192,7 @@ static ACPI_SLEEP_FUNCTIONS         AcpiSleepDispatch[] =
                        ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWakePrep)),
      ACPI_STRUCT_INIT (ExtendedFunction,
                        AcpiHwExtendedWakePrep) },
-    {ACPI_STRUCT_INIT (Legacy_function,
+    {ACPI_STRUCT_INIT (LegacyFunction,
                        ACPI_HW_OPTIONAL_FUNCTION (AcpiHwLegacyWake)),
      ACPI_STRUCT_INIT (ExtendedFunction,
                        AcpiHwExtendedWake) }
diff --git a/src/acpica/source/components/utilities/utids.c b/src/acpica/source/components/utilities/utids.c
index 513548c2..5fcfbf66 100644
--- a/src/acpica/source/components/utilities/utids.c
+++ b/src/acpica/source/components/utilities/utids.c
@@ -466,8 +466,7 @@ AcpiUtExecute_CID (
         {
             /* Copy the String CID from the returned object */
 
-            AcpiUtSafeStrcpy (NextIdString, CidObjects[i]->String.Length + 1,
-                CidObjects[i]->String.Pointer);
+            strcpy (NextIdString, CidObjects[i]->String.Pointer);
             Length = CidObjects[i]->String.Length + 1;
         }
 
diff --git a/src/acpica/source/include/acobject.h b/src/acpica/source/include/acobject.h
index 74feb8d9..d04fe0c6 100644
--- a/src/acpica/source/include/acobject.h
+++ b/src/acpica/source/include/acobject.h
@@ -489,6 +489,7 @@ typedef struct acpi_object_buffer_field
 {
     ACPI_OBJECT_COMMON_HEADER
     ACPI_COMMON_FIELD_INFO
+    BOOLEAN                         IsCreateField;      /* Special case for objects created by CreateField() */
     union acpi_operand_object       *BufferObj;         /* Containing Buffer object */
 
 } ACPI_OBJECT_BUFFER_FIELD;
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 62e37909..15a02a30 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                 0x20191018
+#define ACPI_CA_VERSION                 0x20191213
 
 #include "acconfig.h"
 #include "actypes.h"
diff --git a/src/acpica/source/include/platform/acenv.h b/src/acpica/source/include/platform/acenv.h
index 46eeb9df..bd6816a9 100644
--- a/src/acpica/source/include/platform/acenv.h
+++ b/src/acpica/source/include/platform/acenv.h
@@ -270,6 +270,21 @@
 #define ACPI_DISASSEMBLER 1
 #endif
 
+/*
+ * acpisrc CR\LF support
+ * Unix file line endings do not include the carriage return.
+ * If the acpisrc utility is being built using a microsoft compiler, it means
+ * that it will be running on a windows machine which means that the output is
+ * expected to have CR/LF newlines. If the acpisrc utility is built with
+ * anything else, it will likely run on a system with LF newlines. This flag
+ * tells the acpisrc utility that newlines will be in the LF format.
+ */
+#if defined(ACPI_SRC_APP) && !defined(_MSC_VER)
+#define ACPI_SRC_OS_LF_ONLY 1
+#else
+#define ACPI_SRC_OS_LF_ONLY 0
+#endif
+
 /*! [Begin] no source code translation */
 
 /******************************************************************************
-- 
2.24.0




More information about the fwts-devel mailing list