svn commit: r254745 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/events components/hardware components/namespace components/tables components/utilities include...

Jung-uk Kim jkim at FreeBSD.org
Fri Aug 23 23:26:03 UTC 2013


Author: jkim
Date: Fri Aug 23 23:25:58 2013
New Revision: 254745
URL: http://svnweb.freebsd.org/changeset/base/254745

Log:
  Merge ACPICA 20130823.

Modified:
  head/sys/contrib/dev/acpica/acpica_prep.sh
  head/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/common/adwalk.c
  head/sys/contrib/dev/acpica/common/dmextern.c
  head/sys/contrib/dev/acpica/common/dmtable.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/asloptions.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/components/debugger/dbcmds.c
  head/sys/contrib/dev/acpica/components/debugger/dbfileio.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/events/evgpeutil.c
  head/sys/contrib/dev/acpica/components/events/evmisc.c
  head/sys/contrib/dev/acpica/components/events/evregion.c
  head/sys/contrib/dev/acpica/components/events/evsci.c
  head/sys/contrib/dev/acpica/components/events/evxface.c
  head/sys/contrib/dev/acpica/components/hardware/hwxface.c
  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
  head/sys/contrib/dev/acpica/components/namespace/nsdump.c
  head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
  head/sys/contrib/dev/acpica/components/tables/tbinstal.c
  head/sys/contrib/dev/acpica/components/tables/tbprint.c
  head/sys/contrib/dev/acpica/components/tables/tbxfroot.c
  head/sys/contrib/dev/acpica/components/utilities/utdebug.c
  head/sys/contrib/dev/acpica/components/utilities/utglobal.c
  head/sys/contrib/dev/acpica/include/acdebug.h
  head/sys/contrib/dev/acpica/include/acdisasm.h
  head/sys/contrib/dev/acpica/include/acevents.h
  head/sys/contrib/dev/acpica/include/acexcep.h
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acpiosxf.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/actypes.h
  head/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/common/   (props changed)
  head/sys/contrib/dev/acpica/compiler/   (props changed)
  head/sys/contrib/dev/acpica/components/debugger/   (props changed)
  head/sys/contrib/dev/acpica/components/events/   (props changed)
  head/sys/contrib/dev/acpica/components/hardware/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/components/tables/   (props changed)
  head/sys/contrib/dev/acpica/components/utilities/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)
  head/sys/contrib/dev/acpica/os_specific/   (props changed)

Modified: head/sys/contrib/dev/acpica/acpica_prep.sh
==============================================================================
--- head/sys/contrib/dev/acpica/acpica_prep.sh	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/acpica_prep.sh	Fri Aug 23 23:25:58 2013	(r254745)
@@ -21,7 +21,7 @@ stripdirs="generate libraries tests tool
 stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h	\
 	aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h	\
 	acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c	\
-	oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"
+	osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"
 
 # include files to canonify
 src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h	\

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/changes.txt	Fri Aug 23 23:25:58 2013	(r254745)
@@ -1,4 +1,88 @@
 ----------------------------------------
