svn commit: r284583 - in head/sys: contrib/dev/acpica contrib/dev/acpica/common contrib/dev/acpica/compiler contrib/dev/acpica/components/debugger contrib/dev/acpica/components/disassembler contrib...

Jung-uk Kim jkim at FreeBSD.org
Thu Jun 18 23:14:54 UTC 2015


Author: jkim
Date: Thu Jun 18 23:14:45 2015
New Revision: 284583
URL: https://svnweb.freebsd.org/changeset/base/284583

Log:
  Merge ACPICA 20150619.

Added:
  head/sys/contrib/dev/acpica/include/acclib.h
     - copied unchanged from r284563, vendor-sys/acpica/dist/source/include/acclib.h
Modified:
  head/sys/contrib/dev/acpica/acpica_prep.sh
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/common/ahids.c
  head/sys/contrib/dev/acpica/common/ahpredef.c
  head/sys/contrib/dev/acpica/common/ahuuids.c
  head/sys/contrib/dev/acpica/common/dmextern.c
  head/sys/contrib/dev/acpica/common/dmrestag.c
  head/sys/contrib/dev/acpica/common/dmtable.c
  head/sys/contrib/dev/acpica/common/dmtbdump.c
  head/sys/contrib/dev/acpica/common/dmtbinfo.c
  head/sys/contrib/dev/acpica/common/getopt.c
  head/sys/contrib/dev/acpica/compiler/aslanalyze.c
  head/sys/contrib/dev/acpica/compiler/aslascii.c
  head/sys/contrib/dev/acpica/compiler/aslcodegen.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/aslcompiler.l
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfileio.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslfold.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslmapenter.c
  head/sys/contrib/dev/acpica/compiler/aslmapoutput.c
  head/sys/contrib/dev/acpica/compiler/aslmethod.c
  head/sys/contrib/dev/acpica/compiler/aslopcodes.c
  head/sys/contrib/dev/acpica/compiler/asloperands.c
  head/sys/contrib/dev/acpica/compiler/aslopt.c
  head/sys/contrib/dev/acpica/compiler/asloptions.c
  head/sys/contrib/dev/acpica/compiler/aslprintf.c
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/aslsupport.l
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/asluuid.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/dtcompiler.h
  head/sys/contrib/dev/acpica/compiler/dtexpress.c
  head/sys/contrib/dev/acpica/compiler/dtfield.c
  head/sys/contrib/dev/acpica/compiler/dtio.c
  head/sys/contrib/dev/acpica/compiler/dtparser.y
  head/sys/contrib/dev/acpica/compiler/dtsubtable.c
  head/sys/contrib/dev/acpica/compiler/dttable.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.h
  head/sys/contrib/dev/acpica/compiler/dtutils.c
  head/sys/contrib/dev/acpica/compiler/prparser.y
  head/sys/contrib/dev/acpica/compiler/prscan.c
  head/sys/contrib/dev/acpica/compiler/prutils.c
  head/sys/contrib/dev/acpica/components/debugger/dbcmds.c
  head/sys/contrib/dev/acpica/components/debugger/dbconvert.c
  head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/components/debugger/dbexec.c
  head/sys/contrib/dev/acpica/components/debugger/dbfileio.c
  head/sys/contrib/dev/acpica/components/debugger/dbhistry.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/debugger/dbnames.c
  head/sys/contrib/dev/acpica/components/debugger/dbtest.c
  head/sys/contrib/dev/acpica/components/debugger/dbutils.c
  head/sys/contrib/dev/acpica/components/debugger/dbxface.c
  head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
  head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
  head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsobject.c
  head/sys/contrib/dev/acpica/components/dispatcher/dsutils.c
  head/sys/contrib/dev/acpica/components/dispatcher/dswload.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/events/evgpeinit.c
  head/sys/contrib/dev/acpica/components/executer/exconfig.c
  head/sys/contrib/dev/acpica/components/executer/exconvrt.c
  head/sys/contrib/dev/acpica/components/executer/exdebug.c
  head/sys/contrib/dev/acpica/components/executer/exdump.c
  head/sys/contrib/dev/acpica/components/executer/exfield.c
  head/sys/contrib/dev/acpica/components/executer/exfldio.c
  head/sys/contrib/dev/acpica/components/executer/exmisc.c
  head/sys/contrib/dev/acpica/components/executer/exnames.c
  head/sys/contrib/dev/acpica/components/executer/exoparg2.c
  head/sys/contrib/dev/acpica/components/executer/exoparg3.c
  head/sys/contrib/dev/acpica/components/executer/exregion.c
  head/sys/contrib/dev/acpica/components/executer/exstorob.c
  head/sys/contrib/dev/acpica/components/executer/exutils.c
  head/sys/contrib/dev/acpica/components/hardware/hwgpe.c
  head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  head/sys/contrib/dev/acpica/components/namespace/nsaccess.c
  head/sys/contrib/dev/acpica/components/namespace/nsconvert.c
  head/sys/contrib/dev/acpica/components/namespace/nsdump.c
  head/sys/contrib/dev/acpica/components/namespace/nseval.c
  head/sys/contrib/dev/acpica/components/namespace/nsinit.c
  head/sys/contrib/dev/acpica/components/namespace/nsparse.c
  head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
  head/sys/contrib/dev/acpica/components/namespace/nssearch.c
  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
  head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
  head/sys/contrib/dev/acpica/components/namespace/nsxfname.c
  head/sys/contrib/dev/acpica/components/parser/psutils.c
  head/sys/contrib/dev/acpica/components/resources/rscreate.c
  head/sys/contrib/dev/acpica/components/resources/rsmisc.c
  head/sys/contrib/dev/acpica/components/resources/rsutils.c
  head/sys/contrib/dev/acpica/components/resources/rsxface.c
  head/sys/contrib/dev/acpica/components/tables/tbdata.c
  head/sys/contrib/dev/acpica/components/tables/tbfadt.c
  head/sys/contrib/dev/acpica/components/tables/tbfind.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/tbutils.c
  head/sys/contrib/dev/acpica/components/tables/tbxface.c
  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
  head/sys/contrib/dev/acpica/components/utilities/utalloc.c
  head/sys/contrib/dev/acpica/components/utilities/utbuffer.c
  head/sys/contrib/dev/acpica/components/utilities/utcache.c
  head/sys/contrib/dev/acpica/components/utilities/utcopy.c
  head/sys/contrib/dev/acpica/components/utilities/utids.c
  head/sys/contrib/dev/acpica/components/utilities/utmisc.c
  head/sys/contrib/dev/acpica/components/utilities/utosi.c
  head/sys/contrib/dev/acpica/components/utilities/utpredef.c
  head/sys/contrib/dev/acpica/components/utilities/utprint.c
  head/sys/contrib/dev/acpica/components/utilities/utstring.c
  head/sys/contrib/dev/acpica/components/utilities/uttrack.c
  head/sys/contrib/dev/acpica/components/utilities/utxface.c
  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
  head/sys/contrib/dev/acpica/include/accommon.h
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/acinterp.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnames.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acobject.h
  head/sys/contrib/dev/acpica/include/acoutput.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acstruct.h
  head/sys/contrib/dev/acpica/include/actbl.h
  head/sys/contrib/dev/acpica/include/actbl1.h
  head/sys/contrib/dev/acpica/include/actbl2.h
  head/sys/contrib/dev/acpica/include/actbl3.h
  head/sys/contrib/dev/acpica/include/actypes.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/sys/contrib/dev/acpica/include/platform/acenv.h
  head/sys/contrib/dev/acpica/include/platform/acenvex.h
  head/sys/contrib/dev/acpica/include/platform/acgcc.h
  head/sys/x86/acpica/acpi_wakeup.c
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/acpica_prep.sh
==============================================================================
--- head/sys/contrib/dev/acpica/acpica_prep.sh	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/acpica_prep.sh	Thu Jun 18 23:14:45 2015	(r284583)
@@ -19,20 +19,20 @@ fulldirs="common compiler components inc
 # files to remove
 stripdirs="generate libraries tests tools"
 stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h	\
