Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Dec 2013 05:51:02 +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: r259594 - in vendor-sys/acpica/dist: . generate/release generate/unix source/common source/compiler source/components/debugger source/components/dispatcher source/components/events sour...
Message-ID:  <201312190551.rBJ5p2jo066120@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Thu Dec 19 05:51:01 2013
New Revision: 259594
URL: http://svnweb.freebsd.org/changeset/base/259594

Log:
  Import ACPICA 20131218.

Added:
  vendor-sys/acpica/dist/source/tools/examples/examples.h   (contents, props changed)
  vendor-sys/acpica/dist/source/tools/examples/exstubs.c   (contents, props changed)
  vendor-sys/acpica/dist/source/tools/examples/extables.c   (contents, props changed)
Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/generate/release/build.sh
  vendor-sys/acpica/dist/generate/unix/Makefile.config
  vendor-sys/acpica/dist/source/common/adfile.c
  vendor-sys/acpica/dist/source/common/adwalk.c
  vendor-sys/acpica/dist/source/common/dmextern.c
  vendor-sys/acpica/dist/source/common/dmtable.c
  vendor-sys/acpica/dist/source/common/dmtbdump.c
  vendor-sys/acpica/dist/source/common/dmtbinfo.c
  vendor-sys/acpica/dist/source/compiler/aslbtypes.c
  vendor-sys/acpica/dist/source/compiler/asldefine.h
  vendor-sys/acpica/dist/source/compiler/aslerror.c
  vendor-sys/acpica/dist/source/compiler/aslfiles.c
  vendor-sys/acpica/dist/source/compiler/aslglobal.h
  vendor-sys/acpica/dist/source/compiler/asllookup.c
  vendor-sys/acpica/dist/source/compiler/aslmain.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.h
  vendor-sys/acpica/dist/source/compiler/asloperands.c
  vendor-sys/acpica/dist/source/compiler/aslopt.c
  vendor-sys/acpica/dist/source/compiler/asloptions.c
  vendor-sys/acpica/dist/source/compiler/aslstartup.c
  vendor-sys/acpica/dist/source/compiler/aslstubs.c
  vendor-sys/acpica/dist/source/compiler/aslxref.c
  vendor-sys/acpica/dist/source/compiler/dtcompile.c
  vendor-sys/acpica/dist/source/compiler/dtcompiler.h
  vendor-sys/acpica/dist/source/compiler/dtfield.c
  vendor-sys/acpica/dist/source/compiler/dttable.c
  vendor-sys/acpica/dist/source/compiler/dttemplate.h
  vendor-sys/acpica/dist/source/compiler/dtutils.c
  vendor-sys/acpica/dist/source/compiler/readme.txt
  vendor-sys/acpica/dist/source/components/debugger/dbfileio.c
  vendor-sys/acpica/dist/source/components/debugger/dbinput.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsutils.c
  vendor-sys/acpica/dist/source/components/dispatcher/dswexec.c
  vendor-sys/acpica/dist/source/components/dispatcher/dswload.c
  vendor-sys/acpica/dist/source/components/events/evgpeblk.c
  vendor-sys/acpica/dist/source/components/events/evgpeutil.c
  vendor-sys/acpica/dist/source/components/executer/exresnte.c
  vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c
  vendor-sys/acpica/dist/source/components/parser/psopinfo.c
  vendor-sys/acpica/dist/source/components/tables/tbfadt.c
  vendor-sys/acpica/dist/source/components/tables/tbutils.c
  vendor-sys/acpica/dist/source/components/utilities/utaddress.c
  vendor-sys/acpica/dist/source/components/utilities/utalloc.c
  vendor-sys/acpica/dist/source/components/utilities/utcache.c
  vendor-sys/acpica/dist/source/components/utilities/utdebug.c
  vendor-sys/acpica/dist/source/components/utilities/utxfinit.c
  vendor-sys/acpica/dist/source/include/acdisasm.h
  vendor-sys/acpica/dist/source/include/acevents.h
  vendor-sys/acpica/dist/source/include/acglobal.h
  vendor-sys/acpica/dist/source/include/aclocal.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/actbl.h
  vendor-sys/acpica/dist/source/include/actbl1.h
  vendor-sys/acpica/dist/source/include/actbl2.h
  vendor-sys/acpica/dist/source/include/actbl3.h
  vendor-sys/acpica/dist/source/include/actypes.h
  vendor-sys/acpica/dist/source/include/platform/acenv.h
  vendor-sys/acpica/dist/source/include/platform/aclinux.h
  vendor-sys/acpica/dist/source/os_specific/service_layers/osunixdir.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c
  vendor-sys/acpica/dist/source/tools/acpibin/acpibin.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aeexec.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c
  vendor-sys/acpica/dist/source/tools/acpinames/anmain.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asremove.c
  vendor-sys/acpica/dist/source/tools/examples/examples.c

