Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Aug 2018 16:34:24 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r337581 - in vendor-sys/acpica/dist: . source/components/debugger source/components/dispatcher source/components/hardware source/components/namespace source/components/parser source/com...
Message-ID:  <201808101634.w7AGYO4Q078334@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Fri Aug 10 16:34:24 2018
New Revision: 337581
URL: https://svnweb.freebsd.org/changeset/base/337581

Log:
  Import ACPICA 20180810.

Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/source/components/debugger/dbinput.c
  vendor-sys/acpica/dist/source/components/debugger/dbmethod.c
  vendor-sys/acpica/dist/source/components/debugger/dbxface.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
  vendor-sys/acpica/dist/source/components/hardware/hwregs.c
  vendor-sys/acpica/dist/source/components/hardware/hwsleep.c
  vendor-sys/acpica/dist/source/components/namespace/nsaccess.c
  vendor-sys/acpica/dist/source/components/parser/psloop.c
  vendor-sys/acpica/dist/source/components/tables/tbdata.c
  vendor-sys/acpica/dist/source/components/utilities/utdelete.c
  vendor-sys/acpica/dist/source/components/utilities/uterror.c
  vendor-sys/acpica/dist/source/components/utilities/utstrsuppt.c
  vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c
  vendor-sys/acpica/dist/source/include/acconfig.h
  vendor-sys/acpica/dist/source/include/acexcep.h
  vendor-sys/acpica/dist/source/include/aclocal.h
  vendor-sys/acpica/dist/source/include/acnamesp.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/acutils.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aeregion.c

Modified: vendor-sys/acpica/dist/changes.txt
==============================================================================
--- vendor-sys/acpica/dist/changes.txt	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/changes.txt	Fri Aug 10 16:34:24 2018	(r337581)
@@ -1,4 +1,51 @@
 ----------------------------------------
+10 August 2018. Summary of changes for version 20180810:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Initial ACPI table loading: Attempt to continue loading ACPI tables 
+regardless of malformed AML. Since migrating table initialization to the 
+new module-level code support, the AML interpreter rejected tables upon 
+any ACPI error encountered during table load. This is a problem because 
+non-serious ACPI errors during table load do not necessarily mean that 
+the entire definition block (DSDT or SSDT) is invalid. This change 
+improves the table loading by ignoring some types of errors that can be 
+generated by incorrect AML. This can range from object type errors, scope 
+errors, and index errors.
+
+Suspend/Resume support: Update to stop unconditionally clearing ACPI IRQs 
+during suspend/resume. The status of ACPI events is no longer cleared 
+when entering the ACPI S5 system state (power off) which caused some 
+systems to power up immediately after turning off power in certain 
+situations. This was a functional regression. It was fixed by clearing 
+the status of all ACPI events again when entering S5 (for system-wide 
+suspend or hibernation the clearing of the status of all events is not 
+desirable, as it might cause the kernel to miss wakeup events sometimes). 
+Rafael Wysocki.
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+AcpiExec: Enhanced the -fi option (Namespace initialization file). Field 
+elements listed in the initialization file were previously initialized 
+after the table load and before executing module-level code blocks. 
+Recent changes in the module-level code support means that the table load 
+becomes a large control method execution. If fields are used within 
+module-level code and we are executing with the -fi option, the 
+initialization values were used to initialize the namespace object(s) 
+only after the table was finished loading. This change Provides an early 
+initialization of objects specified in the initialization file so that 
+field unit values are populated during the table load (not after the 
+load).
+
+AcpiExec: Fixed a small memory leak regression that could result in 
+warnings during exit of the utility. These warnings were similar to 
+these:
+    0002D690 Length 0x0006 nsnames-0502 [Not a Descriptor - too small]
+    0002CD70 Length 0x002C utcache-0453 [Operand] Integer RefCount 0x0001
+
+----------------------------------------
 29 June 2018. Summary of changes for version 20180629:
 
 