-	acefi.h achaiku.h acintel.h aclinux.h aclinuxex.h acmacosx.h	\
-	acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h new_table.txt	\
-	osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c	\
-	osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c		\
-	readme.txt utclib.c"
+	acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h	\
+	acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h acwin64.h	\
+	new_table.txt osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c	\
+	oslinuxtbl.c osunixdir.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	\
-	acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h achware.h	\
-	acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h acobject.h	\
-	acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h	\
-	acpredef.h acresrc.h acrestyp.h acstruct.h actables.h actbl.h	\
-	actbl1.h actbl2.h actbl3.h actypes.h acutils.h amlcode.h	\
-	amlresrc.h platform/acenv.h platform/acenvex.h			\
+src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h		\
+	acdebug.h acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h	\
+	achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h	\
+	acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h	\
+	acpixf.h acpredef.h acresrc.h acrestyp.h acstruct.h actables.h	\
+	actbl.h actbl1.h actbl2.h actbl3.h actypes.h acutils.h acuuid.h	\
+	amlcode.h amlresrc.h platform/acenv.h platform/acenvex.h	\
 	platform/acfreebsd.h platform/acgcc.h"
 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h	\
 	aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/changes.txt	Thu Jun 18 23:14:45 2015	(r284583)
@@ -1,5 +1,130 @@
 ----------------------------------------
