Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Nov 2012 21:02:00 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243347 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/compon...
Message-ID:  <201211202102.qAKL20dZ093442@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Tue Nov 20 21:01:59 2012
New Revision: 243347
URL: http://svnweb.freebsd.org/changeset/base/243347

Log:
  Merge ACPICA 20121114.

Added:
  head/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
     - copied, changed from r243045, vendor-sys/acpica/dist/source/components/disassembler/dmdeferred.c
Modified:
  head/sys/conf/files
  head/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  head/sys/contrib/dev/acpica/common/adfile.c
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/common/dmextern.c
  head/sys/contrib/dev/acpica/common/dmrestag.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/asllisting.c
  head/sys/contrib/dev/acpica/compiler/asllookup.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.c
  head/sys/contrib/dev/acpica/compiler/prutils.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/dbmethod.c
  head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
  head/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
  head/sys/contrib/dev/acpica/components/executer/exregion.c
  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
  head/sys/contrib/dev/acpica/components/namespace/nsxfname.c
  head/sys/contrib/dev/acpica/components/resources/rscalc.c
  head/sys/contrib/dev/acpica/components/resources/rscreate.c
  head/sys/contrib/dev/acpica/components/resources/rsdump.c
  head/sys/contrib/dev/acpica/components/resources/rslist.c
  head/sys/contrib/dev/acpica/components/resources/rsmisc.c
  head/sys/contrib/dev/acpica/components/resources/rsxface.c
  head/sys/contrib/dev/acpica/components/utilities/utdelete.c
  head/sys/contrib/dev/acpica/components/utilities/utresrc.c
  head/sys/contrib/dev/acpica/components/utilities/utstate.c
  head/sys/contrib/dev/acpica/components/utilities/uttrack.c
  head/sys/contrib/dev/acpica/include/acdisasm.h
  head/sys/contrib/dev/acpica/include/acmacros.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acrestyp.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/sys/modules/acpi/acpi/Makefile
  head/usr.sbin/acpi/acpidb/Makefile
  head/usr.sbin/acpi/iasl/Makefile
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/disassembler/   (props changed)
  head/sys/contrib/dev/acpica/components/dispatcher/   (props changed)
  head/sys/contrib/dev/acpica/components/executer/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/components/resources/   (props changed)
  head/sys/contrib/dev/acpica/components/utilities/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/conf/files	Tue Nov 20 21:01:59 2012	(r243347)
@@ -294,6 +294,7 @@ contrib/dev/acpica/components/debugger/d
 contrib/dev/acpica/components/debugger/dbutils.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbxface.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmbuffer.c	optional acpi acpi_debug
+contrib/dev/acpica/components/disassembler/dmdeferred.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmnames.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmopcode.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmobject.c	optional acpi acpi_debug

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/changes.txt	Tue Nov 20 21:01:59 2012	(r243347)
@@ -1,4 +1,94 @@
 ----------------------------------------
