svn commit: r355739 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/dispatcher components/executer components/hardware include include/platform

Jung-uk Kim jkim at FreeBSD.org
Fri Dec 13 23:28:59 UTC 2019


Author: jkim
Date: Fri Dec 13 23:28:52 2019
New Revision: 355739
URL: https://svnweb.freebsd.org/changeset/base/355739

Log:
  MFV:	r355716
  
  Merge ACPICA 20191213.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/dmtables.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/aslmethod.c
  head/sys/contrib/dev/acpica/compiler/asloptions.c
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/asltransform.c
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/aslxref.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/dtcompiler.h
  head/sys/contrib/dev/acpica/compiler/dttable2.c
  head/sys/contrib/dev/acpica/components/debugger/dbinput.c
  head/sys/contrib/dev/acpica/components/debugger/dbnames.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  head/sys/contrib/dev/acpica/components/dispatcher/dswload.c
  head/sys/contrib/dev/acpica/components/executer/exfield.c
  head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  head/sys/contrib/dev/acpica/include/acobject.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/platform/acenv.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/changes.txt	Fri Dec 13 23:28:52 2019	(r355739)
@@ -1,4 +1,25 @@
 ----------------------------------------
+13 December 2019. Summary of changes for version 20191213:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Return a Buffer object for all fields created via the CreateField operator. Previously, an Integer would be returned if the size of the field was less than or equal to the current size of an Integer. Although this goes against the ACPI specification, it provides compatibility with other ACPI implementations. Also updated the ASLTS test suite to reflect this new behavior.
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: Implemented detection of (and throw an error for) duplicate values for Case statements within a single Switch statement. Duplicate Integers, Strings, and Buffers are supported.
+
+iASL: Fix error logging issue during multiple file compilation -- Switch to the correct input file during error node creation.
+
+iASL: For duplicate named object creation, now emit an error instead of a warning - since this will cause a runtime error.
+
+AcpiSrc: Add unix line-ending support for non-Windows builds.
+
+iASL: Add an error condition for an attempt to create a NameString with > 255 NameSegs (the max allowable via the AML definition).
+
+
+----------------------------------------
 18 October 2019. Summary of changes for version 20191018:
 
 

Modified: head/sys/contrib/dev/acpica/common/dmtables.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtables.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/common/dmtables.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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))

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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);
 
@@ -329,6 +311,25 @@ CmDoAslMiddleAndBackEnd (
 {
     UINT8                   Event;
     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 */

Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asldefine.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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 */

Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslerror.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslerror.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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,8 +551,9 @@ 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'))
             {
                 if (*Total < 256)
@@ -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

Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfiles.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslfiles.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -207,12 +207,6 @@ FlInitOneFile (
     NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE,
         UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE)));
 
-    if (!NewFileNode)
-    {
-        AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL);
-        return (AE_NO_MEMORY);
-    }
-
     NewFileNode->ParserErrorDetected = FALSE;
     NewFileNode->Next = AslGbl_FilesList;
 
@@ -420,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);
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslload.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslload.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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)

Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmessages.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslmessages.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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 */

Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmessages.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslmessages.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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 */
 

Modified: head/sys/contrib/dev/acpica/compiler/aslmethod.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmethod.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslmethod.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -586,7 +586,7 @@ MtMethodAnalysisWalkBegin (
 
         /* Special typechecking for _HID */
 
-        if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg))
+        if (ACPI_COMPARE_NAMESEG (METHOD_NAME__HID, Op->Asl.NameSeg))
         {
             Next = Op->Asl.Child->Asl.Next;
             AnCheckId (Next, ASL_TYPE_HID);
@@ -594,7 +594,7 @@ MtMethodAnalysisWalkBegin (
 
         /* Special typechecking for _CID */
 
-        else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg))
+        else if (ACPI_COMPARE_NAMESEG (METHOD_NAME__CID, Op->Asl.NameSeg))
         {
             Next = Op->Asl.Child->Asl.Next;
 

Modified: head/sys/contrib/dev/acpica/compiler/asloptions.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asloptions.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/asloptions.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -219,7 +219,7 @@ AslCommandLine (
         {
             exit (-1);
         }
-        exit (1);
+        exit (0);
     }
 
     /* Next parameter must be the input filename */

Modified: head/sys/contrib/dev/acpica/compiler/aslstartup.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslstartup.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslstartup.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -457,10 +457,6 @@ AslDoOneFile (
     }
 
     FileNode = FlGetCurrentFileNode();
-    if (!FileNode)
-    {
-        return (AE_ERROR);
-    }
 
     FileNode->OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
 

Modified: head/sys/contrib/dev/acpica/compiler/asltransform.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asltransform.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/asltransform.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -151,6 +151,7 @@
 
 #include <contrib/dev/acpica/compiler/aslcompiler.h>
 #include "aslcompiler.y.h"
+#include <contrib/dev/acpica/include/acnamesp.h>
 
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("asltransform")
@@ -194,7 +195,17 @@ 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);
+
+
 /*******************************************************************************
  *
  * FUNCTION:    TrAmlGetNextTempName
@@ -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 */
@@ -976,4 +1005,177 @@ TrDoSwitch (
     TrAmlInitLineNumbers (BreakOp, NewOp);
     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);
 }

Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslutils.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslutils.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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)
     {

Modified: head/sys/contrib/dev/acpica/compiler/aslxref.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslxref.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/aslxref.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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)
                 {
@@ -1076,6 +1085,22 @@ XfNamespaceLocateBegin (
                     AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, AslGbl_MsgBuffer);
                 }
             }