Modified: vendor-sys/acpica/dist/source/components/debugger/dbinput.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/debugger/dbinput.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/debugger/dbinput.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -969,7 +969,11 @@ AcpiDbCommandDispatch (
     case CMD_DISASSEMBLE:
     case CMD_DISASM:
 
+#ifdef ACPI_DISASSEMBLER
         (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
+#else
+        AcpiOsPrintf ("The AML Disassembler is not configured/present\n");
+#endif
         break;
 
     case CMD_DUMP:
@@ -1083,7 +1087,11 @@ AcpiDbCommandDispatch (
 
     case CMD_LIST:
 
-        AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
+#ifdef ACPI_DISASSEMBLER
+        AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);;
+#else
+        AcpiOsPrintf ("The AML Disassembler is not configured/present\n");
+#endif
         break;
 
     case CMD_LOCKS:

Modified: vendor-sys/acpica/dist/source/components/debugger/dbmethod.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/debugger/dbmethod.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/debugger/dbmethod.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -393,6 +393,7 @@ Cleanup:
 }
 
 
+#ifdef ACPI_DISASSEMBLER
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDbDisassembleAml
@@ -426,9 +427,7 @@ AcpiDbDisassembleAml (
         NumStatements = strtoul (Statements, NULL, 0);
     }
 
-#ifdef ACPI_DISASSEMBLER
     AcpiDmDisassemble (NULL, Op, NumStatements);
-#endif
 }
 
 