Modified: vendor-sys/acpica/dist/changes.txt
==============================================================================
--- vendor-sys/acpica/dist/changes.txt	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/changes.txt	Thu Dec 19 05:51:01 2013	(r259594)
@@ -1,4 +1,106 @@
 ----------------------------------------
+18 December 2013. Summary of changes for version 20131218:
+
+Global note: The ACPI 5.0A specification was released this month. There 
+are no changes needed for ACPICA since this release of ACPI is an 
+errata/clarification release. The specification is available at 
+acpi.info. 
+
+
+1) ACPICA kernel-resident subsystem:
+
+Added validation of the XSDT root table if it is present. Some older 
+platforms contain an XSDT that is ill-formed or otherwise invalid (such 
+as containing some or all entries that are NULL pointers). This change 
+adds a new function to validate the XSDT before actually using it. If the 
+XSDT is found to be invalid, ACPICA will now automatically fall back to 
+using the RSDT instead. Original implementation by Zhao Yakui. Ported to 
+ACPICA and enhanced by Lv Zheng and Bob Moore.
+
+Added a runtime option to ignore the XSDT and force the use of the RSDT. 
+This change adds a runtime option that will force ACPICA to use the RSDT 
+instead of the XSDT (AcpiGbl_DoNotUseXsdt). Although the ACPI spec 
+requires that an XSDT be used instead of the RSDT, the XSDT has been 
+found to be corrupt or ill-formed on some machines. Lv Zheng.
+
+Added a runtime option to favor 32-bit FADT register addresses over the 
+64-bit addresses. This change adds an option to favor 32-bit FADT 
+addresses when there is a conflict between the 32-bit and 64-bit versions 
+of the same register. The default behavior is to use the 64-bit version 
+in accordance with the ACPI specification. This can now be overridden via 
+the AcpiGbl_Use32BitFadtAddresses flag. ACPICA BZ 885. Lv Zheng.
+
+During the change above, the internal "Convert FADT" and "Verify FADT" 
+functions have been merged to simplify the code, making it easier to 
+understand and maintain. ACPICA BZ 933.
+
+Improve exception reporting and handling for GPE block installation. 
+Return an actual status from AcpiEvGetGpeXruptBlock and don't clobber the 
+status when exiting AcpiEvInstallGpeBlock. ACPICA BZ 1019.
+
+Added helper macros to extract bus/segment numbers from the HEST table. 
+This change adds two macros to extract the encoded bus and segment 
+numbers from the HEST Bus field - ACPI_HEST_BUS and ACPI_HEST_SEGMENT. 
+Betty Dall <betty.dall@hp.com>
+
+Removed the unused ACPI_FREE_BUFFER macro. This macro is no longer used 
+by ACPICA. It is not a public macro, so it should have no effect on 
+existing OSV code. 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.
+
+  Current Release:
+    Non-Debug Version:  96.1K Code, 27.0K Data, 123.1K Total
+    Debug Version:     185.6K Code, 77.3K Data, 262.9K Total
+  Previous Release:
+    Non-Debug Version:  95.9K Code, 27.0K Data, 122.9K Total
+    Debug Version:     185.1K Code, 77.2K Data, 262.3K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Improved pathname support for emitted External() 
+statements. This change adds full pathname support for external names 
+that have been resolved internally by the inclusion of additional ACPI 
+tables (via the iASL -e option). Without this change, the disassembler 
+can emit multiple externals for the same object, or it become confused 
+when the Scope() operator is used on an external object. Overall, greatly 
+improves the ability to actually recompile the emitted ASL code when 
+objects a referenced across multiple ACPI tables. Reported by Michael 
+Tsirkin (mst@redhat.com).
+
+Tests/ASLTS: Updated functional control suite to execute with no errors. 
+David Box. Fixed several errors related to the testing of the interpreter 
+slack mode. Lv Zheng.
+
+iASL: Added support to detect names that are declared within a control 
+method, but are unused (these are temporary names that are only valid 
+during the time the method is executing). A remark is issued for these 
+cases. ACPICA BZ 1022.
+
+iASL: Added full support for the DBG2 table. Adds full disassembler, 
+table compiler, and template generator support for the DBG2 table (Debug 
+Port 2 table).
+
+iASL: Added full support for the PCCT table, update the table definition. 
+Updates the PCCT table definition in the actbl3.h header and adds table 
+compiler and template generator support.
+
+iASL: Added an option to emit only error messages (no warnings/remarks). 
+The -ve option will enable only error messages, warnings and remarks are 
+suppressed. This can simplify debugging when only the errors are 
+important, such as when an ACPI table is disassembled and there are many 
+warnings and remarks -- but only the actual errors are of real interest.
+
+Example ACPICA code (source/tools/examples): Updated the example code so 
+that it builds to an actual working program, not just example code. Added 
+ACPI tables and execution of an example control method in the DSDT. Added 
+makefile support for Unix generation.
+
+----------------------------------------
 15 November 2013. Summary of changes for version 20131115:
 
 This release is available at https://acpica.org/downloads