+        }
+
+        /*
+         * 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;
         }
     }
 

Modified: head/sys/contrib/dev/acpica/compiler/dtcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dtcompile.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/dtcompile.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -261,25 +261,15 @@ 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))
     {
-        if (FileNode)
-        {
-            FileNode->ParserErrorDetected = TRUE;
-        }
+        FileNode->ParserErrorDetected = TRUE;
 
         /* TBD: temporary error message. Msgs should come from function above */
 
@@ -306,11 +296,8 @@ DtDoCompile (
 
     /* Save the compile time statistics to the current file node */
 
-    if (FileNode)
-    {
-        FileNode->TotalFields = AslGbl_InputFieldCount;
-        FileNode->OutputByteLength = AslGbl_TableLength;
-    }
+    FileNode->TotalFields = AslGbl_InputFieldCount;
+    FileNode->OutputByteLength = AslGbl_TableLength;
 
     return (Status);
 }

Modified: head/sys/contrib/dev/acpica/compiler/dtcompiler.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dtcompiler.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/dtcompiler.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -459,7 +459,6 @@ DtCreateTableUnit (
     UINT32                  Column);
 
 
-
 /* dtparser - lex/yacc files */
 
 UINT64                      DtCompilerParserResult; /* Expression return value */

Modified: head/sys/contrib/dev/acpica/compiler/dttable2.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dttable2.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/compiler/dttable2.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -1662,6 +1662,7 @@ DtCompileSlit (
             "Found %u entries, must match LocalityCount: %u",
             LocalityListLength, Localities);
         DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
+        ACPI_FREE (LocalityBuffer);
         return (AE_LIMIT);
     }
 

Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -1019,7 +1019,7 @@ AcpiDbCommandDispatch (
         if (ACPI_FAILURE (Status) || Temp64 >= ACPI_NUM_PREDEFINED_REGIONS)
         {
             AcpiOsPrintf (
-                "Invalid adress space ID: must be between 0 and %u inclusive\n",
+                "Invalid address space ID: must be between 0 and %u inclusive\n",
                 ACPI_NUM_PREDEFINED_REGIONS - 1);
             return (AE_OK);
         }

Modified: head/sys/contrib/dev/acpica/components/debugger/dbnames.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbnames.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/debugger/dbnames.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -807,7 +807,6 @@ AcpiDbWalkForFields (
 }
 
 
-
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDbWalkForSpecificObjects

Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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

Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -374,6 +374,7 @@ AcpiDsInitBufferField (
     }
 
     ObjDesc->BufferField.BufferObj = BufferDesc;
+    ObjDesc->BufferField.IsCreateField = AmlOpcode == AML_CREATE_FIELD_OP;
 
     /* Reference count for BufferDesc inherits ObjDesc count */
 

Modified: head/sys/contrib/dev/acpica/components/dispatcher/dswload.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/dispatcher/dswload.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/dispatcher/dswload.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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)))

Modified: head/sys/contrib/dev/acpica/components/executer/exfield.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/executer/exfield.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/executer/exfield.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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 */
 

Modified: head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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) }

Modified: head/sys/contrib/dev/acpica/include/acobject.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acobject.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/include/acobject.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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;

Modified: head/sys/contrib/dev/acpica/include/acpixf.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acpixf.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/include/acpixf.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -154,7 +154,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20191018
+#define ACPI_CA_VERSION                 0x20191213
 
 #include <contrib/dev/acpica/include/acconfig.h>
 #include <contrib/dev/acpica/include/actypes.h>

Modified: head/sys/contrib/dev/acpica/include/platform/acenv.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/platform/acenv.h	Fri Dec 13 23:22:49 2019	(r355738)
+++ head/sys/contrib/dev/acpica/include/platform/acenv.h	Fri Dec 13 23:28:52 2019	(r355739)
@@ -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 */
 
 /******************************************************************************


More information about the svn-src-head mailing list