@@ -511,8 +510,6 @@ AcpiDbDisassembleMethod (
     WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
 
     Status = AcpiPsParseAml (WalkState);
-
-#ifdef ACPI_DISASSEMBLER
     (void) AcpiDmParseDeferredOps (Op);
 
     /* Now we can disassemble the method */
@@ -520,7 +517,6 @@ AcpiDbDisassembleMethod (
     AcpiGbl_DmOpt_Verbose = FALSE;
     AcpiDmDisassemble (NULL, Op, 0);
     AcpiGbl_DmOpt_Verbose = TRUE;
-#endif
 
     AcpiPsDeleteParseTree (Op);
 
@@ -531,6 +527,7 @@ AcpiDbDisassembleMethod (
     AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
     return (AE_OK);
 }
+#endif
 
 
 /*******************************************************************************

Modified: vendor-sys/acpica/dist/source/components/debugger/dbxface.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/debugger/dbxface.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/debugger/dbxface.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -154,6 +154,7 @@
 #include "amlcode.h"
 #include "acdebug.h"
 #include "acinterp.h"
+#include "acparser.h"
 
 
 #define _COMPONENT          ACPI_CA_DEBUGGER
@@ -435,10 +436,17 @@ AcpiDbSingleStep (
             }
         }
 
-        /* Now we can display it */
+        /* Now we can disassemble and display it */
 
 #ifdef ACPI_DISASSEMBLER
         AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
+#else
+        /*
+         * The AML Disassembler is not configured - at least we can
+         * display the opcode value and name
+         */
+        AcpiOsPrintf ("AML Opcode: %4.4X  %s\n", Op->Common.AmlOpcode,
+            AcpiPsGetOpcodeName (Op->Common.AmlOpcode));
 #endif
 
         if ((Op->Common.AmlOpcode == AML_IF_OP) ||

Modified: vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -157,7 +157,11 @@
 #include "acnamesp.h"
 #include "acparser.h"
 
+#ifdef ACPI_EXEC_APP
+#include "aecommon.h"
+#endif
 
+
 #define _COMPONENT          ACPI_DISPATCHER
         ACPI_MODULE_NAME    ("dsfield")
 
@@ -430,7 +434,14 @@ AcpiDsGetFieldNames (
     UINT64                  Position;
     ACPI_PARSE_OBJECT       *Child;
 
+#ifdef ACPI_EXEC_APP
+    UINT64                  Value = 0;
+    ACPI_OPERAND_OBJECT     *ResultDesc;
+    ACPI_OPERAND_OBJECT     *ObjDesc;
+    char                    *NamePath;
+#endif
 
+
     ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
 
 
@@ -564,6 +575,18 @@ AcpiDsGetFieldNames (
                     {
                         return_ACPI_STATUS (Status);
                     }
+#ifdef ACPI_EXEC_APP
+                    NamePath = AcpiNsGetExternalPathname (Info->FieldNode);
+                    ObjDesc = AcpiUtCreateIntegerObject (Value);
+                    if (ACPI_SUCCESS (AeLookupInitFileEntry (NamePath, &Value)))
+                    {
+                        AcpiExWriteDataToField (ObjDesc,
+                            AcpiNsGetAttachedObject (Info->FieldNode),
+                            &ResultDesc);
+                    }
+                    AcpiUtRemoveReference (ObjDesc);
+                    ACPI_FREE (NamePath);
+#endif
                 }
             }
 
@@ -756,6 +779,9 @@ AcpiDsInitFieldObjects (
         Flags |= ACPI_NS_TEMPORARY;
     }
 
+#ifdef ACPI_EXEC_APP
+        Flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+#endif
     /*
      * Walk the list of entries in the FieldList
      * Note: FieldList can be of zero length. In this case, Arg will be NULL.

Modified: vendor-sys/acpica/dist/source/components/hardware/hwregs.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/hardware/hwregs.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/hardware/hwregs.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -724,13 +724,20 @@ AcpiHwRegisterRead (
     case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
 
         Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPm2ControlBlock);
-        Value = (UINT32) Value64;
+        if (ACPI_SUCCESS (Status))
+        {
+            Value = (UINT32) Value64;
+        }
         break;
 
     case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
 
         Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPmTimerBlock);
-        Value = (UINT32) Value64;
+        if (ACPI_SUCCESS (Status))
+        {
+            Value = (UINT32) Value64;
+        }
+
         break;
 
     case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */

Modified: vendor-sys/acpica/dist/source/components/hardware/hwsleep.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/hardware/hwsleep.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/hardware/hwsleep.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -198,16 +198,27 @@ AcpiHwLegacySleep (
         return_ACPI_STATUS (Status);
     }
 
-    /*
-     * 1) Disable all GPEs
-     * 2) Enable all wakeup GPEs
-     */
+    /* Disable all GPEs */
+
     Status = AcpiHwDisableAllGpes ();
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
+    /*
+     * If the target sleep state is S5, clear all GPEs and fixed events too
+     */
+    if (SleepState == ACPI_STATE_S5)
+    {
+        Status = AcpiHwClearAcpiStatus();
+        if (ACPI_FAILURE (Status))
+        {
+            return_ACPI_STATUS (Status);
+        }
+    }
     AcpiGbl_SystemAwakeAndRunning = FALSE;
+
+    /* Enable all wakeup GPEs */
 
     Status = AcpiHwEnableAllWakeupGpes ();
     if (ACPI_FAILURE (Status))

Modified: vendor-sys/acpica/dist/source/components/namespace/nsaccess.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/namespace/nsaccess.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/namespace/nsaccess.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -724,6 +724,15 @@ AcpiNsLookup (
                     CurrentNode));
             }
 
+#ifdef ACPI_EXEC_APP
+            if ((Status == AE_ALREADY_EXISTS) &&
+                (ThisNode->Flags & ANOBJ_NODE_EARLY_INIT))
+            {
+                ThisNode->Flags &= ~ANOBJ_NODE_EARLY_INIT;
+                Status = AE_OK;
+            }
+#endif
+
 #ifdef ACPI_ASL_COMPILER
             /*
              * If this ACPI name already exists within the namespace as an
@@ -844,6 +853,13 @@ AcpiNsLookup (
             }
         }
     }
+
+#ifdef ACPI_EXEC_APP
+    if (Flags & ACPI_NS_EARLY_INIT)
+    {
+        ThisNode->Flags |= ANOBJ_NODE_EARLY_INIT;
+    }
+#endif
 
     *ReturnNode = ThisNode;
     return_ACPI_STATUS (AE_OK);

Modified: vendor-sys/acpica/dist/source/components/parser/psloop.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/parser/psloop.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/parser/psloop.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -164,6 +164,7 @@
 #include "acdispat.h"
 #include "amlcode.h"
 #include "acconvert.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psloop")
@@ -645,6 +646,18 @@ AcpiPsParseLoop (
             Status = AcpiPsCreateOp (WalkState, AmlOpStart, &Op);
             if (ACPI_FAILURE (Status))
             {
+                /*
+                 * ACPI_PARSE_MODULE_LEVEL means that we are loading a table by
+                 * executing it as a control method. However, if we encounter
+                 * an error while loading the table, we need to keep trying to
+                 * load the table rather than aborting the table load. Set the
+                 * status to AE_OK to proceed with the table load.
+                 */
+                if ((WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) &&
+                    Status == AE_ALREADY_EXISTS)
+                {
+                    Status = AE_OK;
+                }
                 if (Status == AE_CTRL_PARSE_CONTINUE)
                 {
                     continue;
@@ -665,18 +678,20 @@ AcpiPsParseLoop (
                 {
                     return_ACPI_STATUS (Status);
                 }
-                if (WalkState->Opcode == AML_SCOPE_OP)
+                if (AcpiNsOpensScope (
+                    AcpiPsGetOpcodeInfo (WalkState->Opcode)->ObjectType))
                 {
                     /*
-                     * If the scope op fails to parse, skip the body of the
-                     * scope op because the parse failure indicates that the
-                     * device may not exist.
+                     * If the scope/device op fails to parse, skip the body of
+                     * the scope op because the parse failure indicates that
+                     * the device may not exist.
                      */
+                    ACPI_ERROR ((AE_INFO, "Skip parsing opcode %s",
+                        AcpiPsGetOpcodeName (WalkState->Opcode)));
                     WalkState->ParserState.Aml = WalkState->Aml + 1;
                     WalkState->ParserState.Aml =
                         AcpiPsGetNextPackageEnd(&WalkState->ParserState);
                     WalkState->Aml = WalkState->ParserState.Aml;
-                    ACPI_ERROR ((AE_INFO, "Skipping Scope block"));
                 }
 
                 continue;
@@ -832,6 +847,22 @@ AcpiPsParseLoop (
             Status = AcpiPsNextParseState (WalkState, Op, Status);
             if (Status == AE_CTRL_PENDING)
             {
+                Status = AE_OK;
+            }
+            else if ((WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) &&
+                (ACPI_AML_EXCEPTION(Status) || Status == AE_ALREADY_EXISTS ||
+                Status == AE_NOT_FOUND))
+            {
+                /*
+                 * ACPI_PARSE_MODULE_LEVEL flag means that we are currently
+                 * loading a table by executing it as a control method.
+                 * However, if we encounter an error while loading the table,
+                 * we need to keep trying to load the table rather than
+                 * aborting the table load (setting the status to AE_OK
+                 * continues the table load). If we get a failure at this
+                 * point, it means that the dispatcher got an error while
+                 * trying to execute the Op.
+                 */
                 Status = AE_OK;
             }
         }

Modified: vendor-sys/acpica/dist/source/components/tables/tbdata.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/tables/tbdata.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/tables/tbdata.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -711,9 +711,9 @@ AcpiTbVerifyTempTable (
             {
                 if (Status != AE_CTRL_TERMINATE)
                 {
-                    ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
+                    ACPI_EXCEPTION ((AE_INFO, Status,
                         "%4.4s 0x%8.8X%8.8X"
-                        " Table is duplicated",
+                        " Table is already loaded",
                         AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
                             TableDesc->Signature.Ascii : "????",
                         ACPI_FORMAT_UINT64 (TableDesc->Address)));

Modified: vendor-sys/acpica/dist/source/components/utilities/utdelete.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/utilities/utdelete.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/utilities/utdelete.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -520,6 +520,7 @@ AcpiUtUpdateRefCount (
     UINT16                  OriginalCount;
     UINT16                  NewCount = 0;
     ACPI_CPU_FLAGS          LockFlags;
+    char                    *Message;
 
 
     ACPI_FUNCTION_NAME (UtUpdateRefCount);
@@ -560,6 +561,7 @@ AcpiUtUpdateRefCount (
             "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n",
             Object, Object->Common.Type,
             AcpiUtGetObjectTypeName (Object), NewCount));
+        Message = "Incremement";
         break;
 
     case REF_DECREMENT:
@@ -591,6 +593,7 @@ AcpiUtUpdateRefCount (
         {
             AcpiUtDeleteInternalObj (Object);
         }
+        Message = "Decrement";
         break;
 
     default:
@@ -608,8 +611,8 @@ AcpiUtUpdateRefCount (
     if (NewCount > ACPI_MAX_REFERENCE_COUNT)
     {
         ACPI_WARNING ((AE_INFO,
-            "Large Reference Count (0x%X) in object %p, Type=0x%.2X",
-            NewCount, Object, Object->Common.Type));
+            "Large Reference Count (0x%X) in object %p, Type=0x%.2X Operation=%s",
+            NewCount, Object, Object->Common.Type, Message));
     }
 }
 

Modified: vendor-sys/acpica/dist/source/components/utilities/uterror.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/utilities/uterror.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/utilities/uterror.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -352,19 +352,19 @@ AcpiUtPrefixedNamespaceError (
     {
     case AE_ALREADY_EXISTS:
 
-        AcpiOsPrintf ("\n" ACPI_MSG_BIOS_ERROR);
+        AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
         Message = "Failure creating";
         break;
 
     case AE_NOT_FOUND:
 
-        AcpiOsPrintf ("\n" ACPI_MSG_BIOS_ERROR);
+        AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
         Message = "Could not resolve";
         break;
 
     default:
 
-        AcpiOsPrintf ("\n" ACPI_MSG_ERROR);
+        AcpiOsPrintf (ACPI_MSG_ERROR);
         Message = "Failure resolving";
         break;
     }

Modified: vendor-sys/acpica/dist/source/components/utilities/utstrsuppt.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/utilities/utstrsuppt.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/utilities/utstrsuppt.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -419,15 +419,39 @@ BOOLEAN
 AcpiUtDetectHexPrefix (
     char                    **String)
 {
+    char                    *InitialPosition = *String;
 
+    AcpiUtRemoveHexPrefix (String);
+    if (*String != InitialPosition)
+    {
+        return (TRUE); /* String is past leading 0x */
+    }
+
+    return (FALSE);     /* Not a hex string */
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiUtRemoveHexPrefix
+ *
+ * PARAMETERS:  String                  - Pointer to input ASCII string
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Remove a hex "0x" prefix
+ *
+ ******************************************************************************/
+
+void
+AcpiUtRemoveHexPrefix (
+    char                    **String)
+{
     if ((**String == ACPI_ASCII_ZERO) &&
         (tolower ((int) *(*String + 1)) == 'x'))
     {
         *String += 2;        /* Go past the leading 0x */
-        return (TRUE);
     }
-
-    return (FALSE);     /* Not a hex string */
 }
 
 

Modified: vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c
==============================================================================
--- vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -383,7 +383,7 @@ AcpiUtImplicitStrtoul64 (
      * implicit conversions, and the "0x" prefix is "not allowed".
      * However, allow a "0x" prefix as an ACPI extension.
      */
-    AcpiUtDetectHexPrefix (&String);
+    AcpiUtRemoveHexPrefix (&String);
 
     if (!AcpiUtRemoveLeadingZeros (&String))
     {

Modified: vendor-sys/acpica/dist/source/include/acconfig.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/acconfig.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/acconfig.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -233,7 +233,7 @@
 
 /* Maximum object reference count (detects object deletion issues) */
 
-#define ACPI_MAX_REFERENCE_COUNT        0x800
+#define ACPI_MAX_REFERENCE_COUNT        0x4000
 
 /* Default page size for use in mapping memory for operation regions */
 

Modified: vendor-sys/acpica/dist/source/include/acexcep.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/acexcep.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/acexcep.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -204,6 +204,13 @@ typedef struct acpi_exception_info
 
 #define AE_OK                           (ACPI_STATUS) 0x0000
 
+#define ACPI_ENV_EXCEPTION(Status)      (Status & AE_CODE_ENVIRONMENTAL)
+#define ACPI_AML_EXCEPTION(Status)      (Status & AE_CODE_AML)
+#define ACPI_PROG_EXCEPTION(Status)     (Status & AE_CODE_PROGRAMMER)
+#define ACPI_TABLE_EXCEPTION(Status)    (Status & AE_CODE_ACPI_TABLES)
+#define ACPI_CNTL_EXCEPTION(Status)     (Status & AE_CODE_CONTROL)
+
+
 /*
  * Environmental exceptions
  */

Modified: vendor-sys/acpica/dist/source/include/aclocal.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/aclocal.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/aclocal.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -327,6 +327,7 @@ typedef struct acpi_namespace_node
 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
+#define ANOBJ_NODE_EARLY_INIT           0x80    /* AcpiExec only: Node was create via init file (-fi) */
 
 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */

Modified: vendor-sys/acpica/dist/source/include/acnamesp.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/acnamesp.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/acnamesp.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -168,14 +168,15 @@
 /* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */
 
 #define ACPI_NS_NO_UPSEARCH         0
-#define ACPI_NS_SEARCH_PARENT       0x01
-#define ACPI_NS_DONT_OPEN_SCOPE     0x02
-#define ACPI_NS_NO_PEER_SEARCH      0x04
-#define ACPI_NS_ERROR_IF_FOUND      0x08
-#define ACPI_NS_PREFIX_IS_SCOPE     0x10
-#define ACPI_NS_EXTERNAL            0x20
-#define ACPI_NS_TEMPORARY           0x40
-#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
+#define ACPI_NS_SEARCH_PARENT       0x0001
+#define ACPI_NS_DONT_OPEN_SCOPE     0x0002
+#define ACPI_NS_NO_PEER_SEARCH      0x0004
+#define ACPI_NS_ERROR_IF_FOUND      0x0008
+#define ACPI_NS_PREFIX_IS_SCOPE     0x0010
+#define ACPI_NS_EXTERNAL            0x0020
+#define ACPI_NS_TEMPORARY           0x0040
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x0080
+#define ACPI_NS_EARLY_INIT          0x0100
 
 /* Flags for AcpiNsWalkNamespace */
 

Modified: vendor-sys/acpica/dist/source/include/acpixf.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/acpixf.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/acpixf.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -154,7 +154,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20180629
+#define ACPI_CA_VERSION                 0x20180810
 
 #include "acconfig.h"
 #include "actypes.h"

Modified: vendor-sys/acpica/dist/source/include/acutils.h
==============================================================================
--- vendor-sys/acpica/dist/source/include/acutils.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/include/acutils.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -362,6 +362,10 @@ BOOLEAN
 AcpiUtDetectHexPrefix (
     char                    **String);
 
+void
+AcpiUtRemoveHexPrefix (
+    char                    **String);
+
 BOOLEAN
 AcpiUtDetectOctalPrefix (
     char                    **String);

Modified: vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h
==============================================================================
--- vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h	Fri Aug 10 16:34:24 2018	(r337581)
@@ -189,11 +189,22 @@ typedef struct ae_debug_regions
 } AE_DEBUG_REGIONS;
 
 
+/*
+ * Init file entry
+ */
+typedef struct init_file_entry
+{
+    char                    *Name;
+    UINT64                  Value;
+} INIT_FILE_ENTRY;
+
 extern BOOLEAN              AcpiGbl_UseLocalFaultHandler;
 extern BOOLEAN              AcpiGbl_VerboseHandlers;
 extern BOOLEAN              AcpiGbl_IgnoreErrors;
 extern BOOLEAN              AcpiGbl_AbortLoopOnTimeout;
 extern UINT8                AcpiGbl_RegionFillValue;
+extern INIT_FILE_ENTRY      *AcpiGbl_InitEntries;
+extern UINT32               AcpiGbl_InitFileLineCount;
 extern UINT8                AcpiGbl_UseHwReducedFadt;
 extern BOOLEAN              AcpiGbl_DisplayRegionAccess;
 extern BOOLEAN              AcpiGbl_DoInterfaceTests;
@@ -331,12 +342,17 @@ AeOpenInitializationFile (
     char                    *Filename);
 
 void
-AeDoObjectOverrides (
+AeProcessInitFile (
     void);
 
 ACPI_STATUS
 AeSetupConfiguration (
     void                    *RegionAddr);
+
+ACPI_STATUS
+AeLookupInitFileEntry (
+    char                    *Pathname,
+    UINT64                  *Value);
 
 /* aeexec */
 

Modified: vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c
==============================================================================
--- vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -159,10 +159,8 @@
 /* Local prototypes */
 
 static void
-AeDoOneOverride (
-    char                    *Pathname,
-    char                    *ValueString,
-    ACPI_OPERAND_OBJECT     *ObjDesc,
+AeEnterInitFileEntry (
+    INIT_FILE_ENTRY         InitEntry,
     ACPI_WALK_STATE         *WalkState);
 
 
@@ -206,13 +204,15 @@ AeOpenInitializationFile (
 
 /******************************************************************************
  *
- * FUNCTION:    AeDoObjectOverrides
+ * FUNCTION:    AeProcessInitFile
  *
  * PARAMETERS:  None
  *
  * RETURN:      None
  *
- * DESCRIPTION: Read the initialization file and perform all overrides
+ * DESCRIPTION: Read the initialization file and perform all namespace
+ *              initializations. AcpiGbl_InitEntries will be used for region
+ *              field initialization.
  *
  * NOTE:        The format of the file is multiple lines, each of format:
  *                  <ACPI-pathname> <Integer Value>
@@ -220,12 +220,13 @@ AeOpenInitializationFile (
  *****************************************************************************/
 
 void
-AeDoObjectOverrides (
+AeProcessInitFile(
     void)
 {
-    ACPI_OPERAND_OBJECT     *ObjDesc;
     ACPI_WALK_STATE         *WalkState;
     int                     i;
+    UINT64                  idx;
+    ACPI_STATUS             Status;
 
 
     if (!InitFile)
@@ -235,14 +236,19 @@ AeDoObjectOverrides (
 
     /* Create needed objects to be reused for each init entry */
 
-    ObjDesc = AcpiUtCreateIntegerObject (0);
     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
     NameBuffer[0] = '\\';
 
-    /* Read the entire file line-by-line */
-
     while (fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile) != NULL)
     {
+        ++AcpiGbl_InitFileLineCount;
+    }
+    rewind (InitFile);
+
+    AcpiGbl_InitEntries =
+        AcpiOsAllocate (sizeof (INIT_FILE_ENTRY) * AcpiGbl_InitFileLineCount);
+    for (idx = 0; fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile); ++idx)
+    {
         if (sscanf (LineBuffer, "%s %s\n",
                 &NameBuffer[1], ValueBuffer) != 2)
         {
@@ -257,7 +263,20 @@ AeDoObjectOverrides (
             i = 1;
         }
 
-        AeDoOneOverride (&NameBuffer[i], ValueBuffer, ObjDesc, WalkState);
+        AcpiGbl_InitEntries[idx].Name =
+            AcpiOsAllocateZeroed (strnlen (NameBuffer + i, AE_FILE_BUFFER_SIZE) + 1);
+
+        strcpy (AcpiGbl_InitEntries[idx].Name, NameBuffer + i);
+
+        Status = AcpiUtStrtoul64 (ValueBuffer, &AcpiGbl_InitEntries[idx].Value);
+        if (ACPI_FAILURE (Status))
+        {
+            AcpiOsPrintf ("%s %s\n", ValueBuffer,
+                AcpiFormatException (Status));
+            goto CleanupAndExit;
+        }
+
+        AeEnterInitFileEntry (AcpiGbl_InitEntries[idx], WalkState);
     }
 
     /* Cleanup */
@@ -265,77 +284,97 @@ AeDoObjectOverrides (
 CleanupAndExit:
     fclose (InitFile);
     AcpiDsDeleteWalkState (WalkState);
-    AcpiUtRemoveReference (ObjDesc);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AeDoOneOverride
+ * FUNCTION:    AeInitFileEntry
  *
- * PARAMETERS:  Pathname            - AML namepath
- *              ValueString         - New integer value to be stored
- *              ObjDesc             - Descriptor with integer override value
+ * PARAMETERS:  InitEntry           - Entry of the init file
  *              WalkState           - Used for the Store operation
  *
  * RETURN:      None
  *
- * DESCRIPTION: Perform an override for a single namespace object
+ * DESCRIPTION: Perform initialization of a single namespace object
  *
+ *              Note: namespace of objects are limited to integers and region
+ *              fields units of 8 bytes at this time.
+ *
  *****************************************************************************/
 
 static void
-AeDoOneOverride (
-    char                    *Pathname,
-    char                    *ValueString,
-    ACPI_OPERAND_OBJECT     *ObjDesc,
+AeEnterInitFileEntry (
+    INIT_FILE_ENTRY         InitEntry,
     ACPI_WALK_STATE         *WalkState)
 {
-    ACPI_HANDLE             Handle;
+    char                    *Pathname = InitEntry.Name;
+    UINT64                  Value = InitEntry.Value;
+    ACPI_OPERAND_OBJECT     *ObjDesc;
+    ACPI_NAMESPACE_NODE     *NewNode;
     ACPI_STATUS             Status;
-    UINT64                  Value;
 
 
-    AcpiOsPrintf ("Value Override: %s, ", Pathname);
-
-    /*
-     * Get the namespace node associated with the override
-     * pathname from the init file.
-     */
-    Status = AcpiGetHandle (NULL, Pathname, &Handle);
+    AcpiOsPrintf ("Initializing namespace element: %s\n", Pathname);
+    Status = AcpiNsLookup (NULL, Pathname, ACPI_TYPE_INTEGER,
+        ACPI_IMODE_LOAD_PASS2, ACPI_NS_ERROR_IF_FOUND | ACPI_NS_NO_UPSEARCH |
+        ACPI_NS_EARLY_INIT, NULL, &NewNode);
     if (ACPI_FAILURE (Status))
     {
-        AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "While creating name from namespace initialization file: %s",
+            Pathname));
         return;
     }
 
-    /* Extract the 64-bit integer */
+    ObjDesc = AcpiUtCreateIntegerObject (Value);
 
-    Status = AcpiUtStrtoul64 (ValueString, &Value);
-    if (ACPI_FAILURE (Status))
-    {
-        AcpiOsPrintf ("%s %s\n", ValueString,
-            AcpiFormatException (Status));
-        return;
-    }
+    AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n",
+        ACPI_FORMAT_UINT64 (Value));
 
-    ObjDesc->Integer.Value = Value;
+    /* Store pointer to value descriptor in the Node */
 
-    /*
-     * At the point this function is called, the namespace is fully
-     * built and initialized. We can simply store the new object to
-     * the target node.
-     */
-    AcpiExEnterInterpreter ();
-    Status = AcpiExStore (ObjDesc, Handle, WalkState);
-    AcpiExExitInterpreter ();
+    Status = AcpiNsAttachObject (NewNode, ObjDesc,
+         ACPI_TYPE_INTEGER);
 
-    if (ACPI_FAILURE (Status))
+    /* Remove local reference to the object */
+
+    AcpiUtRemoveReference (ObjDesc);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AeLookupInitFileEntry
+ *
+ * PARAMETERS:  Pathname            - AML namepath in external format
+ *              ValueString         - value of the namepath if it exitst
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Search the init file for a particular name and its value.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AeLookupInitFileEntry (
+    char                    *Pathname,
+    UINT64                  *Value)
+{
+    UINT32                  i;
+
+    if (!AcpiGbl_InitEntries)
     {
-        AcpiOsPrintf ("%s\n", AcpiFormatException (Status));
-        return;
+        return AE_NOT_FOUND;
     }
 
-    AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n",
-        ACPI_FORMAT_UINT64 (Value));
+    for (i = 0; i < AcpiGbl_InitFileLineCount; ++i)
+    {
+        if (!strcmp(AcpiGbl_InitEntries[i].Name, Pathname))
+        {
+            *Value = AcpiGbl_InitEntries[i].Value;
+            return AE_OK;
+        }
+    }
+    return AE_NOT_FOUND;
 }

Modified: vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c
==============================================================================
--- vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -199,6 +199,8 @@ BOOLEAN                     AcpiGbl_LoadTestTables = F
 BOOLEAN                     AcpiGbl_AeLoadOnly = FALSE;
 static UINT8                AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP;
 static char                 BatchBuffer[AE_BUFFER_SIZE];    /* Batch command buffer */
+INIT_FILE_ENTRY             *AcpiGbl_InitEntries = NULL;
+UINT32                      AcpiGbl_InitFileLineCount = 0;
 
 #define ACPIEXEC_NAME               "AML Execution/Debug Utility"
 #define AE_SUPPORTED_OPTIONS        "?b:d:e:f^ghlm^rt^v^:x:"
@@ -677,6 +679,8 @@ main (
         signal (SIGSEGV, AeSignalHandler);
     }
 
+    AeProcessInitFile();
+
     /* The remaining arguments are filenames for ACPI tables */
 
     if (!argv[AcpiGbl_Optind])
@@ -785,12 +789,6 @@ main (
      */
     AeInstallLateHandlers ();
 
-    /*
-     * This call implements the "initialization file" option for AcpiExec.
-     * This is the precise point that we want to perform the overrides.
-     */
-    AeDoObjectOverrides ();
-
     /* Finish the ACPICA initialization */
 
     Status = AcpiInitializeObjects (InitFlags);
@@ -848,5 +846,6 @@ NormalExit:
 ErrorExit:
     (void) AcpiTerminate ();
     AcDeleteTableList (ListHead);
+    AcpiOsFree (AcpiGbl_InitEntries);
     return (ExitCode);
 }

Modified: vendor-sys/acpica/dist/source/tools/acpiexec/aeregion.c
==============================================================================
--- vendor-sys/acpica/dist/source/tools/acpiexec/aeregion.c	Fri Aug 10 15:35:02 2018	(r337580)
+++ vendor-sys/acpica/dist/source/tools/acpiexec/aeregion.c	Fri Aug 10 16:34:24 2018	(r337581)
@@ -234,9 +234,9 @@ AeRegionHandler (
     SpaceId = RegionObject->Region.SpaceId;
 
     ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-        "Operation Region request on %s at 0x%X\n",
+        "Operation Region request on %s at 0x%X, BitWidth 0x%X, RegionLength 0x%X\n",
         AcpiUtGetRegionName (RegionObject->Region.SpaceId),
-        (UINT32) Address));
+        (UINT32) Address, BitWidth, (UINT32) Length));
 
     /*
      * Region support can be disabled with the -do option.
@@ -410,7 +410,7 @@ AeRegionHandler (
         if (AcpiGbl_DisplayRegionAccess)
         {
             AcpiOsPrintf ("AcpiExec: %s "
-                "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2X Width %X BufLen %X",
+                "%s: Attr %X Addr %.4X BaseAddr %.4X Length %.2X BitWidth %X BufLen %X",
                 AcpiUtGetRegionName (SpaceId),
                 (Function & ACPI_IO_MASK) ? "Write" : "Read ",
                 (UINT32) (Function >> 16),
@@ -424,7 +424,7 @@ AeRegionHandler (
                 Status = AcpiBufferToResource (MyContext->Connection,
                     MyContext->Length, &Resource);
 
-                AcpiOsPrintf (" [AccLen %.2X Conn %p]",
+                AcpiOsPrintf (" [AccessLength %.2X Connnection %p]",
                     MyContext->AccessLength, MyContext->Connection);
             }
             AcpiOsPrintf ("\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808101634.w7AGYO4Q078334>