+14 November 2012. Summary of changes for version 20121114:
+
+This release is available at https://www.acpica.org/downloads
+The ACPI 5.0 specification is available at www.acpi.info
+
+1) ACPICA Kernel-resident Subsystem:
+
+Implemented a performance enhancement for ACPI/AML Package objects. This 
+change greatly increases the performance of Package objects within the 
+interpreter. It changes the processing of reference counts for packages by 
+optimizing for the most common case where the package sub-objects are 
+either Integers, Strings, or Buffers. Increases the overall performance of 
+the ASLTS test suite by 1.5X (Increases the Slack Mode performance by 2X.) 
+Chao Guan. ACPICA BZ 943.
+
+Implemented and deployed common macros to extract flag bits from resource 
+descriptors. Improves readability and maintainability of the code. Fixes a 
+problem with the UART serial bus descriptor for the number of data bits 
+flags (was incorrectly 2 bits, should be 3).
+
+Enhanced the ACPI_GETx and ACPI_SETx macros. Improved the implementation 
+of the macros and changed the SETx macros to the style of (destination, 
+source). Also added ACPI_CASTx companion macros. Lv Zheng.
+
+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.
+
+  Previous Release:
+    Non-Debug Version:  93.9K Code, 25.2K Data, 119.1K Total
+    Debug Version:     175.5K Code, 74.5K Data, 250.0K Total
+  Current Release:
+    Non-Debug Version:  94.3K Code, 25.3K Data, 119.6K Total
+    Debug Version:     175.5K Code, 74.5K Data, 250.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Added the new ACPI 5.0 interrupt sharing flags. This change 
+adds the ShareAndWake and ExclusiveAndWake flags which were added to the 
+Irq, Interrupt, and Gpio resource descriptors in ACPI 5.0. ACPICA BZ 986.
+
+Disassembler: Fixed a problem with external declaration generation. Fixes 
+a problem where an incorrect pathname could be generated for an external 
+declaration if the original reference to the object includes leading 
+carats (^). ACPICA BZ 984.
+
+Debugger: Completed a major update for the Disassemble<method> command. 
+This command was out-of-date and did not properly disassemble control 
+methods that had any reasonable complexity. This fix brings the command up 
+to the same level as the rest of the disassembler. Adds one new file, 
+dmdeferred.c, which is existing code that is now common with the main 
+disassembler and the debugger disassemble command. ACPICA MZ 978.
+
+iASL: Moved the parser entry prototype to avoid a duplicate declaration. 
+Newer versions of Bison emit this prototype, so moved the prototype out of 
+the iASL header to where it is actually used in order to avoid a duplicate 
+declaration.
+
+iASL/Tools: Standardized use of the stream I/O functions:
+  1) Ensure check for I/O error after every fopen/fread/fwrite
+  2) Ensure proper order of size/count arguments for fread/fwrite
+  3) Use test of (Actual != Requested) after all fwrite, and most fread
+  4) Standardize I/O error messages
+Improves reliability and maintainability of the code. Bob Moore, Lv Zheng. 
+ACPICA BZ 981.
+
+Disassembler: Prevent duplicate External() statements. During generation 
+of external statements, detect similar pathnames that are actually 
+duplicates such as these:
+  External (\ABCD)
+  External (ABCD)
+Remove all leading '\' characters from pathnames during the external 
+statement generation so that duplicates will be detected and tossed. 
+ACPICA BZ 985.
+
+Tools: Replace low-level I/O with stream I/O functions. Replace 
+open/read/write/close with the stream I/O equivalents 
+fopen/fread/fwrite/fclose for portability and performance. Lv Zheng, Bob 
+Moore.
+
+AcpiBin: Fix for the dump-to-hex function. Now correctly output the table 
+name header so that AcpiXtract recognizes the output file/table.
+
+iASL: Remove obsolete -2 option flag. Originally intended to force the 
+compiler/disassembler into an ACPI 2.0 mode, this was never implemented 
+and the entire concept is now obsolete.
+
+----------------------------------------
 18 October 2012. Summary of changes for version 20121018:
 
 

Modified: head/sys/contrib/dev/acpica/common/adfile.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adfile.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/common/adfile.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -124,19 +124,24 @@ AdWriteBuffer (
     char                    *Buffer,
     UINT32                  Length)
 {
-    FILE                    *fp;
+    FILE                    *File;
     ACPI_SIZE               Actual;
 
 
-    fp = fopen (Filename, "wb");
-    if (!fp)
+    File = fopen (Filename, "wb");
+    if (!File)
     {
-        printf ("Couldn't open %s\n", Filename);
+        printf ("Could not open file %s\n", Filename);
         return (-1);
     }
 
-    Actual = fwrite (Buffer, (size_t) Length, 1, fp);
-    fclose (fp);
+    Actual = fwrite (Buffer, 1, (size_t) Length, File);
+    if (Actual != Length)
+    {
+        printf ("Could not write to file %s\n", Filename);
+    }
+
+    fclose (File);
     return ((INT32) Actual);
 }
 