Modified: vendor-sys/acpica/dist/generate/release/build.sh
==============================================================================
--- vendor-sys/acpica/dist/generate/release/build.sh	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/generate/release/build.sh	Thu Dec 19 05:51:01 2013	(r259594)
@@ -95,9 +95,9 @@ convert_to_unix_line_terminators()
 	# Convert all CR/LF pairs to Unix format (LF only)
 	#
 	cd $TEMP_DIR
-	echo Starting CR/LF to LF Conversion
-	find . -name "*" | xargs $DOS2UNIX
-	echo Completed CR/LF to LF Conversion
+	echo "Starting CR/LF to LF (UNIX) full source conversion"
+	find . -name "*" | xargs $DOS2UNIX -q
+	echo "Completed CR/LF to LF (UNIX) full source conversion"
 	cd ..
 }
 
@@ -108,9 +108,9 @@ convert_to_dos_line_terminators()
 	# Note: Checks shell scripts only (*.sh)
 	#
 	cd $TEMP_DIR
-	echo Starting LF to CR/LF Conversion
-	find . -name "*.sh" | xargs $UNIX2DOS
-	echo Completed LF to CR/LF Conversion
+	echo "Starting LF to CR/LF (DOS) script conversion"
+	find . -name "*.sh" | xargs $UNIX2DOS -q
+	echo "Completed LF to CR/LF (DOS) script conversion"
 	cd ..
 }
 
@@ -158,7 +158,7 @@ build_windows_package()
 	#
 	cd $TEMP_DIR
 	rm -r -f ../$TARGET_DIR/$PACKAGE_FILENAME
-	$ZIP_UTILITY -add -max -dir -sort=name ../$TARGET_DIR/$PACKAGE_FILENAME
+	$ZIP_UTILITY -silent -add -max -dir -sort=name ../$TARGET_DIR/$PACKAGE_FILENAME
 	cd ..
 }
 

Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config
==============================================================================
--- vendor-sys/acpica/dist/generate/unix/Makefile.config	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/generate/unix/Makefile.config	Thu Dec 19 05:51:01 2013	(r259594)
@@ -33,7 +33,7 @@
 #     not be necessary to change it.
 #
 .SUFFIXES :
-PROGS = acpibin acpidump acpiexec acpihelp acpinames acpisrc acpixtract iasl
+PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
 HOST ?= _CYGWIN
 CC =    gcc
 