+23 August 2013. Summary of changes for version 20130823:
+
+1) ACPICA kernel-resident subsystem:
+
+Implemented support for host-installed System Control Interrupt (SCI) 
+handlers. Certain ACPI functionality requires the host to handle raw 
+SCIs. For example, the "SCI Doorbell" that is defined for memory power 
+state support requires the host device driver to handle SCIs to examine 
+if the doorbell has been activated. Multiple SCI handlers can be 
+installed to allow for future expansion. New external interfaces are 
+AcpiInstallSciHandler, AcpiRemoveSciHandler; see the ACPICA reference for 
+details. Lv Zheng, Bob Moore. ACPICA BZ 1032.
+
+Operation region support: Never locally free the handler "context" 
+pointer. This change removes some dangerous code that attempts to free 
+the handler context pointer in some (rare) circumstances. The owner of 
+the handler owns this pointer and the ACPICA code should never touch it. 
+Although not seen to be an issue in any kernel, it did show up as a 
+problem (fault) under AcpiExec. Also, set the internal storage field for 
+the context pointer to zero when the region is deactivated, simply for 
+sanity. David Box. ACPICA BZ 1039.
+
+AcpiRead: On error, do not modify the return value target location. If an 
+error happens in the middle of a split 32/32 64-bit I/O operation, do not 
+modify the target of the return value pointer. Makes the code consistent 
+with the rest of ACPICA. Bjorn Helgaas.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and 
+has a much larger code and data size.
+
+  Current Release:
+    Non-Debug Version:  96.7K Code, 27.1K Data, 123.9K Total
+    Debug Version:     184.4K Code, 76.8K Data, 261.2K Total
+  Previous Release:
+    Non-Debug Version:  96.2K Code, 27.1K Data, 123.3K Total
+    Debug Version:     185.4K Code, 77.1K Data, 262.5K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+AcpiDump: Implemented several new features and fixed some problems:
+1) Added support to dump the RSDP, RSDT, and XSDT tables.
+2) Added support for multiple table instances (SSDT, UEFI).
+3) Added option to dump "customized" (overridden) tables (-c).
+4) Fixed a problem where some table filenames were improperly 
+constructed.
+5) Improved some error messages, removed some unnecessary messages.
+
+iASL: Implemented additional support for disassembly of ACPI tables that 
+contain invocations of external control methods. The -fe<file> option 
+allows the import of a file that specifies the external methods along 
+with the required number of arguments for each -- allowing for the 
+correct disassembly of the table. This is a workaround for a limitation 
+of AML code where the disassembler often cannot determine the number of 
+arguments required for an external control method and generates incorrect 
+ASL code. See the iASL reference for details. ACPICA BZ 1030.
+
+Debugger: Implemented a new command (paths) that displays the full 
+pathnames (namepaths) and object types of all objects in the namespace. 
+This is an alternative to the namespace command.
+
+Debugger: Implemented a new command (sci) that invokes the SCI dispatch 
+mechanism and any installed handlers.
+
+iASL: Fixed a possible segfault for "too many parent prefixes" condition. 
+This can occur if there are too many parent prefixes in a namepath (for 
+example, ^^^^^^PCI0.ECRD). ACPICA BZ 1035.
+
+Application OSLs: Set the return value for the PCI read functions. These 
+functions simply return AE_OK, but should set the return value to zero 
+also. This change implements this. ACPICA BZ 1038.
+
+Debugger: Prevent possible command line buffer overflow. Increase the 
+size of a couple of the debugger line buffers, and ensure that overflow 
+cannot happen. ACPICA BZ 1037.
+
+iASL: Changed to abort immediately on serious errors during the parsing 
+phase. Due to the nature of ASL, there is no point in attempting to 
+compile these types of errors, and they typically end up causing a 
+cascade of hundreds of errors which obscure the original problem.
+
+----------------------------------------
 25 July 2013. Summary of changes for version 20130725:
 
 1) ACPICA kernel-resident subsystem:

Modified: head/sys/contrib/dev/acpica/common/adisasm.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adisasm.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/common/adisasm.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -341,6 +341,10 @@ AdAmlDisassemble (
         {
             AcpiDmClearExternalList ();
         }
+
+        /* Load any externals defined in the optional external ref file */
+
+        AcpiDmGetExternalsFromFile ();
     }
     else
     {

Modified: head/sys/contrib/dev/acpica/common/adwalk.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adwalk.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/common/adwalk.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -373,10 +373,18 @@ AcpiDmDumpDescending (
     switch (Op->Common.AmlOpcode)
     {
     case AML_BYTE_OP:
+
+        AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer);
+        break;
+
     case AML_WORD_OP:
+
+        AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer);
+        break;
+
     case AML_DWORD_OP:
 
-        AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
+        AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer);
         break;
 
     case AML_QWORD_OP:

Modified: head/sys/contrib/dev/acpica/common/dmextern.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmextern.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/common/dmextern.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -46,7 +46,9 @@
 #include <contrib/dev/acpica/include/amlcode.h>
 #include <contrib/dev/acpica/include/acnamesp.h>
 #include <contrib/dev/acpica/include/acdisasm.h>
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
 #include <stdio.h>
+#include <errno.h>
 
 
 /*
@@ -87,6 +89,8 @@ static const char           *AcpiGbl_DmT
     /* 19 */ ", FieldUnitObj"
 };
 
+#define METHOD_SEPARATORS           " \t,()\n"
+
 
 /* Local prototypes */
 