Modified: head/sys/contrib/dev/acpica/common/adisasm.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adisasm.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/common/adisasm.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -88,17 +88,6 @@ AdCreateTableHeader (
     char                    *Filename,
     ACPI_TABLE_HEADER       *Table);
 
-static ACPI_STATUS
-AdDeferredParse (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT8                   *Aml,
-    UINT32                  AmlLength);
-
-static ACPI_STATUS
-AdParseDeferredOps (
-    ACPI_PARSE_OBJECT       *Root);
-
-
 /* Stubs for ASL compiler */
 
 #ifndef ACPI_ASL_COMPILER
@@ -753,207 +742,6 @@ AdDisplayTables (
 
 /******************************************************************************
  *
- * FUNCTION:    AdDeferredParse
- *
- * PARAMETERS:  Op                  - Root Op of the deferred opcode
- *              Aml                 - Pointer to the raw AML
- *              AmlLength           - Length of the AML
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Parse one deferred opcode
- *              (Methods, operation regions, etc.)
- *
- *****************************************************************************/
-
-static ACPI_STATUS
-AdDeferredParse (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT8                   *Aml,
-    UINT32                  AmlLength)
-{
-    ACPI_WALK_STATE         *WalkState;
-    ACPI_STATUS             Status;
-    ACPI_PARSE_OBJECT       *SearchOp;
-    ACPI_PARSE_OBJECT       *StartOp;
-    UINT32                  BaseAmlOffset;
-    ACPI_PARSE_OBJECT       *ExtraOp;
-
-
-    ACPI_FUNCTION_TRACE (AdDeferredParse);
-
-
-    fprintf (stderr, ".");
-
-    if (!Aml || !AmlLength)
-    {
-        return_ACPI_STATUS (AE_OK);
-    }
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n",
-        Op->Common.AmlOpName, (char *) &Op->Named.Name));
-
-    WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
-    if (!WalkState)
-    {
-        return_ACPI_STATUS (AE_NO_MEMORY);
-    }
-
-    Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
-                    AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
-    if (ACPI_FAILURE (Status))
-    {
-        return_ACPI_STATUS (Status);
-    }
-
-    /* Parse the method */
-
-    WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
-    Status = AcpiPsParseAml (WalkState);
-
-    /*
-     * We need to update all of the Aml offsets, since the parser thought
-     * that the method began at offset zero. In reality, it began somewhere
-     * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
-     * was just created and update the AmlOffset in each Op
-     */
-    BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
-    StartOp = (Op->Common.Value.Arg)->Common.Next;
-    SearchOp = StartOp;
-
-    /* Walk the parse tree */
-
-    while (SearchOp)
-    {
-        SearchOp->Common.AmlOffset += BaseAmlOffset;
-        SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
-    }
-
-    /*
-     * Link the newly parsed subtree into the main parse tree
-     */
-    switch (Op->Common.AmlOpcode)
-    {
-    case AML_BUFFER_OP:
-    case AML_PACKAGE_OP:
-    case AML_VAR_PACKAGE_OP:
-
-        switch (Op->Common.AmlOpcode)
-        {
-        case AML_PACKAGE_OP:
-            ExtraOp = Op->Common.Value.Arg;
-            ExtraOp = ExtraOp->Common.Next;
-            Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
-            break;
-
-        case AML_VAR_PACKAGE_OP:
-        case AML_BUFFER_OP:
-        default:
-            ExtraOp = Op->Common.Value.Arg;
-            Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
-            break;
-        }
-
-        /* Must point all parents to the main tree */
-
-        StartOp = Op;
-        SearchOp = StartOp;
-        while (SearchOp)
-        {
-            if (SearchOp->Common.Parent == ExtraOp)
-            {
-                SearchOp->Common.Parent = Op;
-            }
-            SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    AdParseDeferredOps
- *
- * PARAMETERS:  Root                - Root of the parse tree
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.)
- *
- *****************************************************************************/
-
-static ACPI_STATUS
-AdParseDeferredOps (
-    ACPI_PARSE_OBJECT       *Root)
-{
-    ACPI_PARSE_OBJECT       *Op = Root;
-    ACPI_STATUS             Status = AE_OK;
-    const ACPI_OPCODE_INFO  *OpInfo;
-
-
-    ACPI_FUNCTION_NAME (AdParseDeferredOps);
-    fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
-
-    while (Op)
-    {
-        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
-        if (!(OpInfo->Flags & AML_DEFER))
-        {
-            Op = AcpiPsGetDepthNext (Root, Op);
-            continue;
-        }
-
-        switch (Op->Common.AmlOpcode)
-        {
-        case AML_METHOD_OP:
-        case AML_BUFFER_OP:
-        case AML_PACKAGE_OP:
-        case AML_VAR_PACKAGE_OP:
-
-            Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length);
-            if (ACPI_FAILURE (Status))
-            {
-                return (Status);
-            }
-            break;
-
-        case AML_REGION_OP:
-        case AML_DATA_REGION_OP:
-        case AML_CREATE_QWORD_FIELD_OP:
-        case AML_CREATE_DWORD_FIELD_OP:
-        case AML_CREATE_WORD_FIELD_OP:
-        case AML_CREATE_BYTE_FIELD_OP:
-        case AML_CREATE_BIT_FIELD_OP:
-        case AML_CREATE_FIELD_OP:
-        case AML_BANK_FIELD_OP:
-
-            /* Nothing to do in these cases */
-
-            break;
-
-        default:
-            ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
-                Op->Common.AmlOpName));
-            break;
-        }
-
-        Op = AcpiPsGetDepthNext (Root, Op);
-    }
-
-    fprintf (stderr, "\n");
-    return (Status);
-}
-
-
-/******************************************************************************
- *
  * FUNCTION:    AdGetLocalTables
  *
  * PARAMETERS:  Filename            - Not used
@@ -1191,7 +979,9 @@ AdParseTable (
 
     /* Pass 3: Parse control methods and link their parse trees into the main parse tree */
 