@@ -102,6 +102,7 @@ ACPICA_UTILITIES =      $(ACPICA_CORE)/u
 #
 ACPIBIN =               $(ACPICA_TOOLS)/acpibin
 ACPIDUMP =              $(ACPICA_TOOLS)/acpidump
+ACPIEXAMPLES =          $(ACPICA_TOOLS)/examples
 ACPIEXEC =              $(ACPICA_TOOLS)/acpiexec
 ACPIHELP =              $(ACPICA_TOOLS)/acpihelp
 ACPINAMES =             $(ACPICA_TOOLS)/acpinames

Modified: vendor-sys/acpica/dist/source/common/adfile.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/adfile.c	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/source/common/adfile.c	Thu Dec 19 05:51:01 2013	(r259594)
@@ -199,6 +199,7 @@ FlGenerateFilename (
 {
     char                    *Position;
     char                    *NewFilename;
+    char                    *DirectoryPosition;
 
 
     /*
@@ -211,8 +212,10 @@ FlGenerateFilename (
 
     /* Try to find the last dot in the filename */
 
+    DirectoryPosition = strrchr (NewFilename, '/');
     Position = strrchr (NewFilename, '.');
-    if (Position)
+
+    if (Position && (Position > DirectoryPosition))
     {
         /* Tack on the new suffix */
 

Modified: vendor-sys/acpica/dist/source/common/adwalk.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/adwalk.c	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/source/common/adwalk.c	Thu Dec 19 05:51:01 2013	(r259594)
@@ -469,8 +469,9 @@ AcpiDmFindOrphanDescending (
             !ChildOp->Common.Node)
         {
             AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String,
-                            NULL, &Path);
-            AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s  */\n", Op->Common.AmlOpName, Path);
+                NULL, &Path);
+            AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s  */\n",
+                Op->Common.AmlOpName, Path);
             ACPI_FREE (Path);
 
             NextOp = Op->Common.Next;
@@ -478,22 +479,26 @@ AcpiDmFindOrphanDescending (
             {
                 /* This NamePath has no args, assume it is an integer */
 
-                AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+                AcpiDmAddOpToExternalList (ChildOp,
+                    ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
                 return (AE_OK);
             }
 
             ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
-            AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op));
+            AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n",
+                ArgCount, AcpiDmCountChildren (Op));
 
             if (ArgCount < 1)
             {
                 /* One Arg means this is just a Store(Name,Target) */
 
-                AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+                AcpiDmAddOpToExternalList (ChildOp,
+                    ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
                 return (AE_OK);
             }
 
-            AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+            AcpiDmAddOpToExternalList (ChildOp,
+                ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0);
         }
         break;
 #endif