@@ -99,6 +103,12 @@ AcpiDmNormalizeParentPrefix (
     ACPI_PARSE_OBJECT       *Op,
     char                    *Path);
 
+static void
+AcpiDmAddToExternalListFromFile (
+    char                    *Path,
+    UINT8                   Type,
+    UINT32                  Value);
+
 
 /*******************************************************************************
  *
@@ -444,7 +454,7 @@ AcpiDmAddToExternalList (
                 (NextExternal->Value != Value))
             {
                 ACPI_ERROR ((AE_INFO,
-                    "Argument count mismatch for method %s %u %u",
+                    "External method arg count mismatch %s: Current %u, attempted %u",
                     NextExternal->Path, NextExternal->Value, Value));
             }
 
@@ -536,6 +546,275 @@ AcpiDmAddToExternalList (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiDmGetExternalsFromFile
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Process the optional external reference file.
+ *
+ * Each line in the file should be of the form:
+ *      External (<Method namepath>, MethodObj, <ArgCount>)
+ *
+ * Example:
+ *      External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmGetExternalsFromFile (
+    void)
+{
+    FILE                    *ExternalRefFile;
+    char                    *Token;
+    char                    *MethodName;
+    UINT32                  ArgCount;
+    UINT32                  ImportCount = 0;
+
+
+    if (!Gbl_ExternalRefFilename)
+    {
+        return;
+    }
+
+    /* Open the file */
+
+    ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r");
+    if (!ExternalRefFile)
+    {
+        fprintf (stderr, "Could not open external reference file \"%s\"\n",
+            Gbl_ExternalRefFilename);
+        return;
+    }
+
+    /* Each line defines a method */
+
+    while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile))
+    {
+        Token = strtok (StringBuffer, METHOD_SEPARATORS);   /* "External" */
+        if (!Token) continue;
+        if (strcmp (Token, "External")) continue;
+
+        MethodName = strtok (NULL, METHOD_SEPARATORS);      /* Method namepath */
+        if (!MethodName) continue;
+
+        Token = strtok (NULL, METHOD_SEPARATORS);           /* "MethodObj" */
+        if (!Token) continue;
+        if (strcmp (Token, "MethodObj")) continue;
+
+        Token = strtok (NULL, METHOD_SEPARATORS);           /* Arg count */
+        if (!Token) continue;
+
+        /* Convert arg count string to an integer */
+
+        errno = 0;
+        ArgCount = strtoul (Token, NULL, 0);
+        if (errno)
+        {
+            fprintf (stderr, "Invalid argument count (%s)\n", Token);
+            continue;
+        }
+        if (ArgCount > 7)
+        {
+            fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
+            continue;
+        }
+
+        /* Add this external to the global list */
+
+        AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
+            Gbl_ExternalRefFilename, ArgCount, MethodName);
+
+        AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80);
+        ImportCount++;
+    }
+
+    if (!ImportCount)
+    {
+        fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
+            Gbl_ExternalRefFilename);
+    }
+    else
+    {
+        /* Add the external(s) to the namespace */
+
+        AcpiDmAddExternalsToNamespace ();
+
+        AcpiOsPrintf ("%s: Imported %u external method definitions\n",
+            Gbl_ExternalRefFilename, ImportCount);
+    }
+
+    fclose (ExternalRefFile);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmAddToExternalListFromFile
+ *
+ * PARAMETERS:  Path                - Internal (AML) path to the object
+ *              Type                - ACPI object type to be added
+ *              Value               - Arg count if adding a Method object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Insert a new name into the global list of Externals which
+ *              will in turn be later emitted as an External() declaration
+ *              in the disassembled output.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddToExternalListFromFile (
+    char                    *Path,
+    UINT8                   Type,
+    UINT32                  Value)
+{
+    char                    *InternalPath;
+    char                    *ExternalPath;
+    ACPI_EXTERNAL_LIST      *NewExternal;
+    ACPI_EXTERNAL_LIST      *NextExternal;
+    ACPI_EXTERNAL_LIST      *PrevExternal = NULL;
+    ACPI_STATUS             Status;
+    BOOLEAN                 Resolved = FALSE;
+
+
+    if (!Path)
+    {
+        return;
+    }
+
+    /* TBD: Add a flags parameter */
+
+    if (Type == ACPI_TYPE_METHOD)
+    {
+        if (Value & 0x80)
+        {
+            Resolved = TRUE;
+        }
+        Value &= 0x07;
+    }
+
+    /*
+     * We don't want External() statements to contain a leading '\'.
+     * This prevents duplicate external statements of the form:
+     *
+     *    External (\ABCD)
+     *    External (ABCD)
+     *
+     * This would cause a compile time error when the disassembled
+     * output file is recompiled.
+     */
+    if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
+    {
+        Path++;
+    }
+
+    /* Check all existing externals to ensure no duplicates */
+
+    NextExternal = AcpiGbl_ExternalList;
+    while (NextExternal)
+    {
+        if (!ACPI_STRCMP (Path, NextExternal->Path))
+        {
+            /* Duplicate method, check that the Value (ArgCount) is the same */
+
+            if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
+                (NextExternal->Value != Value))
+            {
+                ACPI_ERROR ((AE_INFO,
+                    "(File) External method arg count mismatch %s: Current %u, override to %u",
+                    NextExternal->Path, NextExternal->Value, Value));
+
+                /* Override, since new value came from external reference file */
+
+                NextExternal->Value = Value;
+            }
+
+            /* Allow upgrade of type from ANY */
+
+            else if (NextExternal->Type == ACPI_TYPE_ANY)
+            {
+                NextExternal->Type = Type;
+                NextExternal->Value = Value;
+            }
+
+            return;
+        }
+
+        NextExternal = NextExternal->Next;
+    }
+
+    /* Get the internal pathname (AML format) */
+
+    Status = AcpiNsInternalizeName (Path, &InternalPath);
+    if (ACPI_FAILURE (Status))
+    {
+        return;
+    }
+
+    /* Allocate and init a new External() descriptor */
+
+    NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
+    if (!NewExternal)
+    {
+        ACPI_FREE (InternalPath);
+        return;
+    }
+
+    /* Must copy and normalize the input path */
+
+    AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath);
+
+    NewExternal->Path = ExternalPath;
+    NewExternal->Type = Type;
+    NewExternal->Value = Value;
+    NewExternal->Resolved = Resolved;
+    NewExternal->Length = (UINT16) ACPI_STRLEN (Path);
+    NewExternal->InternalPath = InternalPath;
+
+    /* Set flag to indicate External->InternalPath needs to be freed */
+
+    NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE;
+
+    /* Link the new descriptor into the global list, alphabetically ordered */
+
+    NextExternal = AcpiGbl_ExternalList;
+    while (NextExternal)
+    {
+        if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
+        {
+            if (PrevExternal)
+            {
+                PrevExternal->Next = NewExternal;
+            }
+            else
+            {
+                AcpiGbl_ExternalList = NewExternal;
+            }
+
+            NewExternal->Next = NextExternal;
+            return;
+        }
+
+        PrevExternal = NextExternal;
+        NextExternal = NextExternal->Next;
+    }
+
+    if (PrevExternal)
+    {
+        PrevExternal->Next = NewExternal;
+    }
+    else
+    {
+        AcpiGbl_ExternalList = NewExternal;
+    }
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiDmAddExternalsToNamespace
  *
  * PARAMETERS:  None