-    Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
+    fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
+    Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
+    fprintf (stderr, "\n");
 
     /* Process Resource Templates */
 

Modified: head/sys/contrib/dev/acpica/common/dmextern.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmextern.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/common/dmextern.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -153,10 +153,17 @@ AcpiDmNormalizeParentPrefix (
     char                    *Fullpath;
     char                    *ParentPath;
     ACPI_SIZE               Length;
+    UINT32                  Index = 0;
 
 
-    /* Search upwards in the parse tree until we reach a namespace node */
+    if (!Op)
+    {
+        return (NULL);
+    }
+
+    /* Search upwards in the parse tree until we reach the next namespace node */
 
+    Op = Op->Common.Parent;
     while (Op)
     {
         if (Op->Common.Node)
@@ -205,6 +212,13 @@ AcpiDmNormalizeParentPrefix (
          * for the required dot separator (ParentPath.Path)
          */
         Length++;
+
+        /* For External() statements, we do not want a leading '\' */
+
+        if (*ParentPath == AML_ROOT_PREFIX)
+        {
+            Index = 1;
+        }
     }
 
     Fullpath = ACPI_ALLOCATE_ZEROED (Length);
@@ -219,7 +233,7 @@ AcpiDmNormalizeParentPrefix (
      *
      * Copy the parent path
      */
-    ACPI_STRCAT (Fullpath, ParentPath);
+    ACPI_STRCPY (Fullpath, &ParentPath[Index]);
 
     /*
      * Add dot separator
@@ -366,7 +380,22 @@ AcpiDmAddToExternalList (
         return;
     }
 
-    /* Externalize the ACPI path */
+    /*
+     * 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++;
+    }
+
+    /* Externalize the ACPI pathname */
 
     Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
                 NULL, &ExternalPath);
@@ -375,8 +404,10 @@ AcpiDmAddToExternalList (
         return;
     }
 
-    /* Get the full pathname from root if "Path" has a parent prefix */
-
+    /*
+     * Get the full pathname from the root if "Path" has one or more
+     * parent prefixes (^). Note: path will not contain a leading '\'.
+     */
     if (*Path == (UINT8) AML_PARENT_PREFIX)
     {
         Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath);

Modified: head/sys/contrib/dev/acpica/common/dmrestag.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmrestag.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/common/dmrestag.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -625,7 +625,7 @@ AcpiGetTagPathname (
     Aml = ACPI_CAST_PTR (AML_RESOURCE,
             &Op->Named.Data[ResourceNode->Value]);
 
-    Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
+    Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
     if (ACPI_FAILURE (Status))
     {
         return (NULL);
@@ -938,7 +938,7 @@ AcpiDmFindResources (
                  * resource descriptors to the namespace, as children of the
                  * buffer node.
                  */
-                if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
+                if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (NULL, Op)))
                 {
                     Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
                     AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
@@ -991,7 +991,7 @@ AcpiDmAddResourcesToNamespace (
      * Insert each resource into the namespace
      * NextOp contains the Aml pointer and the Aml length
      */
-    AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
+    AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
         (ACPI_SIZE) NextOp->Common.Value.Integer,
         AcpiDmAddResourceToNamespace, BufferNode);
 }

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -50,6 +50,15 @@
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("aslcompile")
 
+/*
+ * Main parser entry
+ * External is here in case the parser emits the same external in the
+ * generated header. (Newer versions of Bison)
+ */
+int
+AslCompilerparse(
+    void);
+
 /* Local prototypes */
 
 static void
@@ -274,7 +283,7 @@ FlConsumeAnsiComment (
     BOOLEAN                 ClosingComment = FALSE;
 
 
-    while (fread (&Byte, 1, 1, Handle))
+    while (fread (&Byte, 1, 1, Handle) == 1)
     {
         /* Scan until comment close is found */
 
@@ -317,7 +326,7 @@ FlConsumeNewComment (
     UINT8                   Byte;
 
 
-    while (fread (&Byte, 1, 1, Handle))
+    while (fread (&Byte, 1, 1, Handle) == 1)
     {
         Status->Offset++;
 
@@ -368,7 +377,7 @@ FlCheckForAscii (
 
     /* Read the entire file */
 
-    while (fread (&Byte, 1, 1, Handle))
+    while (fread (&Byte, 1, 1, Handle) == 1)
     {
         /* Ignore comment fields (allow non-ascii within) */
 

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Tue Nov 20 21:01:59 2012	(r243347)
@@ -86,10 +86,6 @@
 /*
  * Main ASL parser - generated from flex/bison, lex/yacc, etc.
  */
-int
-AslCompilerparse(
-    void);
-
 ACPI_PARSE_OBJECT *
 AslDoError (
     void);

Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslerror.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslerror.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -294,7 +294,7 @@ AePrintException (
                         else
                         {
                             RActual = fread (&SourceByte, 1, 1, SourceFile);
-                            if (!RActual)
+                            if (RActual != 1)
                             {
                                 fprintf (OutputFile,
                                     "[*** iASL: Read error on source code temp file %s ***]",
@@ -304,8 +304,20 @@ AePrintException (
                             {
                                 while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256))
                                 {
-                                    fwrite (&SourceByte, 1, 1, OutputFile);
+                                    if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
+                                    {
+                                        printf ("[*** iASL: Write error on output file ***]\n");
+                                        return;
+                                    }
+
                                     RActual = fread (&SourceByte, 1, 1, SourceFile);
+                                    if (RActual != 1)
+                                    {
+                                        fprintf (OutputFile,
+                                            "[*** iASL: Read error on source code temp file %s ***]",
+                                            Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+                                        return;
+                                    }
                                     Total++;
                                 }
 

Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfiles.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslfiles.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -143,15 +143,14 @@ FlOpenFile (
 
 
     File = fopen (Filename, Mode);
-
-    Gbl_Files[FileId].Filename = Filename;
-    Gbl_Files[FileId].Handle   = File;
-
     if (!File)
     {
         FlFileError (FileId, ASL_MSG_OPEN);
         AslAbort ();
     }
+
+    Gbl_Files[FileId].Filename = Filename;
+    Gbl_Files[FileId].Handle   = File;
 }
 
 
@@ -216,7 +215,7 @@ FlReadFile (
     /* Read and check for error */
 
     Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle);
-    if (Actual != Length)
+    if (Actual < Length)
     {
         if (feof (Gbl_Files[FileId].Handle))
         {
@@ -659,16 +658,17 @@ FlOpenIncludeWithPrefix (
     /* Attempt to open the file, push if successful */
 
     IncludeFile = fopen (Pathname, "r");
-    if (IncludeFile)
+    if (!IncludeFile)
     {
-        /* Push the include file on the open input file stack */
-
-        AslPushInputFileStack (IncludeFile, Pathname);
-        return (IncludeFile);
+        fprintf (stderr, "Could not open include file %s\n", Pathname);
+        ACPI_FREE (Pathname);
+        return (NULL);
     }
 
-    ACPI_FREE (Pathname);
-    return (NULL);
+    /* Push the include file on the open input file stack */
+
+    AslPushInputFileStack (IncludeFile, Pathname);
+    return (IncludeFile);
 }
 
 
@@ -952,7 +952,7 @@ FlOpenMiscOutputFiles (
         return (AE_OK);
     }
 
-   /* Create/Open a combined source output file */
+    /* Create/Open a combined source output file */
 
     Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
     if (!Filename)

Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Nov 20 21:01:59 2012	(r243347)
@@ -137,7 +137,6 @@ ASL_EXTERN BOOLEAN                  ASL_
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
 
-ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);

Modified: head/sys/contrib/dev/acpica/compiler/asllisting.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asllisting.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/asllisting.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -135,6 +135,10 @@ LsTreeWriteWalk (
     UINT32                  Level,
     void                    *Context);
 
+static UINT32
+LsReadAmlOutputFile (
+    UINT8                   *Buffer);
+
 
 /*******************************************************************************
  *
@@ -1282,6 +1286,38 @@ LsDoHexOutput (
 
 /*******************************************************************************
  *
+ * FUNCTION:    LsReadAmlOutputFile
+ *
+ * PARAMETERS:  Buffer              - Where to return data
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Read a line of the AML output prior to formatting the data
+ *
+ ******************************************************************************/
+
+static UINT32
+LsReadAmlOutputFile (
+    UINT8                   *Buffer)
+{
+    UINT32                  Actual;
+
+
+    Actual = fread (Buffer, 1, HEX_TABLE_LINE_SIZE,
+        Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+
+    if (ferror (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle))
+    {
+        FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
+        AslAbort ();
+    }
+
+    return (Actual);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    LsDoHexOutputC
  *
  * PARAMETERS:  None
@@ -1319,8 +1355,7 @@ LsDoHexOutputC (
     {
         /* Read enough bytes needed for one output line */
 
-        LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
-                        Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+        LineLength = LsReadAmlOutputFile (FileData);
         if (!LineLength)
         {
             break;
@@ -1407,8 +1442,7 @@ LsDoHexOutputAsl (
     {
         /* Read enough bytes needed for one output line */
 
-        LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
-                        Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+        LineLength = LsReadAmlOutputFile (FileData);
         if (!LineLength)
         {
             break;
@@ -1494,8 +1528,7 @@ LsDoHexOutputAsm (
     {
         /* Read enough bytes needed for one output line */
 
-        LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
-                        Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+        LineLength = LsReadAmlOutputFile (FileData);
         if (!LineLength)
         {
             break;

Modified: head/sys/contrib/dev/acpica/compiler/asllookup.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asllookup.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/asllookup.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -329,16 +329,19 @@ LsDoOneNamespaceObject (
 
         case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
 
-            if (Node->Flags & 0x80)
+            FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+                "   [Field Offset    0x%.4X Bits 0x%.4X Bytes] ",
+                Node->Value, Node->Value / 8);
+
+            if (Node->Flags & ANOBJ_IS_REFERENCED)
             {
                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
-                    "   [Field Offset    0x%.4X Bits 0x%.4X Bytes]",
-                    Node->Value, Node->Value / 8);
+                    "Referenced");
             }
             else
             {
                 FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
-                    "   [Field Offset    0x%.4X Bytes]", Node->Value);
+                    "Name not referenced");
             }
             break;
 

Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmain.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslmain.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -100,7 +100,7 @@ AslDoResponseFile (
 
 
 #define ASL_TOKEN_SEPARATORS    " \t\n"
-#define ASL_SUPPORTED_OPTIONS   "@:2b|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:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z"
 
 
 /*******************************************************************************
@@ -171,7 +171,6 @@ Options (
     ACPI_OPTION ("-dc [file]",      "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 ("-2",              "Emit ACPI 2.0 compatible ASL code");
     ACPI_OPTION ("-g",              "Get ACPI tables and write to files (*.dat)");
     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
 
@@ -473,11 +472,6 @@ AslDoOptions (
         break;
 
 
-    case '2':   /* ACPI 2.0 compatibility mode */
-        Gbl_Acpi2 = TRUE;
-        break;
-
-
     case 'b':   /* Debug output options */
         switch (AcpiGbl_Optarg[0])
         {

Modified: head/sys/contrib/dev/acpica/compiler/aslstartup.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslstartup.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/aslstartup.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -337,6 +337,13 @@ AslDoOneFile (
             return (Status);
         }
 
+#if 0
+        /* TBD: Handle additional output files for disassembler */
+
+        Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
+        LsDisplayNamespace ();
+#endif
+
         /* Shutdown compiler and ACPICA subsystem */
 
         AeClearErrorLog ();

Modified: head/sys/contrib/dev/acpica/compiler/dttemplate.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/dttemplate.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/dttemplate.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -280,6 +280,7 @@ DtCreateOneTemplate (
     char                    *DisasmFilename;
     FILE                    *File;
     ACPI_STATUS             Status = AE_OK;
+    ACPI_SIZE               Actual;
 
 
     /* New file will have a .asl suffix */
@@ -334,18 +335,32 @@ DtCreateOneTemplate (
     }
     else
     {
-        /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */
+        /* Special ACPI tables - DSDT, SSDT, FADT, RSDP */
 
         AcpiOsPrintf (" */\n\n");
         if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
         {
-            fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File);
+            Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File);
+            if (Actual != sizeof (TemplateDsdt) -1)
+            {
+                fprintf (stderr,
+                    "Could not write to output file %s\n", DisasmFilename);
+                Status = AE_ERROR;
+                goto Cleanup;
+            }
         }
         else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
         {
-            fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File);
+            Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File);
+            if (Actual != sizeof (TemplateSsdt) -1)
+            {
+                fprintf (stderr,
+                    "Could not write to output file %s\n", DisasmFilename);
+                Status = AE_ERROR;
+                goto Cleanup;
+            }
         }
-        else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
+        else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */
         {
             AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
                 TemplateFacs));
@@ -359,7 +374,8 @@ DtCreateOneTemplate (
         {
             fprintf (stderr,
                 "%4.4s, Unrecognized ACPI table signature\n", Signature);
-            return (AE_ERROR);
+            Status = AE_ERROR;
+            goto Cleanup;
         }
     }
 
@@ -367,6 +383,7 @@ DtCreateOneTemplate (
         "Created ACPI table template for [%4.4s], written to \"%s\"\n",
         Signature, DisasmFilename);
 
+Cleanup:
     fclose (File);
     AcpiOsRedirectOutput (stdout);
     ACPI_FREE (DisasmFilename);

Modified: head/sys/contrib/dev/acpica/compiler/prutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/prutils.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/compiler/prutils.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -337,16 +337,17 @@ PrOpenIncludeWithPrefix (
     /* Attempt to open the file, push if successful */
 
     IncludeFile = fopen (Pathname, "r");
-    if (IncludeFile)
+    if (!IncludeFile)
     {
-        /* Push the include file on the open input file stack */
-
-        PrPushInputFileStack (IncludeFile, Pathname);
-        return (IncludeFile);
+        fprintf (stderr, "Could not open include file %s\n", Pathname);
+        ACPI_FREE (Pathname);
+        return (NULL);
     }
 
-    ACPI_FREE (Pathname);
-    return (NULL);
+    /* Push the include file on the open input file stack */
+
+    PrPushInputFileStack (IncludeFile, Pathname);
+    return (IncludeFile);
 }
 
 

Modified: head/sys/contrib/dev/acpica/components/debugger/dbfileio.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbfileio.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/components/debugger/dbfileio.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -135,17 +135,16 @@ AcpiDbOpenDebugFile (
 
     AcpiDbCloseDebugFile ();
     AcpiGbl_DebugFile = fopen (Name, "w+");
-    if (AcpiGbl_DebugFile)
-    {
-        AcpiOsPrintf ("Debug output file %s opened\n", Name);
-        ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
-        AcpiGbl_DbOutputToFile = TRUE;
-    }
-    else
+    if (!AcpiGbl_DebugFile)
     {
         AcpiOsPrintf ("Could not open debug file %s\n", Name);
+        return;
     }
 
+    AcpiOsPrintf ("Debug output file %s opened\n", Name);
+    ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
+    AcpiGbl_DbOutputToFile = TRUE;
+
 #endif
 }
 #endif
@@ -288,7 +287,7 @@ AcpiDbReadTable (
     {
         /* Read the table header */
 
-        if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
+        if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) !=
                 sizeof (ACPI_TABLE_HEADER))
         {
             AcpiOsPrintf ("Could not read the table header\n");
@@ -387,7 +386,6 @@ AcpiDbReadTable (
     AcpiOsFree (*Table);
     *Table = NULL;
     *TableLength = 0;
-
     return (AE_ERROR);
 }
 
@@ -485,15 +483,15 @@ AcpiDbReadTableFromFile (
     char                    *Filename,
     ACPI_TABLE_HEADER       **Table)
 {
-    FILE                    *fp;
+    FILE                    *File;
     UINT32                  TableLength;
     ACPI_STATUS             Status;
 
 
     /* Open the file */
 
-    fp = fopen (Filename, "rb");
-    if (!fp)
+    File = fopen (Filename, "rb");
+    if (!File)
     {
         AcpiOsPrintf ("Could not open input file %s\n", Filename);
         return (AE_ERROR);
@@ -502,8 +500,8 @@ AcpiDbReadTableFromFile (
     /* Get the entire file */
 
     fprintf (stderr, "Loading Acpi table from file %s\n", Filename);
-    Status = AcpiDbReadTable (fp, Table, &TableLength);
-    fclose(fp);
+    Status = AcpiDbReadTable (File, Table, &TableLength);
+    fclose(File);
 
     if (ACPI_FAILURE (Status))
     {

Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Tue Nov 20 19:23:44 2012	(r243346)
+++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c	Tue Nov 20 21:01:59 2012	(r243347)
@@ -100,6 +100,7 @@ enum AcpiExDebuggerCommands
     CMD_CLOSE,
     CMD_DEBUG,
     CMD_DISASSEMBLE,
+    CMD_DISASM,
     CMD_DUMP,
     CMD_ENABLEACPI,
     CMD_EVALUATE,
@@ -170,6 +171,7 @@ static const ACPI_DB_COMMAND_INFO   Acpi
     {"CLOSE",        0},
     {"DEBUG",        1},
     {"DISASSEMBLE",  1},
+    {"DISASM",       1},
     {"DUMP",         1},
     {"ENABLEACPI",   0},
     {"EVALUATE",     1},
@@ -796,6 +798,7 @@ AcpiDbCommandDispatch (
         break;
 
     case CMD_DISASSEMBLE:
+    case CMD_DISASM:
         (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
         break;
 

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



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