@@ -509,7 +514,8 @@ AcpiDmFindOrphanDescending (
             {
                 /* This NamePath has no args, assume it is an integer */
 
-                AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+                AcpiDmAddOpToExternalList (ChildOp,
+                    ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
                 return (AE_OK);
             }
 
@@ -518,11 +524,13 @@ AcpiDmFindOrphanDescending (
             {
                 /* One Arg means this is just a Store(Name,Target) */
 
-                AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+                AcpiDmAddOpToExternalList (ChildOp,
+                    ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
                 return (AE_OK);
             }
 
-            AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+            AcpiDmAddOpToExternalList (ChildOp,
+                ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0);
         }
         break;
 
@@ -554,7 +562,8 @@ AcpiDmFindOrphanDescending (
                      /* And namepath is the first argument */
                      (ParentOp->Common.Value.Arg == Op))
                 {
-                    AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+                    AcpiDmAddOpToExternalList (Op,
+                        Op->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
                     break;
                 }
             }
@@ -564,8 +573,8 @@ AcpiDmFindOrphanDescending (
              * operator) - it *must* be a method invocation, nothing else is
              * grammatically possible.
              */
-            AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
-
+            AcpiDmAddOpToExternalList (Op,
+                Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0);
         }
         break;
 
@@ -741,6 +750,7 @@ AcpiDmXrefDescendingOp (
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_OPERAND_OBJECT     *Object;
     UINT32                  ParamCount = 0;
+    char                    *Pathname;
 
 
     WalkState = Info->WalkState;
@@ -808,11 +818,14 @@ AcpiDmXrefDescendingOp (
      * The namespace is also used as a lookup table for references to resource
      * descriptors and the fields within them.
      */
+    Node = NULL;
     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
                 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
                 WalkState, &Node);
     if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL))
     {
+        /* Node was created by an External() statement */
+
         Status = AE_NOT_FOUND;
     }
 
@@ -830,16 +843,28 @@ AcpiDmXrefDescendingOp (
             if (!(Op->Asl.Parent &&
                 (Op->Asl.Parent->Asl.AmlOpcode == AML_COND_REF_OF_OP)))
             {
-                AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0);
+                if (Node)
+                {
+                    AcpiDmAddNodeToExternalList (Node,
+                        (UINT8) ObjectType, 0, 0);
+                }
+                else
+                {
+                    AcpiDmAddOpToExternalList (Op, Path,
+                        (UINT8) ObjectType, 0, 0);
+                }
             }
         }
     }
 
     /*
-     * Found the node in external table, add it to external list
-     * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
+     * Found the node, but check if it came from an external table.
+     * Add it to external list. Note: Node->OwnerId == 0 indicates
+     * one of the built-in ACPI Names (_OS_ etc.) which can safely
+     * be ignored.
      */
-    else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId)
+    else if (Node->OwnerId &&
+            (WalkState->OwnerId != Node->OwnerId))
     {
         ObjectType2 = ObjectType;
 
@@ -853,7 +878,16 @@ AcpiDmXrefDescendingOp (
             }
         }
 
-        AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount | 0x80);
+        Pathname = AcpiNsGetExternalPathname (Node);
+        if (!Pathname)
+        {
+            return (AE_NO_MEMORY);
+        }
+
+        AcpiDmAddNodeToExternalList (Node, (UINT8) ObjectType2,
+            ParamCount, ACPI_EXT_RESOLVED_REFERENCE);
+
+        ACPI_FREE (Pathname);
         Op->Common.Node = Node;
     }
     else

Modified: vendor-sys/acpica/dist/source/common/dmextern.c
==============================================================================
--- vendor-sys/acpica/dist/source/common/dmextern.c	Thu Dec 19 05:36:41 2013	(r259593)
+++ vendor-sys/acpica/dist/source/common/dmextern.c	Thu Dec 19 05:51:01 2013	(r259594)
@@ -104,10 +104,19 @@ AcpiDmNormalizeParentPrefix (
     char                    *Path);
 
 static void