-08 April 2015. Summary of changes for version 20150515:
+19 June 2015. Summary of changes for version 20150619:
+
+Two regressions in version 20150616 have been addressed:
+
+Fixes some problems/issues with the C library macro removal (ACPI_STRLEN, 
+etc.) This update changes ACPICA to only use the standard headers for 
+functions, or the prototypes for the local versions of the C library 
+functions. Across the source code, this required some additional casts 
+for some Clib invocations for portability. Moved all local prototypes to 
+a new file, acclib.h
+
+Fixes several problems with recent changes to the handling of the FACS 
+table that could cause some systems not to boot.
+
+
+----------------------------------------
+16 June 2015. Summary of changes for version 20150616:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Across the entire ACPICA source code base, the various macros for the C 
+library functions (such as ACPI_STRLEN, etc.) have been removed and 
+replaced by the standard C library names (strlen, etc.) The original 
+purpose for these macros is no longer applicable. This simplification 
+reduces the number of macros used in the ACPICA source code 
+significantly, improving readability and maintainability.
+
+Implemented support for a new ACPI table, the OSDT. This table, the 
+"override" SDT, can be loaded directly by the host OS at boot time. It 
+enables the replacement of existing namespace objects that were installed 
+via the DSDT and/or SSDTs. The primary purpose for this is to replace 
+buggy or incorrect ASL/AML code obtained via the BIOS. The OSDT is slated 
+for inclusion in a future version of the ACPI Specification. Lv Zheng/Bob 
+Moore.
+
+Added support for systems with (improperly) two FACS tables -- a "32-bit" 
+table (via FADT 32-bit legacy field) and a "64-bit" table (via the 64-bit 
+X field). This change will support both automatically. There continues to 
+be systems found with this issue. This support requires a change to the 
+AcpiSetFirmwareWakingVector interface. Also, a public global variable has 
+been added to allow the host to select which FACS is desired 
+(AcpiGbl_Use32BitFacsAddresses). See the ACPICA reference for more 
+details Lv Zheng.
+
+Added a new feature to allow for systems that do not contain an FACS. 
+Although this is already supported on hardware-reduced platforms, the 
+feature has been extended for all platforms. The reasoning is that we do 
+not want to abort the entire ACPICA initialization just because the 
+system is seriously buggy and has no FACS.
+
+Fixed a problem where the GUID strings for NFIT tables (in acuuid.h) were 
+not correctly transcribed from the ACPI specification in ACPICA version 
+20150515.
+
+Implemented support for the _CLS object in the AcpiGetObjectInfo external 
+interface.
+
+Updated the definitions of the TCPA and TPM2 ACPI tables to the more 
+recent TCG ACPI Specification, December 14, 2014. Table disassembler and 
+compiler also updated. Note: The TCPA "server" table is not supported by 
+the disassembler/table-compiler at this time.
+
+ACPI 6.0: Added definitions for the new GIC version field in the MADT.
+
+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: 100.6K Code, 27.6K Data, 128.2K Total
+    Debug Version:     196.2K Code, 81.0K Data, 277.2K Total
+  Previous Release:
+    Non-Debug Version:  99.9K Code, 27.5K Data, 127.4K Total
+    Debug Version:     195.2K Code, 80.8K Data, 276.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Fixed a problem with the new symbolic operator disassembler 
+where incorrect ASL code could be emitted in some cases for the "non-
+commutative" operators -- Subtract, Divide, Modulo, ShiftLeft, and 
+ShiftRight. The actual problem cases seem to be rather unusual in common 
+ASL code, however. David Box.
+
+Modified the linux version of acpidump to obtain ACPI tables from not 
+just /dev/mem (which may not exist) and /sys/firmware/acpi/tables. Lv 
+Zheng.
+
+iASL: Fixed a problem where the user preprocessor output file (.i) 
+contained extra data that was not expected. The compiler was using this 
+file as a temporary file and passed through #line directives in order to 
+keep compiler error messages in sync with the input file and line number 
+across multiple include files. The (.i) is no longer a temporary file as 
+the compiler uses a new, different file for the original purpose.
+
+iASL: Fixed a problem where comments within the original ASL source code 
+file were not passed through to the preprocessor output file, nor any 
+listing files.
+
+iASL: Fixed some issues for the handling of the "#include" preprocessor 
+directive and the similar (but not the same) "Include" ASL operator.
+
+iASL: Add support for the new OSDT in both the disassembler and compiler.
+
+iASL: Fixed a problem with the constant folding support where a Buffer 
+object could be incorrectly generated (incorrectly formed) during a 
+conversion to a Store() operator.
+
+AcpiHelp: Updated for new NFIT GUIDs, "External" AML opcode, and new 
+description text for the _REV predefined name. _REV now permanently 
+returns 2, as per the ACPI 6.0 specification.
+
+Debugger: Enhanced the output of the Debug ASL object for references 
+produced by the Index operator. For Buffers and strings, only output the 
+actual byte pointed to by the index. For packages, only print the single 
+package element decoded by the index. Previously, the entire 
+buffer/string/package was emitted.
+
+iASL/Table-compiler: Fixed a regression where the "generic" data types 
+were no longer recognized, causing errors.
+
+
+----------------------------------------
+15 May 2015. Summary of changes for version 20150515:
 
 This release implements most of ACPI 6.0 as described below.
 
@@ -34,7 +159,7 @@ iASL disassembler and table compiler: Ad
 tables: FADT, MADT.
 
 iASL preprocessor: Added a new directive to enable inclusion of binary 
-blobs into ASL code. The new directive is #includebinary. It takes a 
+blobs into ASL code. The new directive is #includebuffer. It takes a 
 binary file as input and emits a named ascii buffer object into the ASL 
 code.
 