@@ -563,7 +842,7 @@ AcpiDmAddExternalsToNamespace (
 
         Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
                    ACPI_IMODE_LOAD_PASS1,
-                   ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+                   ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
                    NULL, &Node);
 
         if (ACPI_FAILURE (Status))
@@ -731,7 +1010,8 @@ AcpiDmEmitExternals (
                 NextExternal->Path,
                 AcpiDmGetObjectTypeName (NextExternal->Type));
 
-            AcpiOsPrintf (")    // Warning: Unresolved Method, "
+            AcpiOsPrintf (
+                ")    // Warning: Unresolved Method, "
                 "guessing %u arguments (may be incorrect, see warning above)\n",
                 NextExternal->Value);
 
@@ -743,9 +1023,45 @@ AcpiDmEmitExternals (
 
     AcpiOsPrintf ("\n");
 
+
+    /* Emit externals that were imported from a file */
+
+    if (Gbl_ExternalRefFilename)
+    {
+        AcpiOsPrintf (
+            "    /*\n     * External declarations that were imported from\n"
+            "     * the reference file [%s]\n     */\n",
+            Gbl_ExternalRefFilename);
+
+        NextExternal = AcpiGbl_ExternalList;
+        while (NextExternal)
+        {
+            if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE))
+            {
+                AcpiOsPrintf ("    External (%s%s",
+                    NextExternal->Path,
+                    AcpiDmGetObjectTypeName (NextExternal->Type));
+
+                if (NextExternal->Type == ACPI_TYPE_METHOD)
+                {
+                    AcpiOsPrintf (")    // %u Arguments\n",
+                        NextExternal->Value);
+                }
+                else
+                {
+                    AcpiOsPrintf (")\n");
+                }
+                NextExternal->Emitted = TRUE;
+            }
+
+            NextExternal = NextExternal->Next;
+        }
+
+        AcpiOsPrintf ("\n");
+    }
+
     /*
-     * Walk the list of externals (unresolved references)
-     * found during the AML parsing
+     * Walk the list of externals found during the AML parsing
      */
     while (AcpiGbl_ExternalList)
     {

Modified: head/sys/contrib/dev/acpica/common/dmtable.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtable.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/common/dmtable.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -446,7 +446,7 @@ AcpiDmDumpDataTable (
         Length = Table->Length;
         AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
     }
-    else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
+    else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
     {
         Length = AcpiDmDumpRsdp (Table);
     }

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -593,10 +593,15 @@ CmDoCompile (
     AslCompilerparse();
     UtEndEvent (Event);
 
-    /* Flush out any remaining source after parse tree is complete */
+    /* Check for parse errors */
 
-    Event = UtBeginEvent ("Flush source input");
-    CmFlushSourceCode ();
+    Status = AslCheckForErrorExit ();
+    if (ACPI_FAILURE (Status))
+    {
+        fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n");
+        LsDumpParseTree ();
+        goto ErrorExit;
+    }
 
     /* Did the parse tree get successfully constructed? */
 
@@ -606,16 +611,18 @@ CmDoCompile (
          * If there are no errors, then we have some sort of
          * internal problem.
          */
-        Status = AslCheckForErrorExit ();
-        if (Status == AE_OK)
-        {
-            AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
-                NULL, "- Could not resolve parse tree root node");
-        }
+        AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
+            NULL, "- Could not resolve parse tree root node");
 
         goto ErrorExit;
     }
 