-AcpiDmAddToExternalListFromFile (
+AcpiDmAddPathToExternalList (
     char                    *Path,
     UINT8                   Type,
-    UINT32                  Value);
+    UINT32                  Value,
+    UINT16                  Flags);
+
+static ACPI_STATUS
+AcpiDmCreateNewExternal (
+    char                    *ExternalPath,
+    char                    *InternalPath,
+    UINT8                   Type,
+    UINT32                  Value,
+    UINT16                  Flags);
 
 
 /*******************************************************************************
@@ -349,196 +358,6 @@ AcpiDmClearExternalFileList (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiDmAddToExternalList
- *
- * PARAMETERS:  Op                  - Current parser Op
- *              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.
- *
- ******************************************************************************/
-
-void
-AcpiDmAddToExternalList (
-    ACPI_PARSE_OBJECT       *Op,
-    char                    *Path,
-    UINT8                   Type,
-    UINT32                  Value)
-{
-    char                    *ExternalPath;
-    char                    *Fullpath = NULL;
-    ACPI_EXTERNAL_LIST      *NewExternal;
-    ACPI_EXTERNAL_LIST      *NextExternal;
-    ACPI_EXTERNAL_LIST      *PrevExternal = NULL;
-    ACPI_STATUS             Status;
-    BOOLEAN                 Resolved = FALSE;
-
-
-    if (!Path)
-    {
-        return;
-    }
-
-    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++;
-    }
-
-    /* Externalize the ACPI pathname */
-
-    Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
-                NULL, &ExternalPath);
-    if (ACPI_FAILURE (Status))
-    {
-        return;
-    }
-
-    /*
-     * 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);
-        if (Fullpath)
-        {
-            /* Set new external path */
-
-            ACPI_FREE (ExternalPath);
-            ExternalPath = Fullpath;
-        }
-    }
-
-    /* Check all existing externals to ensure no duplicates */
-
-    NextExternal = AcpiGbl_ExternalList;
-    while (NextExternal)
-    {
-        if (!ACPI_STRCMP (ExternalPath, 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,
-                    "External method arg count mismatch %s: Current %u, attempted %u",
-                    NextExternal->Path, NextExternal->Value, Value));
-            }
-
-            /* Allow upgrade of type from ANY */
-
-            else if (NextExternal->Type == ACPI_TYPE_ANY)
-            {
-                NextExternal->Type = Type;
-                NextExternal->Value = Value;
-            }
-
-            ACPI_FREE (ExternalPath);
-            return;
-        }
-
-        NextExternal = NextExternal->Next;
-    }
-
-    /* Allocate and init a new External() descriptor */
-
-    NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
-    if (!NewExternal)
-    {
-        ACPI_FREE (ExternalPath);
-        return;
-    }
-
-    NewExternal->Path = ExternalPath;
-    NewExternal->Type = Type;
-    NewExternal->Value = Value;
-    NewExternal->Resolved = Resolved;
-    NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
-
-    /* Was the external path with parent prefix normalized to a fullpath? */
-
-    if (Fullpath == ExternalPath)
-    {
-        /* Get new internal path */
-
-        Status = AcpiNsInternalizeName (ExternalPath, &Path);
-        if (ACPI_FAILURE (Status))
-        {
-            ACPI_FREE (ExternalPath);
-            ACPI_FREE (NewExternal);
-            return;
-        }
-
-        /* Set flag to indicate External->InternalPath need to be freed */
-
-        NewExternal->Flags |= ACPI_IPATH_ALLOCATED;
-    }
-
-    NewExternal->InternalPath = Path;
-
-    /* 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:    AcpiDmGetExternalsFromFile
  *
  * PARAMETERS:  None
@@ -619,7 +438,8 @@ AcpiDmGetExternalsFromFile (
         AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
             Gbl_ExternalRefFilename, ArgCount, MethodName);
 
-        AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80);
+        AcpiDmAddPathToExternalList (MethodName, ACPI_TYPE_METHOD,
+            ArgCount, (ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_FILE));
         ImportCount++;
     }
 
@@ -644,11 +464,13 @@ AcpiDmGetExternalsFromFile (
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiDmAddToExternalListFromFile
+ * FUNCTION:    AcpiDmAddOpToExternalList
  *
- * PARAMETERS:  Path                - Internal (AML) path to the object
+ * PARAMETERS:  Op                  - Current parser Op
+ *              Path                - Internal (AML) path to the object
  *              Type                - ACPI object type to be added
  *              Value               - Arg count if adding a Method object
+ *              Flags               - To be passed to the external object
  *
  * RETURN:      None
  *
@@ -656,60 +478,315 @@ AcpiDmGetExternalsFromFile (
  *              will in turn be later emitted as an External() declaration
  *              in the disassembled output.
  *
+ *              This function handles the most common case where the referenced
+ *              name is simply not found in the constructed namespace.
+ *
  ******************************************************************************/
 