Modified: head/sys/contrib/dev/acpica/common/adisasm.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adisasm.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/adisasm.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -243,7 +243,7 @@ AdAmlDisassemble (
         while (ExternalFileList)
         {
             ExternalFilename = ExternalFileList->Path;
-            if (!ACPI_STRCMP (ExternalFilename, Filename))
+            if (!strcmp (ExternalFilename, Filename))
             {
                 /* Next external file */
 

Modified: head/sys/contrib/dev/acpica/common/ahids.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/ahids.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/ahids.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -230,7 +230,7 @@ AcpiAhMatchHardwareId (
 
     for (Info = AslDeviceIds; Info->Name; Info++)
     {
-        if (!ACPI_STRCMP (HardwareId, Info->Name))
+        if (!strcmp (HardwareId, Info->Name))
         {
             return (Info);
         }

Modified: head/sys/contrib/dev/acpica/common/ahpredef.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/ahpredef.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/ahpredef.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -249,7 +249,7 @@ const AH_PREDEFINED_NAME    AslPredefine
     AH_PREDEF ("_RBW",    "Register Bit Width", "Resource Descriptor field"),
     AH_PREDEF ("_RDI",    "Resource Dependencies for Idle", "Returns a list of dependencies for idle states"),
     AH_PREDEF ("_REG",    "Region Availability", "Inform AML code of an operation region availability change"),
-    AH_PREDEF ("_REV",    "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"),
+    AH_PREDEF ("_REV",    "Supported Integer Width", "Returns the supported integer width (<= 1: 32 bits only, >=2: both 32 and 64 bits"),
     AH_PREDEF ("_RMV",    "Removal Status", "Returns a device's removal ability status (docking)"),
     AH_PREDEF ("_RNG",    "Range", "Memory range type, Resource Descriptor field"),
     AH_PREDEF ("_RST",    "Device Reset", "Executes a reset on a device"),

Modified: head/sys/contrib/dev/acpica/common/ahuuids.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/ahuuids.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/ahuuids.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -122,7 +122,7 @@ AcpiAhMatchUuid (
 
         AcpiUtConvertStringToUuid (Info->String, UuidBuffer);
 
-        if (!ACPI_MEMCMP (Data, UuidBuffer, UUID_BUFFER_LENGTH))
+        if (!memcmp (Data, UuidBuffer, UUID_BUFFER_LENGTH))
         {
             return (Info->Description);
         }

Modified: head/sys/contrib/dev/acpica/common/dmextern.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmextern.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/dmextern.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -224,7 +224,7 @@ AcpiDmNormalizeParentPrefix (
         return (NULL);
     }
 
-    Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1);
+    Length = (strlen (ParentPath) + strlen (Path) + 1);
     if (ParentPath[1])
     {
         /*
@@ -253,7 +253,7 @@ AcpiDmNormalizeParentPrefix (
      *
      * Copy the parent path
      */
-    ACPI_STRCPY (Fullpath, &ParentPath[Index]);
+    strcpy (Fullpath, &ParentPath[Index]);
 
     /*
      * Add dot separator
@@ -261,12 +261,12 @@ AcpiDmNormalizeParentPrefix (
      */
     if (ParentPath[1])
     {
-        ACPI_STRCAT (Fullpath, ".");
+        strcat (Fullpath, ".");
     }
 
     /* Copy child path (carat parent prefix(es) were skipped above) */
 
-    ACPI_STRCAT (Fullpath, Path);
+    strcat (Fullpath, Path);
 
 Cleanup:
     ACPI_FREE (ParentPath);
@@ -648,13 +648,13 @@ AcpiDmAddNodeToExternalList (
 
     if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1]))
     {
-        Temp = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (ExternalPath) + 1);
+        Temp = ACPI_ALLOCATE_ZEROED (strlen (ExternalPath) + 1);
         if (!Temp)
         {
             return_VOID;
         }
 
-        ACPI_STRCPY (Temp, &ExternalPath[1]);
+        strcpy (Temp, &ExternalPath[1]);
         ACPI_FREE (ExternalPath);
         ExternalPath = Temp;
     }
@@ -806,7 +806,7 @@ AcpiDmCreateNewExternal (
     NextExternal = AcpiGbl_ExternalList;
     while (NextExternal)
     {
-        if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
+        if (!strcmp (ExternalPath, NextExternal->Path))
         {
             /* Duplicate method, check that the Value (ArgCount) is the same */
 
@@ -849,7 +849,7 @@ AcpiDmCreateNewExternal (
     NewExternal->Value = Value;
     NewExternal->Path = ExternalPath;
     NewExternal->Type = Type;
-    NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
+    NewExternal->Length = (UINT16) strlen (ExternalPath);
     NewExternal->InternalPath = InternalPath;
 
     /* Link the new descriptor into the global list, alphabetically ordered */

Modified: head/sys/contrib/dev/acpica/common/dmrestag.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmrestag.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/dmrestag.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -679,10 +679,10 @@ AcpiGetTagPathname (
      * end up in the final compiled AML, it's just an appearance issue for the
      * disassembled code.
      */
-    Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0;
-    ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
-    ACPI_STRCAT (Pathname, ".");
-    ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE);
+    Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
+    strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+    strcat (Pathname, ".");
+    strncat (Pathname, Tag, ACPI_NAME_SIZE);
 
     /* Internalize the namepath to AML format */
 

Modified: head/sys/contrib/dev/acpica/common/dmtable.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtable.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/dmtable.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -528,7 +528,7 @@ AcpiDmDumpDataTable (
         TableData = AcpiDmGetTableData (Table->Signature);
         if (!TableData)
         {
-            if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
+            if (!strncmp (Table->Signature, "OEM", 3))
             {
                 AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
                     Table->Signature);
@@ -856,7 +856,7 @@ AcpiDmDumpTable (
 
         case ACPI_DMT_STRING:
 
-            ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
+            ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1;
             break;
 
         case ACPI_DMT_GAS:

Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtbdump.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/dmtbdump.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -155,7 +155,7 @@ AcpiDmDumpUnicode (
 
     for (i = 0; i < Length; i += 2)
     {
-        if (!ACPI_IS_PRINT (Buffer[i]))
+        if (!isprint (Buffer[i]))
         {
             goto DumpRawBuffer;
         }
@@ -1701,7 +1701,7 @@ AcpiDmDumpIort (
             InfoTable = AcpiDmTableInfoIort1;
             Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName);
             String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length);
-            Length += ACPI_STRLEN (String) + 1;
+            Length += strlen (String) + 1;
             break;
 
         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
@@ -3344,7 +3344,7 @@ AcpiDmDumpStao (
     while (Offset < Table->Length)
     {
         Namepath = ACPI_ADD_PTR (char, Table, Offset);
-        StringLength = ACPI_STRLEN (Namepath) + 1;
+        StringLength = strlen (Namepath) + 1;
 
         AcpiDmLineHeader (Offset, StringLength, "Namestring");
         AcpiOsPrintf ("\"%s\"\n", Namepath);

Modified: head/sys/contrib/dev/acpica/common/dmtbinfo.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtbinfo.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/dmtbinfo.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -113,7 +113,7 @@
 #define ACPI_SPMI_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
 #define ACPI_SRAT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
 #define ACPI_STAO_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f)
-#define ACPI_TCPA_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
+#define ACPI_TCPA_CLIENT_OFFSET(f)      (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f)
 #define ACPI_TPM2_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f)
 #define ACPI_UEFI_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
 #define ACPI_WAET_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f)
@@ -2611,15 +2611,15 @@ ACPI_DMTABLE_INFO           AcpiDmTableI
 
 /*******************************************************************************
  *
- * TCPA - Trusted Computing Platform Alliance table
+ * TCPA - Trusted Computing Platform Alliance table (Client)
  *
  ******************************************************************************/
 
 ACPI_DMTABLE_INFO           AcpiDmTableInfoTcpa[] =
 {
-    {ACPI_DMT_UINT16,   ACPI_TCPA_OFFSET (Reserved),                "Reserved", 0},
-    {ACPI_DMT_UINT32,   ACPI_TCPA_OFFSET (MaxLogLength),            "Max Event Log Length", 0},
-    {ACPI_DMT_UINT64,   ACPI_TCPA_OFFSET (LogAddress),              "Event Log Address", 0},
+    {ACPI_DMT_UINT16,   ACPI_TCPA_CLIENT_OFFSET (PlatformClass),    "Platform Class", 0},
+    {ACPI_DMT_UINT32,   ACPI_TCPA_CLIENT_OFFSET (MinimumLogLength), "Min Event Log Length", 0},
+    {ACPI_DMT_UINT64,   ACPI_TCPA_CLIENT_OFFSET (LogAddress),       "Event Log Address", 0},
     ACPI_DMT_TERMINATOR
 };
 
@@ -2632,7 +2632,8 @@ ACPI_DMTABLE_INFO           AcpiDmTableI
 
 ACPI_DMTABLE_INFO           AcpiDmTableInfoTpm2[] =
 {
-    {ACPI_DMT_UINT32,   ACPI_TPM2_OFFSET (Flags),                   "Flags", 0},
+    {ACPI_DMT_UINT16,   ACPI_TPM2_OFFSET (PlatformClass),           "Platform Class", 0},
+    {ACPI_DMT_UINT16,   ACPI_TPM2_OFFSET (Reserved),                "Reserved", 0},
     {ACPI_DMT_UINT64,   ACPI_TPM2_OFFSET (ControlAddress),          "Control Address", 0},
     {ACPI_DMT_UINT32,   ACPI_TPM2_OFFSET (StartMethod),             "Start Method", 0},
     ACPI_DMT_TERMINATOR

Modified: head/sys/contrib/dev/acpica/common/getopt.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/getopt.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/common/getopt.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -145,7 +145,7 @@ AcpiGetopt(
         {
             return (ACPI_OPT_END);
         }
-        else if (ACPI_STRCMP (argv[AcpiGbl_Optind], "--") == 0)
+        else if (strcmp (argv[AcpiGbl_Optind], "--") == 0)
         {
             AcpiGbl_Optind++;
             return (ACPI_OPT_END);
@@ -159,7 +159,7 @@ AcpiGetopt(
     /* Make sure that the option is legal */
 
     if (CurrentChar == ':' ||
-       (OptsPtr = ACPI_STRCHR (opts, CurrentChar)) == NULL)
+       (OptsPtr = strchr (opts, CurrentChar)) == NULL)
     {
         ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar);
 

Modified: head/sys/contrib/dev/acpica/compiler/aslanalyze.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslanalyze.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslanalyze.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -67,8 +67,8 @@ AnIsInternalMethod (
     ACPI_PARSE_OBJECT       *Op)
 {
 
-    if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
-        (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+    if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||
+        (!strcmp (Op->Asl.ExternalName, "_OSI")))
     {
         return (TRUE);
     }
@@ -94,8 +94,8 @@ AnGetInternalMethodReturnType (
     ACPI_PARSE_OBJECT       *Op)
 {
 
-    if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
-        (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+    if ((!strcmp (Op->Asl.ExternalName, "\\_OSI")) ||
+        (!strcmp (Op->Asl.ExternalName, "_OSI")))
     {
         return (ACPI_BTYPE_STRING);
     }
@@ -462,7 +462,7 @@ ApCheckForGpeNameConflict (
 
     /* Verify 3rd/4th chars are a valid hex value */
 
-    GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
+    GpeNumber = strtoul (&Name[2], NULL, 16);
     if (GpeNumber == ACPI_UINT32_MAX)
     {
         return;

Modified: head/sys/contrib/dev/acpica/compiler/aslascii.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslascii.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslascii.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -226,7 +226,7 @@ FlCheckForAscii (
 
         /* Ensure character is either printable or a "space" char */
 
-        else if (!ACPI_IS_PRINT (Byte) && !ACPI_IS_SPACE (Byte))
+        else if (!isprint (Byte) && !isspace (Byte))
         {
             if ((BadBytes < 10) && (DisplayErrors))
             {

Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcodegen.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -110,7 +110,7 @@ CgGenerateAmlOutput (
 
     DbgPrint (ASL_TREE_OUTPUT,
         "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"
-        "    Parent   Child    Next     Flags    AcTyp    Final Col L\n",
+        "    Parent   Child    Next     Flags    AcTyp    Final Col L#  EL#  LL#  ELL#\n",
         76, " ");
 
     CgCloseTable ();
@@ -145,7 +145,7 @@ CgAmlWriteWalk (
             "Final parse tree used for AML output:\n");
         DbgPrint (ASL_TREE_OUTPUT,
             "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"
-            "    Parent   Child    Next     Flags    AcTyp    Final Col L\n",
+            "    Parent   Child    Next     Flags    AcTyp    Final Col L#  EL#  LL#  ELL#\n",
             76, " ");
     }
 
@@ -169,7 +169,7 @@ CgAmlWriteWalk (
 
     DbgPrint (ASL_TREE_OUTPUT,
     "%08X %04X %04X %01X     %04X  %04X %04X   %04X    "
-    "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d\n",
+    "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d   %02d   %02d   %02d\n",
             /* 1  */ (UINT32) Op->Asl.Value.Integer,
             /* 2  */ Op->Asl.ParseOpcode,
             /* 3  */ Op->Asl.AmlOpcode,
@@ -186,7 +186,10 @@ CgAmlWriteWalk (
             /* 14 */ Op->Asl.AcpiBtype,
             /* 15 */ Op->Asl.FinalAmlLength,
             /* 16 */ Op->Asl.Column,
-            /* 17 */ Op->Asl.LineNumber);
+            /* 17 */ Op->Asl.LineNumber,
+            /* 18 */ Op->Asl.EndLine,
+            /* 19 */ Op->Asl.LogicalLineNumber,
+            /* 20 */ Op->Asl.EndLogicalLine);
 
     /* Generate the AML for this node */
 

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -103,6 +103,9 @@ CmDoCompile (
         /* Preprocessor */
 
         PrDoPreprocess ();
+        Gbl_CurrentLineNumber = 1;
+        Gbl_LogicalLineNumber = 1;
+
         if (Gbl_PreprocessOnly)
         {
             UtEndEvent (Event);
@@ -112,6 +115,7 @@ CmDoCompile (
     }
     UtEndEvent (Event);
 
+
     /* Build the parse tree */
 
     Event = UtBeginEvent ("Parse source code and build parse tree");
@@ -708,7 +712,7 @@ CmCleanupAndExit (
     /* Close all open files */
 
     /*
-     * Take care with the preprocessor file (.i), it might be the same
+     * Take care with the preprocessor file (.pre), it might be the same
      * as the "input" file, depending on where the compiler has terminated
      * or aborted. Prevent attempt to close the same file twice in
      * loop below.
@@ -733,10 +737,9 @@ CmCleanupAndExit (
         FlDeleteFile (ASL_FILE_AML_OUTPUT);
     }
 
-    /* Delete the preprocessor output file (.i) unless -li flag is set */
+    /* Delete the preprocessor temp file unless full debug was specified */
 
-    if (!Gbl_PreprocessorOutputFlag &&
-        Gbl_PreprocessFlag)
+    if (Gbl_PreprocessFlag && !Gbl_KeepPreprocessorTempFile)
     {
         FlDeleteFile (ASL_FILE_PREPROCESSOR);
     }
@@ -752,8 +755,6 @@ CmCleanupAndExit (
      * Note: Handles are cleared by FlCloseFile above, so we look at the
      * filename instead, to determine if the .SRC file was actually
      * created.
-     *
-     * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
      */
     if (!Gbl_SourceOutputFlag)
     {

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Thu Jun 18 23:14:45 2015	(r284583)
@@ -1003,7 +1003,7 @@ UtDoConstant (
     char                    *String);
 
 ACPI_STATUS
-UtStrtoul64 (
+stroul64 (
     char                    *String,
     UINT32                  Base,
     UINT64                  *RetInteger);

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.l	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l	Thu Jun 18 23:14:45 2015	(r284583)
@@ -709,7 +709,7 @@ NamePathTail                [.]{NameSeg}
                                 return (PARSEOP_NAMESTRING); }
 
 .                           { count (1);
-                                if (ACPI_IS_PRINT (*AslCompilertext))
+                                if (isprint ((int) *AslCompilertext))
                                 {
                                     sprintf (MsgBuffer,
                                         "Invalid character (%c), expecting ASL keyword or name",

Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Thu Jun 18 23:14:45 2015	(r284583)
@@ -105,7 +105,8 @@
 
 /* filename suffixes for output files */
 
-#define FILE_SUFFIX_PREPROCESSOR    "i"
+#define FILE_SUFFIX_PREPROC_USER    "i  "
+#define FILE_SUFFIX_PREPROCESSOR    "pre"
 #define FILE_SUFFIX_AML_CODE        "aml"
 #define FILE_SUFFIX_MAP             "map"
 #define FILE_SUFFIX_LISTING         "lst"
@@ -136,6 +137,8 @@
 #define ASL_ABORT                   TRUE
 #define ASL_NO_ABORT                FALSE
 #define ASL_EOF                     ACPI_UINT32_MAX
+#define ASL_WITHIN_COMMENT          (ACPI_UINT32_MAX -1)
+#define ASL_BLANK_LINE              (ACPI_UINT32_MAX -1)
 
 
 /* Listings */

Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslerror.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslerror.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -561,11 +561,11 @@ AslCommonError2 (
 
         /* Keep a copy of the extra message */
 
-        ACPI_STRCPY (MessageBuffer, ExtraMessage);
+        strcpy (MessageBuffer, ExtraMessage);
     }
 
     LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
-    ACPI_STRCPY (LineBuffer, SourceLine);
+    strcpy (LineBuffer, SourceLine);
 
     /* Initialize the error node */
 
@@ -647,7 +647,7 @@ AslCommonError (
 
         /* Keep a copy of the extra message */
 
-        ACPI_STRCPY (MessageBuffer, ExtraMessage);
+        strcpy (MessageBuffer, ExtraMessage);
     }
 
     /* Initialize the error node */

Modified: head/sys/contrib/dev/acpica/compiler/aslfileio.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfileio.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslfileio.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -218,6 +218,19 @@ FlWriteFile (
         FlFileError (FileId, ASL_MSG_WRITE);
         AslAbort ();
     }
+
+    if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
+    {
+        /* Duplicate the output to the user preprocessor (.i) file */
+
+        Actual = fwrite ((char *) Buffer, 1, Length,
+            Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle);
+        if (Actual != Length)
+        {
+            FlFileError (FileId, ASL_MSG_WRITE);
+            AslAbort ();
+        }
+    }
 }
 
 
@@ -247,7 +260,6 @@ FlPrintFile (
 
 
     va_start (Args, Format);
-
     Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
     va_end (Args);
 
@@ -256,6 +268,30 @@ FlPrintFile (
         FlFileError (FileId, ASL_MSG_WRITE);
         AslAbort ();
     }
+
+    if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
+    {
+        /*
+         * Duplicate the output to the user preprocessor (.i) file,
+         * except: no #line directives.
+         */
+        if (!strncmp (Format, "#line", 5))
+        {
+            return;
+        }
+
+        va_start (Args, Format);
+        Actual = vfprintf (Gbl_Files[ASL_FILE_PREPROCESSOR_USER].Handle,
+            Format, Args);
+        va_end (Args);
+
+        if (Actual == -1)
+        {
+            FlFileError (FileId, ASL_MSG_WRITE);
+            AslAbort ();
+        }
+    }
+
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfiles.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslfiles.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -43,6 +43,7 @@
 
 #include <contrib/dev/acpica/compiler/aslcompiler.h>
 #include <contrib/dev/acpica/include/acapps.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
 
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("aslfiles")
@@ -84,7 +85,6 @@ FlSetLineNumber (
          LineNumber, Gbl_LogicalLineNumber);
 
     Gbl_CurrentLineNumber = LineNumber;
-    Gbl_LogicalLineNumber = LineNumber;
 }
 
 
@@ -303,6 +303,7 @@ FlOpenIncludeWithPrefix (
 {
     FILE                    *IncludeFile;
     char                    *Pathname;
+    UINT32                  OriginalLineNumber;
 
 
     /* Build the full pathname to the file */
@@ -322,13 +323,20 @@ FlOpenIncludeWithPrefix (
         return (NULL);
     }
 
-#ifdef _MUST_HANDLE_COMMENTS
     /*
-     * Check entire include file for any # preprocessor directives.
+     * Check the entire include file for any # preprocessor directives.
      * This is because there may be some confusion between the #include
-     * preprocessor directive and the ASL Include statement.
+     * preprocessor directive and the ASL Include statement. A file included
+     * by the ASL include cannot contain preprocessor directives because
+     * the preprocessor has already run by the time the ASL include is
+     * recognized (by the compiler, not the preprocessor.)
+     *
+     * Note: DtGetNextLine strips/ignores comments.
+     * Save current line number since DtGetNextLine modifies it.
      */
-    while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile))
+    Gbl_CurrentLineNumber--;
+    OriginalLineNumber = Gbl_CurrentLineNumber;
+    while (DtGetNextLine (IncludeFile, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF)
     {
         if (Gbl_CurrentLineBuffer[0] == '#')
         {
@@ -336,7 +344,7 @@ FlOpenIncludeWithPrefix (
                 Op, "use #include instead");
         }
     }
-#endif
+    Gbl_CurrentLineNumber = OriginalLineNumber;
 
     /* Must seek back to the start of the file */
 
@@ -579,8 +587,6 @@ FlOpenMiscOutputFiles (
 
         /* Open the debug file as STDERR, text mode */
 
-        /* TBD: hide this behind a FlReopenFile function */
-
         Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
         Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
             freopen (Filename, "w+t", stderr);
@@ -588,13 +594,15 @@ FlOpenMiscOutputFiles (
         if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle)
         {
             /*
-             * A problem with freopen is that on error,
-             * we no longer have stderr.
+             * A problem with freopen is that on error, we no longer
+             * have stderr and cannot emit normal error messages.
+             * Emit error to stdout, close files, and exit.
              */
-            Gbl_DebugFlag = FALSE;
-            memcpy (stderr, stdout, sizeof (FILE));
-            FlFileError (ASL_FILE_DEBUG_OUTPUT, ASL_MSG_DEBUG_FILENAME);
-            AslAbort ();
+            fprintf (stdout,
+                "\nCould not open debug output file: %s\n\n", Filename);
+
+            CmCleanupAndExit ();
+            exit (1);
         }
 
         AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
@@ -621,7 +629,7 @@ FlOpenMiscOutputFiles (
         AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
     }
 
-    /* Create the preprocessor output file if preprocessor enabled */
+    /* Create the preprocessor output temp file if preprocessor enabled */
 
     if (Gbl_PreprocessFlag)
     {
@@ -636,6 +644,23 @@ FlOpenMiscOutputFiles (
         FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t");
     }
 
+    /*
+     * Create the "user" preprocessor output file if -li flag set.
+     * Note, this file contains no embedded #line directives.
+     */
+    if (Gbl_PreprocessorOutputFlag)
+    {
+        Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROC_USER);
+        if (!Filename)
+        {
+            AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
+                0, 0, 0, 0, NULL, NULL);
+            return (AE_ERROR);
+        }
+
+        FlOpenFile (ASL_FILE_PREPROCESSOR_USER, Filename, "w+t");
+    }
+
     /* All done for data table compiler */
 
     if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)

Modified: head/sys/contrib/dev/acpica/compiler/aslfold.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfold.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslfold.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -236,6 +236,8 @@ OpcAmlCheckForConstant (
      */
     if (WalkState->Opcode == AML_BUFFER_OP)
     {
+        DbgPrint (ASL_PARSE_OUTPUT,
+            "\nBuffer+Buffer->Buffer constant reduction is not supported yet");
         Status = AE_TYPE;
         goto CleanupAndExit;
     }
@@ -380,10 +382,12 @@ TrSimpleConstantReduction (
         return (Status);
     }
 
+    /* Disconnect any existing children, install new constant */
+
+    Op->Asl.Child = NULL;
     TrInstallReducedConstant (Op, ObjDesc);
 
     UtSetParseOpName (Op);
-    Op->Asl.Child = NULL;
     return (AE_OK);
 }
 
@@ -494,6 +498,10 @@ TrTransformToStoreOp (
         goto EvalError;
     }
 
+    /* Truncate any subtree expressions, they have been evaluated */
+
+    Child1->Asl.Child = NULL;
+
     /* Folded constant is in ObjDesc, store into Child1 */
 
     TrInstallReducedConstant (Child1, ObjDesc);
@@ -505,11 +513,6 @@ TrTransformToStoreOp (
     UtSetParseOpName (Op);
     Op->Common.Parent = OriginalParent;
 
-    /* Truncate any subtree expressions, they have been evaluated */
-
-    Child1->Asl.Child = NULL;
-    Child2->Asl.Child = NULL;
-
     /* First child is the folded constant */
 
     /* Second child will be the target */
@@ -547,7 +550,8 @@ TrInstallReducedConstant (
     ACPI_PARSE_OBJECT       *Op,
     ACPI_OPERAND_OBJECT     *ObjDesc)
 {
-    ACPI_PARSE_OBJECT       *RootOp;
+    ACPI_PARSE_OBJECT       *LengthOp;
+    ACPI_PARSE_OBJECT       *DataOp;
 
 
     TotalFolds++;
@@ -574,17 +578,22 @@ TrInstallReducedConstant (
 
         Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
         Op->Common.AmlOpcode = AML_STRING_OP;
-        Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
+        Op->Asl.AmlLength = strlen (ObjDesc->String.Pointer) + 1;
         Op->Common.Value.String = ObjDesc->String.Pointer;
 
         DbgPrint (ASL_PARSE_OUTPUT,
             "Constant expression reduced to (STRING) %s\n\n",
             Op->Common.Value.String);
-
         break;
 
     case ACPI_TYPE_BUFFER:
-
+        /*
+         * Create a new parse subtree of the form:
+         *
+         * BUFFER (Buffer AML opcode)
+         *    INTEGER (Buffer length in bytes)
+         *    RAW_DATA (Buffer byte data)
+         */
         Op->Asl.ParseOpcode = PARSEOP_BUFFER;
         Op->Common.AmlOpcode = AML_BUFFER_OP;
         Op->Asl.CompileFlags = NODE_AML_PACKAGE;
@@ -592,28 +601,24 @@ TrInstallReducedConstant (
 
         /* Child node is the buffer length */
 
-        RootOp = TrAllocateNode (PARSEOP_INTEGER);
+        LengthOp = TrAllocateNode (PARSEOP_INTEGER);
 
-        RootOp->Asl.AmlOpcode = AML_DWORD_OP;
-        RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
-        RootOp->Asl.Parent = Op;
+        LengthOp->Asl.AmlOpcode = AML_DWORD_OP;
+        LengthOp->Asl.Value.Integer = ObjDesc->Buffer.Length;
+        LengthOp->Asl.Parent = Op;
+        (void) OpcSetOptimalIntegerSize (LengthOp);
 
-        (void) OpcSetOptimalIntegerSize (RootOp);
-
-        Op->Asl.Child = RootOp;
-        Op = RootOp;
-        UtSetParseOpName (Op);
+        Op->Asl.Child = LengthOp;
 
-        /* Peer to the child is the raw buffer data */
+        /* Next child is the raw buffer data */
 
-        RootOp = TrAllocateNode (PARSEOP_RAW_DATA);
-        RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
-        RootOp->Asl.AmlLength = ObjDesc->Buffer.Length;
-        RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
-        RootOp->Asl.Parent = Op->Asl.Parent;
+        DataOp = TrAllocateNode (PARSEOP_RAW_DATA);
+        DataOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+        DataOp->Asl.AmlLength = ObjDesc->Buffer.Length;
+        DataOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer;
+        DataOp->Asl.Parent = Op;
 
-        Op->Asl.Next = RootOp;
-        Op = RootOp;
+        LengthOp->Asl.Next = DataOp;
 
         DbgPrint (ASL_PARSE_OUTPUT,
             "Constant expression reduced to (BUFFER) length %X\n\n",

Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Thu Jun 18 23:14:45 2015	(r284583)
@@ -73,6 +73,7 @@ ASL_FILE_INFO                       Gbl_
     {NULL, NULL, "Binary Output:", "AML Output"},
     {NULL, NULL, "Source Output:", "Source Output"},
     {NULL, NULL, "Preprocessor: ", "Preprocessor Output"},
+    {NULL, NULL, "Preprocessor: ", "Preprocessor Temp File"},
     {NULL, NULL, "Listing File: ", "Listing Output"},
     {NULL, NULL, "Hex Dump:     ", "Hex Table Output"},
     {NULL, NULL, "Namespace:    ", "Namespace Output"},
@@ -123,10 +124,10 @@ ASL_EXTERN char                     ASL_
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0);
-ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0);
+ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_OriginalInputFileSize, 0);
 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_SyntaxError, 0);
 
 /* Exception reporting */
@@ -146,6 +147,7 @@ ASL_EXTERN BOOLEAN                  ASL_
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_MapfileFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
+ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);

Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmain.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslmain.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -261,7 +261,7 @@ AslSignalHandler (
 
     /* Close all open files */
 
-    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
+    Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
 
     for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
     {

Modified: head/sys/contrib/dev/acpica/compiler/aslmapenter.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslmapenter.c	Thu Jun 18 21:55:55 2015	(r284582)
+++ head/sys/contrib/dev/acpica/compiler/aslmapenter.c	Thu Jun 18 23:14:45 2015	(r284583)
@@ -239,7 +239,7 @@ MpCreateGpioInfo (
     /* Sort on source DeviceName first */
 
     while (NextGpio &&
-            (ACPI_STRCMP (DeviceName, NextGpio->DeviceName) > 0))
+            (strcmp (DeviceName, NextGpio->DeviceName) > 0))
     {
         PrevGpio = NextGpio;
         NextGpio = NextGpio->Next;
@@ -249,7 +249,7 @@ MpCreateGpioInfo (
 
     while (NextGpio &&
             (NextGpio->PinNumber < PinNumber) &&
-            !ACPI_STRCMP (DeviceName, NextGpio->DeviceName))
+            !strcmp (DeviceName, NextGpio->DeviceName))
     {
         PrevGpio = NextGpio;
         NextGpio = NextGpio->Next;
@@ -316,7 +316,7 @@ MpCreateSerialInfo (
     /* Sort on source DeviceName */
 
     while (NextSerial &&
-        (ACPI_STRCMP (DeviceName, NextSerial->DeviceName) > 0))
+        (strcmp (DeviceName, NextSerial->DeviceName) > 0))

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


More information about the svn-src-head mailing list