+
+    /* Flush out any remaining source after parse tree is complete */
+
+    Event = UtBeginEvent ("Flush source input");
+    CmFlushSourceCode ();
+
     /* Optional parse tree dump, compiler debug output only */
 
     LsDumpParseTree ();

Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Fri Aug 23 23:25:58 2013	(r254745)
@@ -186,6 +186,7 @@ ASL_EXTERN char                     ASL_
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
 ASL_EXTERN ASL_INCLUDE_DIR          ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
 ASL_EXTERN char                     *Gbl_CurrentInputFilename;
+ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL);
 
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
 

Modified: head/sys/contrib/dev/acpica/compiler/aslload.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslload.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/aslload.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -487,6 +487,10 @@ LdNamespace1Begin (
                             ACPI_TYPE_LOCAL_SCOPE,
                             ACPI_IMODE_LOAD_PASS1, Flags,
                             WalkState, &(Node));
+                if (ACPI_FAILURE (Status))
+                {
+                    return_ACPI_STATUS (Status);
+                }
 
                 /*
                  * However, this is an error -- primarily because the MS

Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmain.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/aslmain.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -138,6 +138,7 @@ Usage (
     ACPI_OPTION ("-dc <f1,f2>",     "Disassemble AML and immediately compile it");
     ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
     ACPI_OPTION ("-e  <f1,f2>",     "Include ACPI table(s) for external symbol resolution");
+    ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
     ACPI_OPTION ("-g",              "Get ACPI tables and write to files (*.dat)");
     ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");

Modified: head/sys/contrib/dev/acpica/compiler/asloptions.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asloptions.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/asloptions.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -68,7 +68,7 @@ AslDoResponseFile (
 
 
 #define ASL_TOKEN_SEPARATORS    " \t\n"
-#define ASL_SUPPORTED_OPTIONS   "@:b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
+#define ASL_SUPPORTED_OPTIONS   "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
 
 
 /*******************************************************************************
@@ -136,8 +136,7 @@ AslCommandLine (
 
     if (BadCommandLine)
     {
-        printf ("\n");
-        Usage ();
+        printf ("Use -h option for help information\n");
         exit (1);
     }
 
@@ -276,9 +275,30 @@ AslDoOptions (
         }
         break;
 
-    case 'f':   /* Ignore errors and force creation of aml file */
+    case 'f':
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':   /* Ignore errors and force creation of aml file */
+
+            Gbl_IgnoreErrors = TRUE;
+            break;
+
+        case 'e':   /* Disassembler: Get external declaration file */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Gbl_ExternalRefFilename = AcpiGbl_Optarg;
+            break;
 