-static void
-AcpiDmAddToExternalListFromFile (
+void
+AcpiDmAddOpToExternalList (
+    ACPI_PARSE_OBJECT       *Op,
     char                    *Path,
     UINT8                   Type,
-    UINT32                  Value)
+    UINT32                  Value,
+    UINT16                  Flags)
 {
-    char                    *InternalPath;
     char                    *ExternalPath;
-    ACPI_EXTERNAL_LIST      *NewExternal;
-    ACPI_EXTERNAL_LIST      *NextExternal;
-    ACPI_EXTERNAL_LIST      *PrevExternal = NULL;
+    char                    *InternalPath = Path;
+    char                    *Temp;
     ACPI_STATUS             Status;
-    BOOLEAN                 Resolved = FALSE;
+
+
+    ACPI_FUNCTION_TRACE (DmAddOpToExternalList);
 
 
     if (!Path)
     {
-        return;
+        return_VOID;
     }
 
-    /* TBD: Add a flags parameter */
+    /* Remove a root backslash if present */
 
-    if (Type == ACPI_TYPE_METHOD)
+    if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
     {
-        if (Value & 0x80)
-        {
-            Resolved = TRUE;
-        }
-        Value &= 0x07;
+        Path++;
+    }
+
+    /* Externalize the pathname */
+
+    Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
+        NULL, &ExternalPath);
+    if (ACPI_FAILURE (Status))
+    {
+        return_VOID;
     }
 
     /*
-     * 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.
+     * 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)
+    {
+        Temp = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
+
+        /* Set new external path */
+
+        ACPI_FREE (ExternalPath);
+        ExternalPath = Temp;
+        if (!Temp)
+        {
+            return_VOID;
+        }
+
+        /* Create the new internal pathname */
+
+        Flags |= ACPI_EXT_INTERNAL_PATH_ALLOCATED;
+        Status = AcpiNsInternalizeName (ExternalPath, &InternalPath);
+        if (ACPI_FAILURE (Status))
+        {
+            ACPI_FREE (ExternalPath);
+            return_VOID;
+        }
+    }
+
+    /* Create the new External() declaration node */
+
+    Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath,
+        Type, Value, Flags);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_FREE (ExternalPath);
+        if (Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED)
+        {
+            ACPI_FREE (InternalPath);
+        }
+    }
+
+    return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmAddNodeToExternalList
+ *
+ * PARAMETERS:  Node                - Namespace node for object to be added
+ *              Type                - ACPI object type to be added
+ *              Value               - Arg count if adding a Method object
+ *              Flags               - To be passed to the external 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.
+ *
+ *              This function handles the case where the referenced name has
+ *              been found in the namespace, but the name originated in a
+ *              table other than the one that is being disassembled (such
+ *              as a table that is added via the iASL -e option).
+ *
+ ******************************************************************************/
+
+void
+AcpiDmAddNodeToExternalList (
+    ACPI_NAMESPACE_NODE     *Node,
+    UINT8                   Type,
+    UINT32                  Value,
+    UINT16                  Flags)
+{
+    char                    *ExternalPath;
+    char                    *InternalPath;
+    char                    *Temp;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (DmAddNodeToExternalList);
+
+
+    if (!Node)
+    {
+        return_VOID;
+    }
+
+    /* Get the full external and internal pathnames to the node */
+
+    ExternalPath = AcpiNsGetExternalPathname (Node);
+    if (!ExternalPath)
+    {
+        return_VOID;
+    }
+
+    Status = AcpiNsInternalizeName (ExternalPath, &InternalPath);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_FREE (ExternalPath);
+        return_VOID;
+    }
+
+    /* Remove the root backslash */
+
+    if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1]))
+    {
+        Temp = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (ExternalPath) + 1);
+        if (!Temp)
+        {
+            return_VOID;
+        }
+
+        ACPI_STRCPY (Temp, &ExternalPath[1]);
+        ACPI_FREE (ExternalPath);
+        ExternalPath = Temp;
+    }
+
+    /* Create the new External() declaration node */
+
+    Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, Type,
+        Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED));
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_FREE (ExternalPath);
+        ACPI_FREE (InternalPath);
+    }
+
+    return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmAddPathToExternalList
+ *
+ * PARAMETERS:  Path                - External name of the object to be added
+ *              Type                - ACPI object type to be added
+ *              Value               - Arg count if adding a Method object
+ *              Flags               - To be passed to the external 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.
+ *
+ *              This function currently is used to add externals via a
+ *              reference file (via the -fe iASL option).
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddPathToExternalList (
+    char                    *Path,
+    UINT8                   Type,
+    UINT32                  Value,
+    UINT16                  Flags)
+{
+    char                    *InternalPath;
+    char                    *ExternalPath;
+    ACPI_STATUS             Status;
+
+
+    ACPI_FUNCTION_TRACE (DmAddPathToExternalList);
+
+
+    if (!Path)
+    {
+        return_VOID;
+    }
+
+    /* Remove a root backslash if present */
+
     if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
     {
         Path++;
     }
 
+    /* Create the internal and external pathnames */
+
+    Status = AcpiNsInternalizeName (Path, &InternalPath);
+    if (ACPI_FAILURE (Status))
+    {
+        return_VOID;
+    }
+
+    Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath,
+        NULL, &ExternalPath);
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_FREE (InternalPath);
+        return_VOID;
+    }
+
+    /* Create the new External() declaration node */
+
+    Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath,
+        Type, Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED));
+    if (ACPI_FAILURE (Status))
+    {
+        ACPI_FREE (ExternalPath);
+        ACPI_FREE (InternalPath);
+    }
+
+    return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmCreateNewExternal
+ *
+ * PARAMETERS:  ExternalPath        - External path to the object
+ *              InternalPath        - Internal (AML) path to the object
+ *              Type                - ACPI object type to be added
+ *              Value               - Arg count if adding a Method object
+ *              Flags               - To be passed to the external object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Common low-level function to insert a new name into the global
+ *              list of Externals which will in turn be later emitted as
+ *              External() declarations in the disassembled output.
+ *
+ *              Note: The external name should not include a root prefix
+ *              (backslash). We do not want External() statements to contain
+ *              a leading '\', as 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.
+ *
+ *              There are two cases that are handled here. For both, we emit
+ *              an External() statement:
+ *              1) The name was simply not found in the namespace.
+ *              2) The name was found, but it originated in a table other than
+ *              the table that is being disassembled.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmCreateNewExternal (
+    char                    *ExternalPath,
+    char                    *InternalPath,
+    UINT8                   Type,
+    UINT32                  Value,
+    UINT16                  Flags)
+{
+    ACPI_EXTERNAL_LIST      *NewExternal;
+    ACPI_EXTERNAL_LIST      *NextExternal;
+    ACPI_EXTERNAL_LIST      *PrevExternal = NULL;
+
+
+    ACPI_FUNCTION_TRACE (DmCreateNewExternal);
+
+
     /* Check all existing externals to ensure no duplicates */
 
     NextExternal = AcpiGbl_ExternalList;
     while (NextExternal)
     {
-        if (!ACPI_STRCMP (Path, NextExternal->Path))
+        if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
         {
             /* Duplicate method, check that the Value (ArgCount) is the same */
 
@@ -717,12 +794,8 @@ AcpiDmAddToExternalListFromFile (
                 (NextExternal->Value != Value))
             {
                 ACPI_ERROR ((AE_INFO,
-                    "(File) External method arg count mismatch %s: Current %u, override to %u",
+                    "External method arg count mismatch %s: Current %u, attempted %u",
                     NextExternal->Path, NextExternal->Value, Value));
-
-                /* Override, since new value came from external reference file */
-
-                NextExternal->Value = Value;
             }
 
             /* Allow upgrade of type from ANY */
@@ -733,44 +806,31 @@ AcpiDmAddToExternalListFromFile (
                 NextExternal->Value = Value;
             }
 
-            return;
+            return_ACPI_STATUS (AE_ALREADY_EXISTS);
         }
 
         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;
+        return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
-    /* Must copy and normalize the input path */
-
-    AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath);
+    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+        "Adding external reference node (%s) type [%s]\n",
+        ExternalPath, AcpiUtGetTypeName (Type)));
 
+    NewExternal->Flags = Flags;
+    NewExternal->Value = Value;
     NewExternal->Path = ExternalPath;
     NewExternal->Type = Type;
-    NewExternal->Value = Value;
-    NewExternal->Resolved = Resolved;
-    NewExternal->Length = (UINT16) ACPI_STRLEN (Path);
+    NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
     NewExternal->InternalPath = InternalPath;

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



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