-        Gbl_IgnoreErrors = TRUE;
+        default:
+
+            printf ("Unknown option: -f%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
         break;
 
     case 'G':

Modified: head/sys/contrib/dev/acpica/compiler/dtcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dtcompile.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/compiler/dtcompile.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -317,7 +317,7 @@ DtCompileDataTable (
         DtSetTableLength ();
         return (Status);
     }
-    else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
+    else if (ACPI_VALIDATE_RSDP_SIG (Signature))
     {
         Status = DtCompileRsdp (FieldList);
         return (Status);

Modified: head/sys/contrib/dev/acpica/components/debugger/dbcmds.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbcmds.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/debugger/dbcmds.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -1211,6 +1211,14 @@ AcpiDbGenerateGpe (
 
     (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
 }
+
+void
+AcpiDbGenerateSci (
+    void)
+{
+    AcpiEvSciDispatch ();
+}
+
 #endif /* !ACPI_REDUCED_HARDWARE */
 
 #endif /* ACPI_DEBUGGER */

Modified: head/sys/contrib/dev/acpica/components/debugger/dbfileio.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbfileio.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/debugger/dbfileio.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -142,7 +142,8 @@ AcpiDbOpenDebugFile (
     }
 
     AcpiOsPrintf ("Debug output file %s opened\n", Name);
-    ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
+    ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name,
+        sizeof (AcpiGbl_DbDebugFilename));
     AcpiGbl_DbOutputToFile = TRUE;
 
 #endif
@@ -274,11 +275,9 @@ AcpiDbReadTable (
 
     fseek (fp, 0, SEEK_SET);
 
-    /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */
+    /* The RSDP table does not have standard ACPI header */
 
-    if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
-        ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") ||
-        ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT"))
+    if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD "))
     {
         *TableLength = FileSize;
         StandardHeader = FALSE;

Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -132,12 +132,14 @@ enum AcpiExDebuggerCommands
     CMD_OPEN,
     CMD_OSI,
     CMD_OWNER,
+    CMD_PATHS,
     CMD_PREDEFINED,
     CMD_PREFIX,
     CMD_QUIT,
     CMD_REFERENCES,
     CMD_RESOURCES,
     CMD_RESULTS,
+    CMD_SCI,
     CMD_SET,
     CMD_SLEEP,
     CMD_STATS,
@@ -203,12 +205,14 @@ static const ACPI_DB_COMMAND_INFO   Acpi
     {"OPEN",         1},
     {"OSI",          0},
     {"OWNER",        1},
+    {"PATHS",        0},
     {"PREDEFINED",   0},
     {"PREFIX",       0},
     {"QUIT",         0},
     {"REFERENCES",   1},
     {"RESOURCES",    0},
     {"RESULTS",      0},
+    {"SCI",          0},
     {"SET",          3},
     {"SLEEP",        0},
     {"STATS",        1},
@@ -259,22 +263,19 @@ static const ACPI_DB_COMMAND_HELP   Acpi
     {0, "\nNamespace Access Commands:",        "\n"},
     {1, "  Businfo",                           "Display system bus info\n"},
     {1, "  Disassemble <Method>",              "Disassemble a control method\n"},
-    {1, "  Event <F|G> <Value>",               "Generate AcpiEvent (Fixed/GPE)\n"},
     {1, "  Find <AcpiName> (? is wildcard)",   "Find ACPI name(s) with wildcards\n"},
-    {1, "  Gpe <GpeNum> <GpeBlock>",           "Simulate a GPE\n"},
-    {1, "  Gpes",                              "Display info on all GPEs\n"},
     {1, "  Integrity",                         "Validate namespace integrity\n"},
     {1, "  Methods",                           "Display list of loaded control methods\n"},
     {1, "  Namespace [Object] [Depth]",        "Display loaded namespace tree/subtree\n"},
     {1, "  Notify <Object> <Value>",           "Send a notification on Object\n"},
     {1, "  Objects <ObjectType>",              "Display all objects of the given type\n"},
     {1, "  Owner <OwnerId> [Depth]",           "Display loaded namespace by object owner\n"},
+    {1, "  Paths",                             "Display full pathnames of namespace objects\n"},
     {1, "  Predefined",                        "Check all predefined names\n"},
     {1, "  Prefix [<NamePath>]",               "Set or Get current execution prefix\n"},
     {1, "  References <Addr>",                 "Find all references to object at addr\n"},
     {1, "  Resources [DeviceName]",            "Display Device resources (no arg = all devices)\n"},
     {1, "  Set N <NamedObject> <Value>",       "Set value for named integer\n"},
-    {1, "  Sleep [SleepState]",                "Simulate sleep/wake sequence(s) (0-5)\n"},
     {1, "  Template <Object>",                 "Format/dump a Buffer/ResourceTemplate\n"},
     {1, "  Terminate",                         "Delete namespace and all internal objects\n"},
     {1, "  Type <Object>",                     "Display object type\n"},
@@ -288,7 +289,7 @@ static const ACPI_DB_COMMAND_HELP   Acpi
     {5, "  Execute <Namepath> [Arguments]",    "Execute control method\n"},
     {1, "     Hex Integer",                    "Integer method argument\n"},
     {1, "     \"Ascii String\"",               "String method argument\n"},
-    {1, "     (Byte List)",                    "Buffer method argument\n"},
+    {1, "     (Hex Byte List)",                "Buffer method argument\n"},
     {1, "     [Package Element List]",         "Package method argument\n"},
     {1, "  Go",                                "Allow method to run to completion\n"},
     {1, "  Information",                       "Display info about the current method\n"},
@@ -303,6 +304,13 @@ static const ACPI_DB_COMMAND_HELP   Acpi
     {1, "  Tree",                              "Display control method calling tree\n"},
     {1, "  <Enter>",                           "Single step next AML opcode (over calls)\n"},
 
+    {0, "\nHardware Related Commands:",         "\n"},
+    {1, "  Event <F|G> <Value>",               "Generate AcpiEvent (Fixed/GPE)\n"},
+    {1, "  Gpe <GpeNum> <GpeBlock>",           "Simulate a GPE\n"},
+    {1, "  Gpes",                              "Display info on all GPEs\n"},
+    {1, "  Sci",                               "Generate an SCI\n"},
+    {1, "  Sleep [SleepState]",                "Simulate sleep/wake sequence(s) (0-5)\n"},
+
     {0, "\nFile I/O Commands:",                "\n"},
     {1, "  Close",                             "Close debug output file\n"},
     {1, "  Load <Input Filename>",             "Load ACPI table from a file\n"},
@@ -1002,6 +1010,11 @@ AcpiDbCommandDispatch (
         AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
         break;
 
+    case CMD_PATHS:
+
+        AcpiDbDumpNamespacePaths ();
+        break;
+
     case CMD_PREDEFINED:
 
         AcpiDbCheckPredefinedNames ();
@@ -1027,6 +1040,11 @@ AcpiDbCommandDispatch (
         AcpiDbDisplayResults ();
         break;
 
+    case CMD_SCI:
+
+        AcpiDbGenerateSci ();
+        break;
+
     case CMD_SET:
 
         AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],

Modified: head/sys/contrib/dev/acpica/components/debugger/dbnames.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbnames.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/debugger/dbnames.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -256,6 +256,37 @@ AcpiDbDumpNamespace (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiDbDumpNamespacePaths
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Dump entire namespace with full object pathnames and object
+ *              type information. Alternative to "namespace" command.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespacePaths (
+    void)
+{
+
+    AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+    AcpiOsPrintf ("ACPI Namespace (from root):\n");
+
+    /* Display the entire namespace */
+
+    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+    AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY,
+        ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode);
+
+    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiDbDumpNamespaceByOwner
  *
  * PARAMETERS:  OwnerArg        - Owner ID whose nodes will be displayed

Modified: head/sys/contrib/dev/acpica/components/events/evgpeutil.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evgpeutil.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/events/evgpeutil.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -216,7 +216,7 @@ AcpiEvGetGpeDevice (
  *
  * FUNCTION:    AcpiEvGetGpeXruptBlock
  *
- * PARAMETERS:  InterruptNumber      - Interrupt for a GPE block
+ * PARAMETERS:  InterruptNumber             - Interrupt for a GPE block
  *
  * RETURN:      A GPE interrupt block
  *

Modified: head/sys/contrib/dev/acpica/components/events/evmisc.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evmisc.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/events/evmisc.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -292,15 +292,6 @@ AcpiEvTerminate (
 
         Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
 
-        /* Remove SCI handler */
-
-        Status = AcpiEvRemoveSciHandler ();
-        if (ACPI_FAILURE(Status))
-        {
-            ACPI_ERROR ((AE_INFO,
-                "Could not remove SCI handler"));
-        }
-
         Status = AcpiEvRemoveGlobalLockHandler ();
         if (ACPI_FAILURE(Status))
         {
@@ -311,6 +302,15 @@ AcpiEvTerminate (
         AcpiGbl_EventsInitialized = FALSE;
     }
 
+    /* Remove SCI handlers */
+
+    Status = AcpiEvRemoveAllSciHandlers ();
+    if (ACPI_FAILURE(Status))
+    {
+        ACPI_ERROR ((AE_INFO,
+            "Could not remove SCI handler"));
+    }
+
     /* Deallocate all handler objects installed within GPE info structs */
 
     Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);

Modified: head/sys/contrib/dev/acpica/components/events/evregion.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evregion.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/events/evregion.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -234,18 +234,12 @@ AcpiEvAddressSpaceDispatch (
         {
             RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
 
-            if (RegionObj2->Extra.RegionContext)
-            {
-                /* The handler for this region was already installed */
-
-                ACPI_FREE (RegionContext);
-            }
-            else
+            /*
+             * Save the returned context for use in all accesses to
+             * the handler for this particular region
+             */
+            if (!(RegionObj2->Extra.RegionContext))
             {
-                /*
-                 * Save the returned context for use in all accesses to
-                 * this particular region
-                 */
                 RegionObj2->Extra.RegionContext = RegionContext;
             }
         }
@@ -261,7 +255,6 @@ AcpiEvAddressSpaceDispatch (
         ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
         AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
 
-
     /*
      * Special handling for GenericSerialBus and GeneralPurposeIo:
      * There are three extra parameters that must be passed to the
@@ -424,6 +417,15 @@ AcpiEvDetachRegion(
                 Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
                     HandlerObj->AddressSpace.Context, RegionContext);
 
+                /*
+                 * RegionContext should have been released by the deactivate
+                 * operation. We don't need access to it anymore here.
+                 */
+                if (RegionContext)
+                {
+                    *RegionContext = NULL;
+                }
+
                 /* Init routine may fail, Just ignore errors */
 
                 if (ACPI_FAILURE (Status))

Modified: head/sys/contrib/dev/acpica/components/events/evsci.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evsci.c	Fri Aug 23 23:21:24 2013	(r254744)
+++ head/sys/contrib/dev/acpica/components/events/evsci.c	Fri Aug 23 23:25:58 2013	(r254745)
@@ -61,6 +61,57 @@ AcpiEvSciXruptHandler (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiEvSciDispatch
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status code indicates whether interrupt was handled.
+ *
+ * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvSciDispatch (
+    void)
+{
+    ACPI_SCI_HANDLER_INFO   *SciHandler;
+    ACPI_CPU_FLAGS          Flags;
+    UINT32                  IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+
+
+    ACPI_FUNCTION_NAME (EvSciDispatch);
+
+
+    /* Are there any host-installed SCI handlers? */
+
+    if (!AcpiGbl_SciHandlerList)
+    {
+        return (IntStatus);
+    }
+
+    Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+    /* Invoke all host-installed SCI handlers */
+
+    SciHandler = AcpiGbl_SciHandlerList;
+    while (SciHandler)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list