Sync ACPICA with Intel's version 20140828. master
authorSascha Wildner <saw@online.de>
Sat, 30 Aug 2014 09:50:38 +0000 (11:50 +0200)
committerSascha Wildner <saw@online.de>
Sat, 30 Aug 2014 09:52:50 +0000 (11:52 +0200)
* Add support for runtime validation of the _DSD package.

* Add the GICC affinity subtable to the SRAT table.

* Add error detection for illegally named references within control
    methods that would cause runtime failures.

* Add error checking for dependencies related to the _PSx power
    methods.

* Various improvements, bug fixes and cleanups.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

158 files changed:
sys/contrib/dev/acpica/changes.txt
sys/contrib/dev/acpica/generate/unix/Makefile.config
sys/contrib/dev/acpica/generate/unix/iasl/Makefile
sys/contrib/dev/acpica/source/common/adfile.c
sys/contrib/dev/acpica/source/common/adisasm.c
sys/contrib/dev/acpica/source/common/adwalk.c
sys/contrib/dev/acpica/source/common/ahuuids.c
sys/contrib/dev/acpica/source/common/dmrestag.c
sys/contrib/dev/acpica/source/common/dmtable.c
sys/contrib/dev/acpica/source/common/dmtbdump.c
sys/contrib/dev/acpica/source/common/dmtbinfo.c
sys/contrib/dev/acpica/source/compiler/aslanalyze.c
sys/contrib/dev/acpica/source/compiler/aslascii.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslbtypes.c
sys/contrib/dev/acpica/source/compiler/aslcodegen.c
sys/contrib/dev/acpica/source/compiler/aslcompile.c
sys/contrib/dev/acpica/source/compiler/aslcompiler.h
sys/contrib/dev/acpica/source/compiler/aslcompiler.l
sys/contrib/dev/acpica/source/compiler/asldefine.h
sys/contrib/dev/acpica/source/compiler/aslerror.c
sys/contrib/dev/acpica/source/compiler/aslfileio.c
sys/contrib/dev/acpica/source/compiler/aslfiles.c
sys/contrib/dev/acpica/source/compiler/aslfold.c
sys/contrib/dev/acpica/source/compiler/aslglobal.h
sys/contrib/dev/acpica/source/compiler/aslhex.c
sys/contrib/dev/acpica/source/compiler/asllength.c
sys/contrib/dev/acpica/source/compiler/aslload.c
sys/contrib/dev/acpica/source/compiler/asllookup.c
sys/contrib/dev/acpica/source/compiler/aslmain.c
sys/contrib/dev/acpica/source/compiler/aslmessages.c
sys/contrib/dev/acpica/source/compiler/aslmessages.h
sys/contrib/dev/acpica/source/compiler/aslmethod.c
sys/contrib/dev/acpica/source/compiler/aslnamesp.c
sys/contrib/dev/acpica/source/compiler/aslopcodes.c
sys/contrib/dev/acpica/source/compiler/asloperands.c
sys/contrib/dev/acpica/source/compiler/aslopt.c
sys/contrib/dev/acpica/source/compiler/aslparser.y [copied from sys/contrib/dev/acpica/source/components/parser/pswalk.c with 50% similarity]
sys/contrib/dev/acpica/source/compiler/aslresource.c
sys/contrib/dev/acpica/source/compiler/aslrestype1.c
sys/contrib/dev/acpica/source/compiler/aslrestype1i.c
sys/contrib/dev/acpica/source/compiler/aslrestype2.c
sys/contrib/dev/acpica/source/compiler/aslrestype2d.c
sys/contrib/dev/acpica/source/compiler/aslrestype2e.c
sys/contrib/dev/acpica/source/compiler/aslrestype2q.c
sys/contrib/dev/acpica/source/compiler/aslrestype2s.c
sys/contrib/dev/acpica/source/compiler/aslrestype2w.c
sys/contrib/dev/acpica/source/compiler/aslrules.y [moved from sys/contrib/dev/acpica/source/compiler/aslcompiler.y with 82% similarity]
sys/contrib/dev/acpica/source/compiler/aslstartup.c
sys/contrib/dev/acpica/source/compiler/aslsupport.l
sys/contrib/dev/acpica/source/compiler/aslsupport.y [copied from sys/contrib/dev/acpica/source/components/parser/pswalk.c with 58% similarity]
sys/contrib/dev/acpica/source/compiler/asltokens.y [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/asltransform.c
sys/contrib/dev/acpica/source/compiler/asltree.c
sys/contrib/dev/acpica/source/compiler/asltypes.h
sys/contrib/dev/acpica/source/compiler/asltypes.y [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslutils.c
sys/contrib/dev/acpica/source/compiler/aslwalks.c
sys/contrib/dev/acpica/source/compiler/aslxref.c
sys/contrib/dev/acpica/source/compiler/dtcompile.c
sys/contrib/dev/acpica/source/compiler/dtcompiler.h
sys/contrib/dev/acpica/source/compiler/dtio.c
sys/contrib/dev/acpica/source/compiler/dtsubtable.c
sys/contrib/dev/acpica/source/compiler/dttable.c
sys/contrib/dev/acpica/source/compiler/dttemplate.c
sys/contrib/dev/acpica/source/compiler/dttemplate.h
sys/contrib/dev/acpica/source/compiler/dtutils.c
sys/contrib/dev/acpica/source/compiler/prutils.c
sys/contrib/dev/acpica/source/components/debugger/dbcmds.c
sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
sys/contrib/dev/acpica/source/components/debugger/dbdisply.c
sys/contrib/dev/acpica/source/components/debugger/dbexec.c
sys/contrib/dev/acpica/source/components/debugger/dbfileio.c
sys/contrib/dev/acpica/source/components/debugger/dbhistry.c
sys/contrib/dev/acpica/source/components/debugger/dbinput.c
sys/contrib/dev/acpica/source/components/debugger/dbmethod.c
sys/contrib/dev/acpica/source/components/debugger/dbnames.c
sys/contrib/dev/acpica/source/components/debugger/dbstats.c
sys/contrib/dev/acpica/source/components/debugger/dbutils.c
sys/contrib/dev/acpica/source/components/debugger/dbxface.c
sys/contrib/dev/acpica/source/components/disassembler/dmdeferred.c
sys/contrib/dev/acpica/source/components/disassembler/dmnames.c
sys/contrib/dev/acpica/source/components/disassembler/dmobject.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrc.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcl.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcs.c
sys/contrib/dev/acpica/source/components/disassembler/dmutils.c
sys/contrib/dev/acpica/source/components/disassembler/dmwalk.c
sys/contrib/dev/acpica/source/components/dispatcher/dswstate.c
sys/contrib/dev/acpica/source/components/events/evgpeinit.c
sys/contrib/dev/acpica/source/components/events/evhandler.c
sys/contrib/dev/acpica/source/components/events/evregion.c
sys/contrib/dev/acpica/source/components/events/evrgnini.c
sys/contrib/dev/acpica/source/components/events/evxface.c
sys/contrib/dev/acpica/source/components/events/evxfevnt.c
sys/contrib/dev/acpica/source/components/events/evxfgpe.c
sys/contrib/dev/acpica/source/components/executer/exconvrt.c
sys/contrib/dev/acpica/source/components/executer/exdebug.c
sys/contrib/dev/acpica/source/components/executer/exfield.c
sys/contrib/dev/acpica/source/components/executer/exfldio.c
sys/contrib/dev/acpica/source/components/executer/exoparg2.c
sys/contrib/dev/acpica/source/components/executer/exregion.c
sys/contrib/dev/acpica/source/components/namespace/nsalloc.c
sys/contrib/dev/acpica/source/components/namespace/nsinit.c
sys/contrib/dev/acpica/source/components/namespace/nsobject.c
sys/contrib/dev/acpica/source/components/namespace/nsprepkg.c
sys/contrib/dev/acpica/source/components/namespace/nswalk.c
sys/contrib/dev/acpica/source/components/namespace/nsxfeval.c
sys/contrib/dev/acpica/source/components/namespace/nsxfobj.c
sys/contrib/dev/acpica/source/components/parser/psloop.c
sys/contrib/dev/acpica/source/components/parser/psobject.c
sys/contrib/dev/acpica/source/components/parser/psopcode.c
sys/contrib/dev/acpica/source/components/parser/psopinfo.c
sys/contrib/dev/acpica/source/components/parser/psparse.c
sys/contrib/dev/acpica/source/components/parser/psscope.c
sys/contrib/dev/acpica/source/components/parser/pstree.c
sys/contrib/dev/acpica/source/components/parser/psutils.c
sys/contrib/dev/acpica/source/components/parser/pswalk.c
sys/contrib/dev/acpica/source/components/resources/rsdump.c
sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c
sys/contrib/dev/acpica/source/components/resources/rsutils.c
sys/contrib/dev/acpica/source/components/resources/rsxface.c
sys/contrib/dev/acpica/source/components/utilities/utclib.c
sys/contrib/dev/acpica/source/components/utilities/utexcep.c
sys/contrib/dev/acpica/source/components/utilities/utfileio.c
sys/contrib/dev/acpica/source/components/utilities/utinit.c
sys/contrib/dev/acpica/source/components/utilities/utmath.c
sys/contrib/dev/acpica/source/components/utilities/utmisc.c
sys/contrib/dev/acpica/source/components/utilities/utmutex.c
sys/contrib/dev/acpica/source/components/utilities/utownerid.c
sys/contrib/dev/acpica/source/components/utilities/utresrc.c
sys/contrib/dev/acpica/source/components/utilities/utstate.c
sys/contrib/dev/acpica/source/components/utilities/utstring.c
sys/contrib/dev/acpica/source/components/utilities/utxface.c
sys/contrib/dev/acpica/source/components/utilities/utxfinit.c
sys/contrib/dev/acpica/source/include/acdisasm.h
sys/contrib/dev/acpica/source/include/acdispat.h
sys/contrib/dev/acpica/source/include/acnames.h
sys/contrib/dev/acpica/source/include/acparser.h
sys/contrib/dev/acpica/source/include/acpixf.h
sys/contrib/dev/acpica/source/include/actbl1.h
sys/contrib/dev/acpica/source/include/actbl3.h
sys/contrib/dev/acpica/source/include/platform/aclinux.h
sys/contrib/dev/acpica/source/include/platform/aclinuxex.h
sys/contrib/dev/acpica/source/include/platform/acmsvc.h
sys/contrib/dev/acpica/source/os_specific/service_layers/osefixf.c
sys/contrib/dev/acpica/source/os_specific/service_layers/osunixxf.c
sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c
sys/contrib/dev/acpica/source/tools/acpibin/abmain.c
sys/contrib/dev/acpica/source/tools/acpidump/acpidump.h
sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
sys/contrib/dev/acpica/source/tools/acpisrc/acpisrc.h
sys/contrib/dev/acpica/source/tools/acpisrc/asconvrt.c
sys/contrib/dev/acpica/source/tools/acpisrc/asmain.c
sys/contrib/dev/acpica/source/tools/acpisrc/astable.c
sys/contrib/dev/acpica/source/tools/acpisrc/asutils.c
sys/contrib/dev/acpica/tests/misc/grammar.asl
usr.sbin/acpi/iasl/Makefile

index eae9f81..89d2628 100644 (file)
@@ -1,8 +1,82 @@
 ----------------------------------------
+28 August 2014. Summary of changes for version 20140828:
 
-24 July 2014. Summary of changes for version 20140724: 
+1) ACPICA kernel-resident subsystem:
 
-This release is available at https://acpica.org/downloads
+Fixed a problem related to the internal use of the Timer() operator where 
+a 64-bit divide could cause an attempted link to a double-precision math 
+library. This divide is not actually necessary, so the code was 
+restructured to eliminate it. Lv Zheng.
+
+ACPI 5.1: Added support for the runtime validation of the _DSD package 
+(similar to the iASL support).
+
+ACPI 5.1/Headers: Added support for the GICC affinity subtable to the 
+SRAT table. Hanjun Guo <hanjun.guo@linaro.org>.
+
+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:  98.8K Code, 27.3K Data, 126.1K Total
+    Debug Version:     192.1K Code, 79.8K Data, 271.9K Total
+  Previous Release:
+    Non-Debug Version:  98.7K Code, 27.3K Data, 126.0K Total1
+    Debug Version:     192.0K Code, 79.7K Data, 271.7K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+AcpiExec: Fixed a problem on unix systems where the original terminal 
+state was not always properly restored upon exit. Seen when using the -v 
+option. ACPICA BZ 1104.
+
+iASL: Fixed a problem with the validation of the ranges/length within the 
+Memory24 resource descriptor. There was a boundary condition when the 
+range was equal to the (length -1) caused by the fact that these values 
+are defined in 256-byte blocks, not bytes. ACPICA BZ 1098
+
+Disassembler: Fixed a problem with the GpioInt descriptor interrupt polarity 
+flags. The flags are actually 2 bits, not 1, and the "ActiveBoth" keyword is 
+now supported properly.
+
+ACPI 5.1: Added the GICC affinity subtable to the SRAT table. Supported 
+in the disassembler, data table compiler, and table template generator.
+
+iASL: Added a requirement for Device() objects that one of either a _HID 
+or _ADR must exist within the scope of a Device, as per the ACPI 
+specification. Remove a similar requirement that was incorrectly in place 
+for the _DSD object.
+
+iASL: Added error detection for illegal named references within control 
+methods that would cause runtime failures. Now trapped as errors are: 1) 
+References to objects within a non-parent control method. 2) Forward 
+references (within a method) -- for control methods, AML interpreters use 
+a one-pass parse of control methods. ACPICA BZ 1008.
+
+iASL: Added error checking for dependencies related to the _PSx power 
+methods. ACPICA BZ 1029.
+1) For _PS0, one of these must exist within the same scope: _PS1, _PS2, 
+_PS3.
+2) For _PS1, _PS2, and PS3: A _PS0 object must exist within the same 
+scope.
+
+iASL and table compiler: Cleanup miscellaneous memory leaks by fully 
+deploying the existing object and string caches and adding new caches for 
+the table compiler.
+
+iASL: Split the huge parser source file into multiple subfiles to improve 
+manageability. Generation now requires the M4 macro preprocessor, which 
+is part of the Bison distribution on both unix and windows platforms.
+
+AcpiSrc: Fixed and removed all extraneous warnings generated during 
+entire ACPICA source code scan and/or conversion.
+
+
+----------------------------------------
+
+24 July 2014. Summary of changes for version 20140724: 
 
 The ACPI 5.1 specification has been released and is available at: 
 http://uefi.org/specs/access
index 8d41399..dd7fd75 100644 (file)
@@ -207,6 +207,8 @@ endif
 #      -Wshadow\
 
 #
+# M4 macro processor is used to build the final parser file
+#
 # Bison/Flex configuration
 #
 # -y: act like yacc
@@ -226,6 +228,9 @@ endif
 YACC=       bison
 YFLAGS +=   -y
 
+MACROPROC=  m4
+MFLAGS=     -P -I$(ASL_COMPILER)
+
 LEX=        flex
 LFLAGS +=   -i -s
 
index 051450c..f4b6ef3 100644 (file)
@@ -50,6 +50,7 @@ OBJECTS = \
        $(OBJDIR)/ahpredef.o\
        $(OBJDIR)/ahuuids.o\
        $(OBJDIR)/aslanalyze.o\
+       $(OBJDIR)/aslascii.o\
        $(OBJDIR)/aslbtypes.o\
        $(OBJDIR)/aslcodegen.o\
        $(OBJDIR)/aslcompile.o\
@@ -212,6 +213,7 @@ OBJECTS = \
        $(OBJDIR)/utxferror.o
 
 INTERMEDIATES = \
+       $(OBJDIR)/aslcompiler.y\
        $(OBJDIR)/aslcompilerlex.c\
        $(OBJDIR)/aslcompilerparse.c\
        $(OBJDIR)/dtparserlex.c\
@@ -224,6 +226,18 @@ MISC = \
        $(OBJDIR)/dtparser.y.h\
        $(OBJDIR)/prparser.y.h
 
+ASL_PARSER = \
+       $(ASL_COMPILER)/aslparser.y\
+       $(ASL_COMPILER)/asltokens.y\
+       $(ASL_COMPILER)/asltypes.y\
+       $(ASL_COMPILER)/aslrules.y
+
+ASL_LEXER = \
+       $(ASL_COMPILER)/aslcompiler.l\
+       $(ASL_COMPILER)/aslsupport.l\
+       $(OBJDIR)/aslcompiler.y.h
+
+
 #
 # Flags specific to iASL compiler
 #
@@ -237,17 +251,22 @@ CFLAGS += \
 #
 include ../Makefile.rules
 
+#
+# Macro processing for iASL .y files
+#
+$(OBJDIR)/aslcompiler.y :       $(ASL_PARSER)
+       $(MACROPROC) $(MFLAGS) $(ASL_COMPILER)/aslparser.y > $(OBJDIR)/aslcompiler.y
 
 #
 # Parser and Lexer - intermediate C files
 #
-$(OBJDIR)/aslcompilerlex.c :   $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l $(OBJDIR)/aslcompiler.y.h
+$(OBJDIR)/aslcompilerlex.c :   $(ASL_LEXER)
        $(LEX) $(LFLAGS) -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
 
-$(OBJDIR)/aslcompiler.y.h :    $(ASL_COMPILER)/aslcompiler.y
+$(OBJDIR)/aslcompiler.y.h :    $(OBJDIR)/aslcompiler.y
        $(YACC) $(YFLAGS) -pAslCompiler -o/dev/null --defines=$@ $<
 
-$(OBJDIR)/aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
+$(OBJDIR)/aslcompilerparse.c : $(OBJDIR)/aslcompiler.y
        $(YACC) $(YFLAGS) -pAslCompiler -o$@ --defines=/dev/null $<
 
 $(OBJDIR)/dtparserlex.c :      $(ASL_COMPILER)/dtparser.l $(OBJDIR)/dtparser.y.h
index 0b70d69..41c27ee 100644 (file)
@@ -41,7 +41,7 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
+#include "aslcompiler.h"
 #include "acpi.h"
 #include "accommon.h"
 #include "acapps.h"
@@ -206,7 +206,7 @@ FlGenerateFilename (
      * Copy the original filename to a new buffer. Leave room for the worst
      * case where we append the suffix, an added dot and the null terminator.
      */
-    NewFilename = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE)
+    NewFilename = UtStringCacheCalloc ((ACPI_SIZE)
         strlen (InputFilename) + strlen (Suffix) + 2);
     if (!NewFilename)
     {
@@ -255,7 +255,7 @@ FlStrdup (
     char                *NewString;
 
 
-    NewString = ACPI_ALLOCATE ((ACPI_SIZE) strlen (String) + 1);
+    NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1);
     if (!NewString)
     {
         return (NULL);
@@ -337,7 +337,6 @@ FlSplitInputPathname (
 
     if (!Filename)
     {
-        ACPI_FREE (DirectoryPath);
         return (AE_NO_MEMORY);
     }
 
@@ -349,6 +348,5 @@ FlSplitInputPathname (
         return (AE_OK);
     }
 
-    ACPI_FREE (Filename);
     return (AE_OK);
 }
index 292b472..8deaee7 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
-#include "acpi.h"
-#include "accommon.h"
+#include "aslcompiler.h"
 #include "acparser.h"
 #include "amlcode.h"
-#include "acdebug.h"
 #include "acdisasm.h"
 #include "acdispat.h"
 #include "acnamesp.h"
 #define _COMPONENT          ACPI_TOOLS
         ACPI_MODULE_NAME    ("adisasm")
 
-/*
- * Older versions of Bison won't emit this external in the generated header.
- * Newer versions do emit the external, so we don't need to do it.
- */
-#ifndef ASLCOMPILER_ASLCOMPILERPARSE_H
-extern int                  AslCompilerdebug;
-#endif
-
-ACPI_STATUS
-NsDisplayNamespace (
-    void);
-
-void
-NsSetupNamespaceListing (
-    void                    *Handle);
-
-
 /* Local prototypes */
 
 static void
@@ -654,7 +634,7 @@ AdCreateTableHeader (
     }
     else
     {
-        NewFilename = ACPI_ALLOCATE_ZEROED (9);
+        NewFilename = UtStringCacheCalloc (9);
         if (NewFilename)
         {
             strncat (NewFilename, Table->Signature, 4);
@@ -674,8 +654,6 @@ AdCreateTableHeader (
         "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
         NewFilename, Table->Signature, Table->Revision,
         Table->OemId, Table->OemTableId, Table->OemRevision);
-
-    ACPI_FREE (NewFilename);
 }
 
 
index d150f4d..81b5f4a 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index 8d0b080..e0b05fa 100644 (file)
@@ -88,6 +88,9 @@ const AH_UUID  AcpiUuids[] =
     {"Physical Presence Interface",
         "3dddfaa6-361b-4eb4-a424-8d10089d1653"},
 
+    {"Device Properties for _DSD",
+        "daffd814-6eba-4d8c-8a91-bc9bbf4aa301"},
+
     {NULL, NULL}
 };
 
index 398691b..5589d1f 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index e5627d7..fc8cbc2 100644 (file)
@@ -253,6 +253,7 @@ static const char           *AcpiDmSratSubnames[] =
     "Processor Local APIC/SAPIC Affinity",
     "Memory Affinity",
     "Processor Local x2APIC Affinity",
+    "GICC Affinity",
     "Unknown SubTable Type"         /* Reserved */
 };
 
index 72ec095..ac46001 100644 (file)
@@ -2739,6 +2739,11 @@ AcpiDmDumpSrat (
             InfoTable = AcpiDmTableInfoSrat2;
             break;
 
+        case ACPI_SRAT_TYPE_GICC_AFFINITY:
+
+            InfoTable = AcpiDmTableInfoSrat3;
+            break;
+
         default:
             AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type);
 
index 0bfd9e6..c7a247e 100644 (file)
 #define ACPI_SRAT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
 #define ACPI_SRAT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
 #define ACPI_SRAT2_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
+#define ACPI_SRAT3_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f)
 #define ACPI_VRTC0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)
 #define ACPI_WDAT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)
 
 #define ACPI_SRAT0_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o)
 #define ACPI_SRAT1_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o)
 #define ACPI_SRAT2_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o)
+#define ACPI_SRAT3_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (ACPI_SRAT_GICC_AFFINITY,f,o)
 #define ACPI_GTDT_FLAG_OFFSET(f,o)      ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o)
 #define ACPI_GTDT0a_FLAG_OFFSET(f,o)    ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o)
 #define ACPI_GTDT1_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o)
@@ -2186,7 +2188,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoSrat0[] =
     {ACPI_DMT_FLAG0,    ACPI_SRAT0_FLAG_OFFSET (Flags,0),           "Enabled", 0},
     {ACPI_DMT_UINT8,    ACPI_SRAT0_OFFSET (LocalSapicEid),          "Local Sapic EID", 0},
     {ACPI_DMT_UINT24,   ACPI_SRAT0_OFFSET (ProximityDomainHi[0]),   "Proximity Domain High(24)", 0},
-    {ACPI_DMT_UINT32,   ACPI_SRAT0_OFFSET (Reserved),               "Reserved", 0},
+    {ACPI_DMT_UINT32,   ACPI_SRAT0_OFFSET (ClockDomain),            "Clock Domain", 0},
     ACPI_DMT_TERMINATOR
 };
 
@@ -2221,6 +2223,18 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoSrat2[] =
     ACPI_DMT_TERMINATOR
 };
 
+/* : GICC Affinity (ACPI 5.1) */
+
+ACPI_DMTABLE_INFO           AcpiDmTableInfoSrat3[] =
+{
+    {ACPI_DMT_UINT32,   ACPI_SRAT3_OFFSET (ProximityDomain),        "Proximity Domain", 0},
+    {ACPI_DMT_UINT32,   ACPI_SRAT3_OFFSET (AcpiProcessorUid),       "Acpi Processor UID", 0},
+    {ACPI_DMT_UINT32,   ACPI_SRAT3_OFFSET (Flags),                  "Flags (decoded below)", DT_FLAG},
+    {ACPI_DMT_FLAG0,    ACPI_SRAT3_FLAG_OFFSET (Flags,0),           "Enabled", 0},
+    {ACPI_DMT_UINT32,   ACPI_SRAT3_OFFSET (ClockDomain),            "Clock Domain", 0},
+    ACPI_DMT_TERMINATOR
+};
+
 
 /*******************************************************************************
  *
index 940f220..94282a0 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include <string.h>
diff --git a/sys/contrib/dev/acpica/source/compiler/aslascii.c b/sys/contrib/dev/acpica/source/compiler/aslascii.c
new file mode 100644 (file)
index 0000000..3fdf1ac
--- /dev/null
@@ -0,0 +1,349 @@
+/******************************************************************************
+ *
+ * Module Name: aslascii - ASCII detection and support routines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include <acapps.h>
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslascii")
+
+
+/* Local prototypes */
+
+static void
+FlConsumeAnsiComment (
+    FILE                    *Handle,
+    ASL_FILE_STATUS         *Status);
+
+static void
+FlConsumeNewComment (
+    FILE                    *Handle,
+    ASL_FILE_STATUS         *Status);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlCheckForAcpiTable
+ *
+ * PARAMETERS:  Handle              - Open input file
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the
+ *              following checks on what would be the table header:
+ *              0) File must be at least as long as an ACPI_TABLE_HEADER
+ *              1) The header length field must match the file size
+ *              2) Signature, OemId, OemTableId, AslCompilerId must be ASCII
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlCheckForAcpiTable (
+    FILE                    *Handle)
+{
+    ACPI_TABLE_HEADER       Table;
+    UINT32                  FileSize;
+    size_t                  Actual;
+    UINT32                  i;
+
+
+    /* Read a potential table header */
+
+    Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle);
+    fseek (Handle, 0, SEEK_SET);
+
+    if (Actual < sizeof (ACPI_TABLE_HEADER))
+    {
+        return (AE_ERROR);
+    }
+
+    /* Header length field must match the file size */
+
+    FileSize = CmGetFileSize (Handle);
+    if (Table.Length != FileSize)
+    {
+        return (AE_ERROR);
+    }
+
+    /*
+     * These fields must be ASCII:
+     * Signature, OemId, OemTableId, AslCompilerId.
+     * We allow a NULL terminator in OemId and OemTableId.
+     */
+    for (i = 0; i < ACPI_NAME_SIZE; i++)
+    {
+        if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i]))
+        {
+            return (AE_ERROR);
+        }
+
+        if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i]))
+        {
+            return (AE_ERROR);
+        }
+    }
+
+    for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++)
+    {
+        if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i]))
+        {
+            return (AE_ERROR);
+        }
+    }
+
+    for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++)
+    {
+        if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i]))
+        {
+            return (AE_ERROR);
+        }
+    }
+
+    printf ("Binary file appears to be a valid ACPI table, disassembling\n");
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlCheckForAscii
+ *
+ * PARAMETERS:  Handle              - Open input file
+ *              Filename            - Input filename
+ *              DisplayErrors       - TRUE if error messages desired
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters
+ *              within comments. Note: does not handle nested comments and does
+ *              not handle comment delimiters within string literals. However,
+ *              on the rare chance this happens and an invalid character is
+ *              missed, the parser will catch the error by failing in some
+ *              spectactular manner.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlCheckForAscii (
+    FILE                    *Handle,
+    char                    *Filename,
+    BOOLEAN                 DisplayErrors)
+{
+    UINT8                   Byte;
+    ACPI_SIZE               BadBytes = 0;
+    BOOLEAN                 OpeningComment = FALSE;
+    ASL_FILE_STATUS         Status;
+
+
+    Status.Line = 1;
+    Status.Offset = 0;
+
+    /* Read the entire file */
+
+    while (fread (&Byte, 1, 1, Handle) == 1)
+    {
+        /* Ignore comment fields (allow non-ascii within) */
+
+        if (OpeningComment)
+        {
+            /* Check for second comment open delimiter */
+
+            if (Byte == '*')
+            {
+                FlConsumeAnsiComment (Handle, &Status);
+            }
+
+            if (Byte == '/')
+            {
+                FlConsumeNewComment (Handle, &Status);
+            }
+
+            /* Reset */
+
+            OpeningComment = FALSE;
+        }
+        else if (Byte == '/')
+        {
+            OpeningComment = TRUE;
+        }
+
+        /* Check for an ASCII character */
+
+        if (!ACPI_IS_ASCII (Byte))
+        {
+            if ((BadBytes < 10) && (DisplayErrors))
+            {
+                AcpiOsPrintf (
+                    "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
+                    Byte, Status.Line, Status.Offset);
+            }
+
+            BadBytes++;
+        }
+
+        /* Update line counter */
+
+        else if (Byte == 0x0A)
+        {
+            Status.Line++;
+        }
+
+        Status.Offset++;
+    }
+
+    /* Seek back to the beginning of the source file */
+
+    fseek (Handle, 0, SEEK_SET);
+
+    /* Were there any non-ASCII characters in the file? */
+
+    if (BadBytes)
+    {
+        if (DisplayErrors)
+        {
+            AcpiOsPrintf (
+                "%u non-ASCII characters found in input source text, could be a binary file\n",
+                BadBytes);
+            AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename);
+        }
+
+        return (AE_BAD_CHARACTER);
+    }
+
+    /* File is OK (100% ASCII) */
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlConsumeAnsiComment
+ *
+ * PARAMETERS:  Handle              - Open input file
+ *              Status              - File current status struct
+ *
+ * RETURN:      Number of lines consumed
+ *
+ * DESCRIPTION: Step over a normal slash-star type comment
+ *
+ ******************************************************************************/
+
+static void
+FlConsumeAnsiComment (
+    FILE                    *Handle,
+    ASL_FILE_STATUS         *Status)
+{
+    UINT8                   Byte;
+    BOOLEAN                 ClosingComment = FALSE;
+
+
+    while (fread (&Byte, 1, 1, Handle) == 1)
+    {
+        /* Scan until comment close is found */
+
+        if (ClosingComment)
+        {
+            if (Byte == '/')
+            {
+                return;
+            }
+
+            if (Byte != '*')
+            {
+                /* Reset */
+
+                ClosingComment = FALSE;
+            }
+        }
+        else if (Byte == '*')
+        {
+            ClosingComment = TRUE;
+        }
+
+        /* Maintain line count */
+
+        if (Byte == 0x0A)
+        {
+            Status->Line++;
+        }
+
+        Status->Offset++;
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlConsumeNewComment
+ *
+ * PARAMETERS:  Handle              - Open input file
+ *              Status              - File current status struct
+ *
+ * RETURN:      Number of lines consumed
+ *
+ * DESCRIPTION: Step over a slash-slash type of comment
+ *
+ ******************************************************************************/
+
+static void
+FlConsumeNewComment (
+    FILE                    *Handle,
+    ASL_FILE_STATUS         *Status)
+{
+    UINT8                   Byte;
+
+
+    while (fread (&Byte, 1, 1, Handle) == 1)
+    {
+        Status->Offset++;
+
+        /* Comment ends at newline */
+
+        if (Byte == 0x0A)
+        {
+            Status->Line++;
+            return;
+        }
+    }
+}
index fc61c0e..025a416 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index 1d10cd7..8cef755 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index cc1a0eb..060380a 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "aslcompiler.h"
 #include "dtcompiler.h"
+#include "acnamesp.h"
 
 #include <stdio.h>
 #include <time.h>
@@ -67,484 +68,8 @@ CmFlushSourceCode (
     void);
 
 static void
-FlConsumeAnsiComment (
-    FILE                    *Handle,
-    ASL_FILE_STATUS         *Status);
-
-static void
-FlConsumeNewComment (
-    FILE                    *Handle,
-    ASL_FILE_STATUS         *Status);
-
-static void
-CmDumpAllEvents (
-    void);
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AslCompilerSignon
- *
- * PARAMETERS:  FileId      - ID of the output file
- *
- * RETURN:      None
- *
- * DESCRIPTION: Display compiler signon
- *
- ******************************************************************************/
-
-void
-AslCompilerSignon (
-    UINT32                  FileId)
-{
-    char                    *Prefix = "";
-    char                    *UtilityName;
-
-
-    /* Set line prefix depending on the destination file type */
-
-    switch (FileId)
-    {
-    case ASL_FILE_ASM_SOURCE_OUTPUT:
-    case ASL_FILE_ASM_INCLUDE_OUTPUT:
-
-        Prefix = "; ";
-        break;
-
-    case ASL_FILE_HEX_OUTPUT:
-
-        if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
-        {
-            Prefix = "; ";
-        }
-        else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
-                 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
-        {
-            FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
-            Prefix = " * ";
-        }
-        break;
-
-    case ASL_FILE_C_SOURCE_OUTPUT:
-    case ASL_FILE_C_OFFSET_OUTPUT:
-    case ASL_FILE_C_INCLUDE_OUTPUT:
-
-        Prefix = " * ";
-        break;
-
-    default:
-
-        /* No other output types supported */
-
-        break;
-    }
-
-    /* Running compiler or disassembler? */
-
-    if (Gbl_DisasmFlag)
-    {
-        UtilityName = AML_DISASSEMBLER_NAME;
-    }
-    else
-    {
-        UtilityName = ASL_COMPILER_NAME;
-    }
-
-    /* Compiler signon with copyright */
-
-    FlPrintFile (FileId, "%s\n", Prefix);
-    FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AslCompilerFileHeader
- *
- * PARAMETERS:  FileId      - ID of the output file
- *
- * RETURN:      None
- *
- * DESCRIPTION: Header used at the beginning of output files
- *
- ******************************************************************************/
-
-void
-AslCompilerFileHeader (
-    UINT32                  FileId)
-{
-    struct tm               *NewTime;
-    time_t                  Aclock;
-    char                    *Prefix = "";
-
-
-    /* Set line prefix depending on the destination file type */
-
-    switch (FileId)
-    {
-    case ASL_FILE_ASM_SOURCE_OUTPUT:
-    case ASL_FILE_ASM_INCLUDE_OUTPUT:
-
-        Prefix = "; ";
-        break;
-
-    case ASL_FILE_HEX_OUTPUT:
-
-        if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
-        {
-            Prefix = "; ";
-        }
-        else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
-                 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
-        {
-            Prefix = " * ";
-        }
-        break;
-
-    case ASL_FILE_C_SOURCE_OUTPUT:
-    case ASL_FILE_C_OFFSET_OUTPUT:
-    case ASL_FILE_C_INCLUDE_OUTPUT:
-
-        Prefix = " * ";
-        break;
-
-    default:
-
-        /* No other output types supported */
-
-        break;
-    }
-
-    /* Compilation header with timestamp */
-
-    (void) time (&Aclock);
-    NewTime = localtime (&Aclock);
-
-    FlPrintFile (FileId,
-        "%sCompilation of \"%s\" - %s%s\n",
-        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
-        Prefix);
-
-    switch (FileId)
-    {
-    case ASL_FILE_C_SOURCE_OUTPUT:
-    case ASL_FILE_C_OFFSET_OUTPUT:
-    case ASL_FILE_C_INCLUDE_OUTPUT:
-
-        FlPrintFile (FileId, " */\n");
-        break;
-
-    default:
-
-        /* Nothing to do for other output types */
-
-        break;
-    }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    CmFlushSourceCode
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Read in any remaining source code after the parse tree
- *              has been constructed.
- *
- ******************************************************************************/
-
-static void
-CmFlushSourceCode (
-    void)
-{
-    char                    Buffer;
-
-
-    while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
-    {
-        AslInsertLineBuffer ((int) Buffer);
-    }
-
-    AslResetCurrentLineBuffer ();
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    FlConsume*
- *
- * PARAMETERS:  Handle              - Open input file
- *              Status              - File current status struct
- *
- * RETURN:      Number of lines consumed
- *
- * DESCRIPTION: Step over both types of comment during check for ascii chars
- *
- ******************************************************************************/
-
-static void
-FlConsumeAnsiComment (
-    FILE                    *Handle,
-    ASL_FILE_STATUS         *Status)
-{
-    UINT8                   Byte;
-    BOOLEAN                 ClosingComment = FALSE;
-
-
-    while (fread (&Byte, 1, 1, Handle) == 1)
-    {
-        /* Scan until comment close is found */
-
-        if (ClosingComment)
-        {
-            if (Byte == '/')
-            {
-                return;
-            }
-
-            if (Byte != '*')
-            {
-                /* Reset */
-
-                ClosingComment = FALSE;
-            }
-        }
-        else if (Byte == '*')
-        {
-            ClosingComment = TRUE;
-        }
-
-        /* Maintain line count */
-
-        if (Byte == 0x0A)
-        {
-            Status->Line++;
-        }
-
-        Status->Offset++;
-    }
-}
-
-
-static void
-FlConsumeNewComment (
-    FILE                    *Handle,
-    ASL_FILE_STATUS         *Status)
-{
-    UINT8                   Byte;
-
-
-    while (fread (&Byte, 1, 1, Handle) == 1)
-    {
-        Status->Offset++;
-
-        /* Comment ends at newline */
-
-        if (Byte == 0x0A)
-        {
-            Status->Line++;
-            return;
-        }
-    }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    FlCheckForAcpiTable
- *
- * PARAMETERS:  Handle              - Open input file
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the
- *              following checks on what would be the table header:
- *              0) File must be at least as long as an ACPI_TABLE_HEADER
- *              1) The header length field must match the file size
- *              2) Signature, OemId, OemTableId, AslCompilerId must be ASCII
- *
- ******************************************************************************/
-
-ACPI_STATUS
-FlCheckForAcpiTable (
-    FILE                    *Handle)
-{
-    ACPI_TABLE_HEADER       Table;
-    UINT32                  FileSize;
-    size_t                  Actual;
-    UINT32                  i;
-
-
-    /* Read a potential table header */
-
-    Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle);
-    fseek (Handle, 0, SEEK_SET);
-
-    if (Actual < sizeof (ACPI_TABLE_HEADER))
-    {
-        return (AE_ERROR);
-    }
-
-    /* Header length field must match the file size */
-
-    FileSize = CmGetFileSize (Handle);
-    if (Table.Length != FileSize)
-    {
-        return (AE_ERROR);
-    }
-
-    /*
-     * These fields must be ASCII:
-     * Signature, OemId, OemTableId, AslCompilerId.
-     * We allow a NULL terminator in OemId and OemTableId.
-     */
-    for (i = 0; i < ACPI_NAME_SIZE; i++)
-    {
-        if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i]))
-        {
-            return (AE_ERROR);
-        }
-
-        if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i]))
-        {
-            return (AE_ERROR);
-        }
-    }
-
-    for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++)
-    {
-        if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i]))
-        {
-            return (AE_ERROR);
-        }
-    }
-
-    for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++)
-    {
-        if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i]))
-        {
-            return (AE_ERROR);
-        }
-    }
-
-    printf ("Binary file appears to be a valid ACPI table, disassembling\n");
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    FlCheckForAscii
- *
- * PARAMETERS:  Handle              - Open input file
- *              Filename            - Input filename
- *              DisplayErrors       - TRUE if error messages desired
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters
- *              within comments. Note: does not handle nested comments and does
- *              not handle comment delimiters within string literals. However,
- *              on the rare chance this happens and an invalid character is
- *              missed, the parser will catch the error by failing in some
- *              spectactular manner.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-FlCheckForAscii (
-    FILE                    *Handle,
-    char                    *Filename,
-    BOOLEAN                 DisplayErrors)
-{
-    UINT8                   Byte;
-    ACPI_SIZE               BadBytes = 0;
-    BOOLEAN                 OpeningComment = FALSE;
-    ASL_FILE_STATUS         Status;
-
-
-    Status.Line = 1;
-    Status.Offset = 0;
-
-    /* Read the entire file */
-
-    while (fread (&Byte, 1, 1, Handle) == 1)
-    {
-        /* Ignore comment fields (allow non-ascii within) */
-
-        if (OpeningComment)
-        {
-            /* Check for second comment open delimiter */
-
-            if (Byte == '*')
-            {
-                FlConsumeAnsiComment (Handle, &Status);
-            }
-
-            if (Byte == '/')
-            {
-                FlConsumeNewComment (Handle, &Status);
-            }
-
-            /* Reset */
-
-            OpeningComment = FALSE;
-        }
-        else if (Byte == '/')
-        {
-            OpeningComment = TRUE;
-        }
-
-        /* Check for an ASCII character */
-
-        if (!ACPI_IS_ASCII (Byte))
-        {
-            if ((BadBytes < 10) && (DisplayErrors))
-            {
-                AcpiOsPrintf (
-                    "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
-                    Byte, Status.Line, Status.Offset);
-            }
-
-            BadBytes++;
-        }
-
-        /* Update line counter */
-
-        else if (Byte == 0x0A)
-        {
-            Status.Line++;
-        }
-
-        Status.Offset++;
-    }
-
-    /* Seek back to the beginning of the source file */
-
-    fseek (Handle, 0, SEEK_SET);
-
-    /* Were there any non-ASCII characters in the file? */
-
-    if (BadBytes)
-    {
-        if (DisplayErrors)
-        {
-            AcpiOsPrintf (
-                "%u non-ASCII characters found in input source text, could be a binary file\n",
-                BadBytes);
-            AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename);
-        }
-
-        return (AE_BAD_CHARACTER);
-    }
-
-    /* File is OK (100% ASCII) */
-
-    return (AE_OK);
-}
+CmDumpAllEvents (
+    void);
 
 
 /*******************************************************************************
@@ -617,7 +142,6 @@ CmDoCompile (
         goto ErrorExit;
     }
 
-
     /* Flush out any remaining source after parse tree is complete */
 
     Event = UtBeginEvent ("Flush source input");
@@ -802,6 +326,197 @@ ErrorExit:
 
 /*******************************************************************************
  *
+ * FUNCTION:    AslCompilerSignon
+ *
+ * PARAMETERS:  FileId      - ID of the output file
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display compiler signon
+ *
+ ******************************************************************************/
+
+void
+AslCompilerSignon (
+    UINT32                  FileId)
+{
+    char                    *Prefix = "";
+    char                    *UtilityName;
+
+
+    /* Set line prefix depending on the destination file type */
+
+    switch (FileId)
+    {
+    case ASL_FILE_ASM_SOURCE_OUTPUT:
+    case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
+        Prefix = "; ";
+        break;
+
+    case ASL_FILE_HEX_OUTPUT:
+
+        if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+        {
+            Prefix = "; ";
+        }
+        else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+                 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
+        {
+            FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
+            Prefix = " * ";
+        }
+        break;
+
+    case ASL_FILE_C_SOURCE_OUTPUT:
+    case ASL_FILE_C_OFFSET_OUTPUT:
+    case ASL_FILE_C_INCLUDE_OUTPUT:
+
+        Prefix = " * ";
+        break;
+
+    default:
+
+        /* No other output types supported */
+
+        break;
+    }
+
+    /* Running compiler or disassembler? */
+
+    if (Gbl_DisasmFlag)
+    {
+        UtilityName = AML_DISASSEMBLER_NAME;
+    }
+    else
+    {
+        UtilityName = ASL_COMPILER_NAME;
+    }
+
+    /* Compiler signon with copyright */
+
+    FlPrintFile (FileId, "%s\n", Prefix);
+    FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslCompilerFileHeader
+ *
+ * PARAMETERS:  FileId      - ID of the output file
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Header used at the beginning of output files
+ *
+ ******************************************************************************/
+
+void
+AslCompilerFileHeader (
+    UINT32                  FileId)
+{
+    struct tm               *NewTime;
+    time_t                  Aclock;
+    char                    *Prefix = "";
+
+
+    /* Set line prefix depending on the destination file type */
+
+    switch (FileId)
+    {
+    case ASL_FILE_ASM_SOURCE_OUTPUT:
+    case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
+        Prefix = "; ";
+        break;
+
+    case ASL_FILE_HEX_OUTPUT:
+
+        if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM)
+        {
+            Prefix = "; ";
+        }
+        else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+                 (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
+        {
+            Prefix = " * ";
+        }
+        break;
+
+    case ASL_FILE_C_SOURCE_OUTPUT:
+    case ASL_FILE_C_OFFSET_OUTPUT:
+    case ASL_FILE_C_INCLUDE_OUTPUT:
+
+        Prefix = " * ";
+        break;
+
+    default:
+
+        /* No other output types supported */
+
+        break;
+    }
+
+    /* Compilation header with timestamp */
+
+    (void) time (&Aclock);
+    NewTime = localtime (&Aclock);
+
+    FlPrintFile (FileId,
+        "%sCompilation of \"%s\" - %s%s\n",
+        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
+        Prefix);
+
+    switch (FileId)
+    {
+    case ASL_FILE_C_SOURCE_OUTPUT:
+    case ASL_FILE_C_OFFSET_OUTPUT:
+    case ASL_FILE_C_INCLUDE_OUTPUT:
+
+        FlPrintFile (FileId, " */\n");
+        break;
+
+    default:
+
+        /* Nothing to do for other output types */
+
+        break;
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    CmFlushSourceCode
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Read in any remaining source code after the parse tree
+ *              has been constructed.
+ *
+ ******************************************************************************/
+
+static void
+CmFlushSourceCode (
+    void)
+{
+    char                    Buffer;
+
+
+    while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR)
+    {
+        AslInsertLineBuffer ((int) Buffer);
+    }
+
+    AslResetCurrentLineBuffer ();
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    CmDoOutputFiles
  *
  * PARAMETERS:  None
@@ -965,7 +680,8 @@ CmCleanupAndExit (
      * We will delete the AML file if there are errors and the
      * force AML output option has not been used.
      */
-    if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) &&
+    if ((Gbl_ExceptionCount[ASL_ERROR] > 0) &&
+        (!Gbl_IgnoreErrors) &&
         Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
     {
         DeleteAmlFile = TRUE;
@@ -1025,4 +741,71 @@ CmCleanupAndExit (
     {
         FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);
     }
+
+    /* Final cleanup after compiling one file */
+
+    CmDeleteCaches ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    CmDeleteCaches
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Delete all local cache buffer blocks
+ *
+ ******************************************************************************/
+
+void
+CmDeleteCaches (
+    void)
+{
+    UINT32                  BufferCount;
+    ASL_CACHE_INFO          *Next;
+
+
+    /* Parse Op cache */
+
+    BufferCount = 0;
+    while (Gbl_ParseOpCacheList)
+    {
+        Next = Gbl_ParseOpCacheList->Next;
+        ACPI_FREE (Gbl_ParseOpCacheList);
+        Gbl_ParseOpCacheList = Next;
+        BufferCount++;
+    }
+
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n",
+        Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE,
+        (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
+
+    Gbl_ParseOpCount = 0;
+    Gbl_ParseOpCacheNext = NULL;
+    Gbl_ParseOpCacheLast = NULL;
+    RootNode = NULL;
+
+    /* Generic string cache */
+
+    BufferCount = 0;
+    while (Gbl_StringCacheList)
+    {
+        Next = Gbl_StringCacheList->Next;
+        ACPI_FREE (Gbl_StringCacheList);
+        Gbl_StringCacheList = Next;
+        BufferCount++;
+    }
+
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n",
+        Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount);
+
+    Gbl_StringSize = 0;
+    Gbl_StringCount = 0;
+    Gbl_StringCacheNext = NULL;
+    Gbl_StringCacheLast = NULL;
 }
index 10251a8..1001f68 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ASLCOMPILER_H
 #define __ASLCOMPILER_H
 
@@ -111,6 +110,11 @@ AslPushInputFileStack (
     FILE                    *InputFile,
     char                    *Filename);
 
+void
+AslParserCleanup (
+    void);
+
+
 /*
  * aslstartup - entered from main()
  */
@@ -154,6 +158,14 @@ void
 CmCleanupAndExit (
     void);
 
+void
+CmDeleteCaches (
+    void);
+
+
+/*
+ * aslascii - ascii support
+ */
 ACPI_STATUS
 FlCheckForAcpiTable (
     FILE                    *Handle);
@@ -914,13 +926,17 @@ UtSetParseOpName (
     ACPI_PARSE_OBJECT       *Op);
 
 char *
-UtGetStringBuffer (
+UtStringCacheCalloc (
     UINT32                  Length);
 
 void
 UtExpandLineBuffers (
     void);
 
+void
+UtFreeLineBuffers (
+    void);
+
 ACPI_STATUS
 UtInternalizeName (
     char                    *ExternalName,
index 60caa49..523241a 100644 (file)
@@ -113,7 +113,8 @@ NamePathTail                [.]{NameSeg}
 "/*"                        { if (!AslDoComment ()) {yyterminate ();} }
 "//"                        { if (!AslDoCommentType2 ()) {yyterminate ();} }
 
-"\""                        { if (AslDoStringLiteral ()) {return (PARSEOP_STRING_LITERAL);} else {yyterminate ();} }
+"\""                        { if (AslDoStringLiteral ()) {return (PARSEOP_STRING_LITERAL);}
+                              else {yyterminate ();} }
 ";"                         { count (0); return(';'); }
 
 
@@ -607,7 +608,7 @@ NamePathTail                [.]{NameSeg}
 
 {NameSeg}                   { char *s;
                                 count (0);
-                                s=malloc (ACPI_NAME_SIZE + 1);
+                                s=UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
                                 if (strcmp (AslCompilertext, "\\"))
                                 {
                                     strcpy (s, "____");
@@ -620,10 +621,9 @@ NamePathTail                [.]{NameSeg}
 
 {NameString}                { char *s;
                                 count (0);
-                                s=malloc (strlen (AslCompilertext)+1);
+                                s=UtStringCacheCalloc (strlen (AslCompilertext)+1);
                                 AcpiUtStrupr (AslCompilertext);
                                 strcpy (s, AslCompilertext);
-                                s[strlen (AslCompilertext)] = 0;
                                 AslCompilerlval.s = s;
                                 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
                                 return (PARSEOP_NAMESTRING); }
index 636a02c..c76b4a0 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ASLDEFINE_H
 #define __ASLDEFINE_H
 
@@ -61,8 +60,8 @@
 /* Configuration constants */
 
 #define ASL_MAX_ERROR_COUNT         200
-#define ASL_NODE_CACHE_SIZE         1024
-#define ASL_STRING_CACHE_SIZE       32768
+#define ASL_PARSEOP_CACHE_SIZE      (1024 * 16)
+#define ASL_STRING_CACHE_SIZE       (1024 * 64)
 
 #define ASL_FIRST_PARSE_OPCODE      PARSEOP_ACCESSAS
 #define ASL_PARSE_OPCODE_BASE       PARSEOP_ACCESSAS        /* First Lex type */
index 14ca99d..fee96ec 100644 (file)
@@ -557,7 +557,7 @@ AslCommonError2 (
     {
         /* Allocate a buffer for the message and a new error node */
 
-        MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
+        MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
 
         /* Keep a copy of the extra message */
 
@@ -571,7 +571,7 @@ AslCommonError2 (
 
     if (Filename)
     {
-        Enode->Filename       = Filename;
+        Enode->Filename = Filename;
         Enode->FilenameLength = strlen (Filename);
         if (Enode->FilenameLength < 6)
         {
@@ -643,7 +643,7 @@ AslCommonError (
     {
         /* Allocate a buffer for the message and a new error node */
 
-        MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
+        MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1);
 
         /* Keep a copy of the extra message */
 
@@ -654,7 +654,7 @@ AslCommonError (
 
     if (Filename)
     {
-        Enode->Filename       = Filename;
+        Enode->Filename = Filename;
         Enode->FilenameLength = strlen (Filename);
         if (Enode->FilenameLength < 6)
         {
index 56d006b..6bde708 100644 (file)
@@ -319,6 +319,8 @@ FlCloseFile (
         AslAbort ();
     }
 
+    /* Do not clear/free the filename string */
+
     Gbl_Files[FileId].Handle = NULL;
     return;
 }
index 514c119..722e0ee 100644 (file)
@@ -107,6 +107,8 @@ FlSetFilename (
     DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n",
          Filename, Gbl_Files[ASL_FILE_INPUT].Filename);
 
+    /* No need to free any existing filename */
+
     Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
 }
 
@@ -216,14 +218,14 @@ FlMergePathnames (
         (*FilePathname == '/') ||
          (FilePathname[1] == ':'))
     {
-        Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1);
+        Pathname = UtStringCacheCalloc (strlen (FilePathname) + 1);
         strcpy (Pathname, FilePathname);
         goto ConvertBackslashes;
     }
 
     /* Need a local copy of the prefix directory path */
 
-    CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1);
+    CommonPath = UtStringCacheCalloc (strlen (PrefixDir) + 1);
     strcpy (CommonPath, PrefixDir);
 
     /*
@@ -259,14 +261,13 @@ FlMergePathnames (
     /* Build the final merged pathname */
 
 ConcatenatePaths:
-    Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2);
+    Pathname = UtStringCacheCalloc (strlen (CommonPath) + strlen (FilePathname) + 2);
     if (LastElement && *CommonPath)
     {
         strcpy (Pathname, CommonPath);
         strcat (Pathname, "/");
     }
     strcat (Pathname, FilePathname);
-    ACPI_FREE (CommonPath);
 
     /* Convert all backslashes to normal slashes */
 
index 5035c25..5799975 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index 4896d70..e347e69 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ASLGLOBAL_H
 #define __ASLGLOBAL_H
 
@@ -96,12 +95,20 @@ extern ASL_FILE_INFO                Gbl_Files [ASL_NUM_FILES];
  */
 extern int                          yydebug;
 extern FILE                         *AslCompilerin;
-extern int                          AslCompilerdebug;
 extern int                          DtParserdebug;
 extern int                          PrParserdebug;
 extern const ASL_MAPPING_ENTRY      AslKeywordMapping[];
 extern char                         *AslCompilertext;
 
+/*
+ * Older versions of Bison won't emit this external in the generated header.
+ * Newer versions do emit the external, so we don't need to do it.
+ */
+#ifndef ASLCOMPILER_ASLCOMPILERPARSE_H
+extern int                  AslCompilerdebug;
+#endif
+
+
 #define ASL_DEFAULT_LINE_BUFFER_SIZE    (1024 * 32) /* 32K */
 #define ASL_MSG_BUFFER_SIZE             4096
 #define ASL_MAX_DISABLED_MESSAGES       32
@@ -201,6 +208,20 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalAllocated, 0);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (TotalFolds, 0);
 
 
+/* Local caches */
+
+ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_ParseOpCount, 0);
+ASL_EXTERN ASL_CACHE_INFO           ASL_INIT_GLOBAL (*Gbl_ParseOpCacheList, NULL);
+ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_ParseOpCacheNext, NULL);
+ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_ParseOpCacheLast, NULL);
+
+ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_StringCount, 0);
+ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_StringSize, 0);
+ASL_EXTERN ASL_CACHE_INFO           ASL_INIT_GLOBAL (*Gbl_StringCacheList, NULL);
+ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
+ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
+
+
 /* Misc */
 
 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0);
@@ -209,10 +230,6 @@ ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*RootNode, NULL);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_TableLength, 0);
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_SourceLine, 0);
 ASL_EXTERN ASL_LISTING_NODE         ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL);
-ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL);
-ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
-ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
-ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
 ASL_EXTERN ACPI_PARSE_OBJECT        *Gbl_FirstLevelInsertionNode;
 ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_FileType, 0);
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
index 6405fad..38766a4 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 
 #define _COMPONENT          ACPI_COMPILER
index c6938bd..13af96a 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index 9b1b2af..ff02d53 100644 (file)
@@ -129,6 +129,7 @@ LdLoadNamespace (
     /* Dump the namespace if debug is enabled */
 
     AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX);
+    ACPI_FREE (WalkState);
     return (AE_OK);
 }
 
index f0c79f7..67c037e 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acparser.h"
index 3034281..25dca94 100644 (file)
@@ -327,6 +327,7 @@ main (
     ACPI_STATUS             Status;
     int                     Index1;
     int                     Index2;
+    int                     ReturnStatus = 0;
 
 
     /*
@@ -392,16 +393,24 @@ main (
         Status = AslDoOneFile (argv[Index2]);
         if (ACPI_FAILURE (Status))
         {
-            return (-1);
+            ReturnStatus = -1;
+            goto CleanupAndExit;
         }
 
         Index2++;
     }
 
+
+CleanupAndExit:
+
+    UtFreeLineBuffers ();
+
+    AslParserCleanup ();
+
     if (AcpiGbl_ExternalFileList)
     {
         AcpiDmClearExternalFileList();
     }
 
-    return (0);
+    return (ReturnStatus);
 }
index c9d196f..30b479e 100644 (file)
@@ -233,7 +233,9 @@ const char                      *AslCompilerMsgs [] =
 /*    ASL_MSG_WRITE */                      "Could not write file",
 /*    ASL_MSG_RANGE */                      "Constant out of range",
 /*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
-/*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency"
+/*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
+/*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference within a method",
+/*    ASL_MSG_ILLEGAL_METHOD_REF */         "Illegal reference across two methods"
 };
 
 /* Table compiler */
index 48ebcbf..ba0c22b 100644 (file)
@@ -236,6 +236,8 @@ typedef enum
     ASL_MSG_RANGE,
     ASL_MSG_BUFFER_ALLOCATION,
     ASL_MSG_MISSING_DEPENDENCY,
+    ASL_MSG_ILLEGAL_FORWARD_REF,
+    ASL_MSG_ILLEGAL_METHOD_REF,
 
     /* These messages are used by the Data Table compiler only */
 
index a040d92..0a5cee2 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acparser.h"
@@ -108,14 +107,38 @@ MtMethodAnalysisWalkBegin (
 
         WalkInfo->MethodStack = MethodInfo;
 
-        /* Special handling for _DSD, must have a _HID also */
+        /*
+         * Special handling for _PSx methods. Dependency rules (same scope):
+         *
+         * 1) _PS0 - One of these must exist: _PS1, _PS2, _PS3
+         * 2) _PS1/_PS2/_PS3: A _PS0 must exist
+         */
+        if (ACPI_COMPARE_NAME (METHOD_NAME__PS0, Op->Asl.NameSeg))
+        {
+            /* For _PS0, one of _PS1/_PS2/_PS3 must exist */
 
-        if (!ACPI_STRCMP (METHOD_NAME__DSD, Op->Asl.NameSeg))
+            if ((!ApFindNameInScope (METHOD_NAME__PS1, Op)) &&
+                (!ApFindNameInScope (METHOD_NAME__PS2, Op)) &&
+                (!ApFindNameInScope (METHOD_NAME__PS3, Op)))
+            {
+                AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
+                    "_PS0 requires one of _PS1/_PS2/_PS3 in same scope");
+            }
+        }
+        else if (
+            ACPI_COMPARE_NAME (METHOD_NAME__PS1, Op->Asl.NameSeg) ||
+            ACPI_COMPARE_NAME (METHOD_NAME__PS2, Op->Asl.NameSeg) ||
+            ACPI_COMPARE_NAME (METHOD_NAME__PS3, Op->Asl.NameSeg))
         {
-            if (!ApFindNameInScope (METHOD_NAME__HID, Op))
+            /* For _PS1/_PS2/_PS3, a _PS0 must exist */
+
+            if (!ApFindNameInScope (METHOD_NAME__PS0, Op))
             {
+                sprintf (MsgBuffer,
+                    "%4.4s requires _PS0 in same scope", Op->Asl.NameSeg);
+
                 AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
-                    "_DSD requires _HID in same scope");
+                    MsgBuffer);
             }
         }
 
@@ -370,6 +393,17 @@ MtMethodAnalysisWalkBegin (
         break;
 
     case PARSEOP_DEVICE:
+
+        Next = Op->Asl.Child;
+
+        if (!ApFindNameInScope (METHOD_NAME__HID, Next) &&
+            !ApFindNameInScope (METHOD_NAME__ADR, Next))
+        {
+            AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
+                "Device object requires a _HID or _ADR in same scope");
+        }
+        break;
+
     case PARSEOP_EVENT:
     case PARSEOP_MUTEX:
     case PARSEOP_OPERATIONREGION:
@@ -424,15 +458,6 @@ MtMethodAnalysisWalkBegin (
             }
         }
 
-        else if (!ACPI_STRCMP (METHOD_NAME__DSD, Op->Asl.NameSeg))
-        {
-            if (!ApFindNameInScope (METHOD_NAME__HID, Op))
-            {
-                AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
-                    "_DSD requires _HID in same scope");
-            }
-        }
-
         break;
 
     default:
index 140e0d4..ede0ff9 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acnamesp.h"
index d6f32d2..1ad4753 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index 4a0f294..b6cf4a4 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
@@ -913,8 +912,8 @@ OpnDoDefinitionBlock (
          * We will use the AML filename that is embedded in the source file
          * for the output filename.
          */
-        Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) +
-                    strlen ((char *) Child->Asl.Value.Buffer) + 1);
+        Filename = UtStringCacheCalloc (strlen (Gbl_DirectoryPath) +
+            strlen ((char *) Child->Asl.Value.Buffer) + 1);
 
         /* Prepend the current directory path */
 
@@ -969,7 +968,7 @@ OpnDoDefinitionBlock (
     if (Child->Asl.Value.String)
     {
         Length = ACPI_STRLEN (Child->Asl.Value.String);
-        Gbl_TableId = AcpiOsAllocate (Length + 1);
+        Gbl_TableId = UtStringCacheCalloc (Length + 1);
         ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);
 
         /*
index 05dd27b..1e9b55b 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
@@ -168,7 +167,7 @@ OptSearchToRoot (
 
     /* We must allocate a new string for the name (TargetPath gets deleted) */
 
-    *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1);
+    *NewPath = UtStringCacheCalloc (ACPI_NAME_SIZE + 1);
     ACPI_STRCPY (*NewPath, Path);
 
     if (ACPI_STRNCMP (*NewPath, "_T_", 3))
@@ -1,6 +1,7 @@
+%{
 /******************************************************************************
  *
- * Module Name: pswalk - Parser routines to walk parsed op tree(s)
+ * Module Name: aslparser.y - Master Bison/Yacc input file for iASL
  *
  *****************************************************************************/
 
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
+#include "aslcompiler.h"
 #include "acpi.h"
 #include "accommon.h"
-#include "acparser.h"
-
-#define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("pswalk")
 
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslparse")
 
-/*******************************************************************************
- *
- * FUNCTION:    AcpiPsDeleteParseTree
- *
- * PARAMETERS:  SubtreeRoot         - Root of tree (or subtree) to delete
- *
- * RETURN:      None
+/*
+ * Global Notes:
  *
- * DESCRIPTION: Delete a portion of or an entire parse tree.
+ * October 2005: The following list terms have been optimized (from the
+ * original ASL grammar in the ACPI specification) to force the immediate
+ * reduction of each list item so that the parse stack use doesn't increase on
+ * each list element and possibly overflow on very large lists (>4000 items).
+ * This dramatically reduces use of the parse stack overall.
  *
- ******************************************************************************/
+ *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
+ *      ResourceMacroList, and FieldUnitList
+ */
 
-void
-AcpiPsDeleteParseTree (
-    ACPI_PARSE_OBJECT       *SubtreeRoot)
-{
-    ACPI_PARSE_OBJECT       *Op = SubtreeRoot;
-    ACPI_PARSE_OBJECT       *Next = NULL;
-    ACPI_PARSE_OBJECT       *Parent = NULL;
+void *                      AslLocalAllocate (unsigned int Size);
 
+/* Bison/yacc configuration */
 
-    ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
+#define static
+#undef malloc
+#define malloc              AslLocalAllocate
+#undef alloca
+#define alloca              AslLocalAllocate
+#define yytname             AslCompilername
 
+#define YYINITDEPTH         600             /* State stack depth */
+#define YYDEBUG             1               /* Enable debug output */
+#define YYERROR_VERBOSE     1               /* Verbose error messages */
+#define YYFLAG              -32768
 
-    /* Visit all nodes in the subtree */
+/* Define YYMALLOC/YYFREE to prevent redefinition errors  */
 
-    while (Op)
-    {
-        /* Check if we are not ascending */
+#define YYMALLOC            malloc
+#define YYFREE              free
+%}
 
-        if (Op != Parent)
-        {
-            /* Look for an argument or child of the current op */
+/*
+ * Declare the type of values in the grammar
+ */
+%union {
+    UINT64              i;
+    char                *s;
+    ACPI_PARSE_OBJECT   *n;
+}
 
-            Next = AcpiPsGetArg (Op, 0);
-            if (Next)
-            {
-                /* Still going downward in tree (Op is not completed yet) */
+/*
+ * These shift/reduce conflicts are expected. There should be zero
+ * reduce/reduce conflicts.
+ */
+%expect 86
 
-                Op = Next;
-                continue;
-            }
-        }
+/*! [Begin] no source code translation */
 
-        /* No more children, this Op is complete. */
+/*
+ * The M4 macro processor is used to bring in the parser items,
+ * in order to keep this master file smaller, and to break up
+ * the various parser items.
+ */
+m4_define(NoEcho)
 
-        Next = Op->Common.Next;
-        Parent = Op->Common.Parent;
+/* Token types */
 
-        AcpiPsFreeOp (Op);
+m4_include(asltokens.y)
 
-        /* If we are back to the starting point, the walk is complete. */
+/* Production types/names */
 
-        if (Op == SubtreeRoot)
-        {
-            return_VOID;
-        }
-        if (Next)
-        {
-            Op = Next;
-        }
-        else
-        {
-            Op = Parent;
-        }
-    }
+m4_include(asltypes.y)
+%%
 
-    return_VOID;
-}
+/* Production rules */
+
+m4_include(aslrules.y)
+%%
+
+/*! [End] no source code translation !*/
+
+/* Local support functions in C */
+
+m4_include(aslsupport.y)
index ce2c4b5..f123990 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
@@ -123,22 +122,10 @@ RsSmallAddressCheck (
         return;
     }
 
-    /* Special case for Memory24, values are compressed */
-
-    if (Type == ACPI_RESOURCE_NAME_MEMORY24)
-    {
-        if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */
-        {
-            Alignment = ACPI_UINT16_MAX + 1;
-        }
-
-        Minimum <<= 8;
-        Maximum <<= 8;
-        Length *= 256;
-    }
-
-    /* IO descriptor has different definition of min/max, don't check */
-
+    /*
+     * Range checks for Memory24 and Memory32.
+     * IO descriptor has different definition of min/max, don't check.
+     */
     if (Type != ACPI_RESOURCE_NAME_IO)
     {
         /* Basic checks on Min/Max/Length */
@@ -151,6 +138,19 @@ RsSmallAddressCheck (
         {
             AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
         }
+
+        /* Special case for Memory24, min/max values are compressed */
+
+        if (Type == ACPI_RESOURCE_NAME_MEMORY24)
+        {
+            if (!Alignment) /* Alignment==0 means 64K alignment */
+            {
+                Alignment = ACPI_UINT16_MAX + 1;
+            }
+
+            Minimum <<= 8;
+            Maximum <<= 8;
+        }
     }
 
     /* Alignment of zero is not in ACPI spec, but is used to mean byte acc */
index 602e009..73f3efe 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
index 5a68500..bc16d72 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
index a1e2fbb..9579fe4 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index d9a560c..297f99a 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
index fa2c611..08590cc 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 
 #define _COMPONENT          ACPI_COMPILER
index 6ee1639..0bd32e7 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
index dc42eb7..c607899 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "amlcode.h"
index efdf2e7..7f58bab 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
@@ -1,7 +1,7 @@
-%{
+NoEcho('
 /******************************************************************************
  *
- * Module Name: aslcompiler.y - Bison/Yacc input file (ASL grammar and actions)
+ * Module Name: aslrules.y - Bison/Yacc production rules
  *
  *****************************************************************************/
 
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include "aslcompiler.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "acpi.h"
-#include "accommon.h"
+')
 
-#define _COMPONENT          ACPI_COMPILER
-        ACPI_MODULE_NAME    ("aslparse")
-
-/*
- * Global Notes:
- *
- * October 2005: The following list terms have been optimized (from the
- * original ASL grammar in the ACPI specification) to force the immediate
- * reduction of each list item so that the parse stack use doesn't increase on
- * each list element and possibly overflow on very large lists (>4000 items).
- * This dramatically reduces use of the parse stack overall.
- *
- *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
- *      ResourceMacroList, and FieldUnitList
- */
-
-void *                      AslLocalAllocate (unsigned int Size);
-
-/* Bison/yacc configuration */
-
-#define static
-#undef alloca
-#define alloca              AslLocalAllocate
-#define yytname             AslCompilername
-
-#define YYINITDEPTH         600             /* State stack depth */
-#define YYDEBUG             1               /* Enable debug output */
-#define YYERROR_VERBOSE     1               /* Verbose error messages */
-
-/* Define YYMALLOC/YYFREE to prevent redefinition errors  */
-
-#define YYMALLOC            malloc
-#define YYFREE              free
-
-/*
- * The windows version of bison defines this incorrectly as "32768" (Not negative).
- * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
- * instead (#define YYFBAD 32768), so we can define it correctly here.
- *
- * The problem is that if YYFLAG is positive, the extended syntax error messages
- * are disabled.
- */
-#define YYFLAG              -32768
-
-%}
-
-/*
- * Declare the type of values in the grammar
- */
-%union {
-    UINT64              i;
-    char                *s;
-    ACPI_PARSE_OBJECT   *n;
-}
-
-/*! [Begin] no source code translation */
-
-/*
- * These shift/reduce conflicts are expected. There should be zero
- * reduce/reduce conflicts.
- */
-%expect 86
-
-/******************************************************************************
- *
- * Token types: These are returned by the lexer
- *
- * NOTE: This list MUST match the AslKeywordMapping table found
- *       in aslmap.c EXACTLY!  Double check any changes!
- *
- *****************************************************************************/
-
-%token <i> PARSEOP_ACCESSAS
-%token <i> PARSEOP_ACCESSATTRIB_BLOCK
-%token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
-%token <i> PARSEOP_ACCESSATTRIB_BYTE
-%token <i> PARSEOP_ACCESSATTRIB_MULTIBYTE
-%token <i> PARSEOP_ACCESSATTRIB_QUICK
-%token <i> PARSEOP_ACCESSATTRIB_RAW_BYTES
-%token <i> PARSEOP_ACCESSATTRIB_RAW_PROCESS
-%token <i> PARSEOP_ACCESSATTRIB_SND_RCV
-%token <i> PARSEOP_ACCESSATTRIB_WORD
-%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL
-%token <i> PARSEOP_ACCESSTYPE_ANY
-%token <i> PARSEOP_ACCESSTYPE_BUF
-%token <i> PARSEOP_ACCESSTYPE_BYTE
-%token <i> PARSEOP_ACCESSTYPE_DWORD
-%token <i> PARSEOP_ACCESSTYPE_QWORD
-%token <i> PARSEOP_ACCESSTYPE_WORD
-%token <i> PARSEOP_ACQUIRE
-%token <i> PARSEOP_ADD
-%token <i> PARSEOP_ADDRESSINGMODE_7BIT
-%token <i> PARSEOP_ADDRESSINGMODE_10BIT
-%token <i> PARSEOP_ADDRESSTYPE_ACPI
-%token <i> PARSEOP_ADDRESSTYPE_MEMORY
-%token <i> PARSEOP_ADDRESSTYPE_NVS
-%token <i> PARSEOP_ADDRESSTYPE_RESERVED
-%token <i> PARSEOP_ALIAS
-%token <i> PARSEOP_AND
-%token <i> PARSEOP_ARG0
-%token <i> PARSEOP_ARG1
-%token <i> PARSEOP_ARG2
-%token <i> PARSEOP_ARG3
-%token <i> PARSEOP_ARG4
-%token <i> PARSEOP_ARG5
-%token <i> PARSEOP_ARG6
-%token <i> PARSEOP_BANKFIELD
-%token <i> PARSEOP_BITSPERBYTE_EIGHT
-%token <i> PARSEOP_BITSPERBYTE_FIVE
-%token <i> PARSEOP_BITSPERBYTE_NINE
-%token <i> PARSEOP_BITSPERBYTE_SEVEN
-%token <i> PARSEOP_BITSPERBYTE_SIX
-%token <i> PARSEOP_BREAK
-%token <i> PARSEOP_BREAKPOINT
-%token <i> PARSEOP_BUFFER
-%token <i> PARSEOP_BUSMASTERTYPE_MASTER
-%token <i> PARSEOP_BUSMASTERTYPE_NOTMASTER
-%token <i> PARSEOP_BYTECONST
-%token <i> PARSEOP_CASE
-%token <i> PARSEOP_CLOCKPHASE_FIRST
-%token <i> PARSEOP_CLOCKPHASE_SECOND
-%token <i> PARSEOP_CLOCKPOLARITY_HIGH
-%token <i> PARSEOP_CLOCKPOLARITY_LOW
-%token <i> PARSEOP_CONCATENATE
-%token <i> PARSEOP_CONCATENATERESTEMPLATE
-%token <i> PARSEOP_CONDREFOF
-%token <i> PARSEOP_CONNECTION
-%token <i> PARSEOP_CONTINUE
-%token <i> PARSEOP_COPYOBJECT
-%token <i> PARSEOP_CREATEBITFIELD
-%token <i> PARSEOP_CREATEBYTEFIELD
-%token <i> PARSEOP_CREATEDWORDFIELD
-%token <i> PARSEOP_CREATEFIELD
-%token <i> PARSEOP_CREATEQWORDFIELD
-%token <i> PARSEOP_CREATEWORDFIELD
-%token <i> PARSEOP_DATABUFFER
-%token <i> PARSEOP_DATATABLEREGION
-%token <i> PARSEOP_DEBUG
-%token <i> PARSEOP_DECODETYPE_POS
-%token <i> PARSEOP_DECODETYPE_SUB
-%token <i> PARSEOP_DECREMENT
-%token <i> PARSEOP_DEFAULT
-%token <i> PARSEOP_DEFAULT_ARG
-%token <i> PARSEOP_DEFINITIONBLOCK
-%token <i> PARSEOP_DEREFOF
-%token <i> PARSEOP_DEVICE
-%token <i> PARSEOP_DEVICEPOLARITY_HIGH
-%token <i> PARSEOP_DEVICEPOLARITY_LOW
-%token <i> PARSEOP_DIVIDE
-%token <i> PARSEOP_DMA
-%token <i> PARSEOP_DMATYPE_A
-%token <i> PARSEOP_DMATYPE_COMPATIBILITY
-%token <i> PARSEOP_DMATYPE_B
-%token <i> PARSEOP_DMATYPE_F
-%token <i> PARSEOP_DWORDCONST
-%token <i> PARSEOP_DWORDIO
-%token <i> PARSEOP_DWORDMEMORY
-%token <i> PARSEOP_DWORDSPACE
-%token <i> PARSEOP_EISAID
-%token <i> PARSEOP_ELSE
-%token <i> PARSEOP_ELSEIF
-%token <i> PARSEOP_ENDDEPENDENTFN
-%token <i> PARSEOP_ENDIAN_BIG
-%token <i> PARSEOP_ENDIAN_LITTLE
-%token <i> PARSEOP_ENDTAG
-%token <i> PARSEOP_ERRORNODE
-%token <i> PARSEOP_EVENT
-%token <i> PARSEOP_EXTENDEDIO
-%token <i> PARSEOP_EXTENDEDMEMORY
-%token <i> PARSEOP_EXTENDEDSPACE
-%token <i> PARSEOP_EXTERNAL
-%token <i> PARSEOP_FATAL
-%token <i> PARSEOP_FIELD
-%token <i> PARSEOP_FINDSETLEFTBIT
-%token <i> PARSEOP_FINDSETRIGHTBIT
-%token <i> PARSEOP_FIXEDDMA
-%token <i> PARSEOP_FIXEDIO
-%token <i> PARSEOP_FLOWCONTROL_HW
-%token <i> PARSEOP_FLOWCONTROL_NONE
-%token <i> PARSEOP_FLOWCONTROL_SW
-%token <i> PARSEOP_FROMBCD
-%token <i> PARSEOP_FUNCTION
-%token <i> PARSEOP_GPIO_INT
-%token <i> PARSEOP_GPIO_IO
-%token <i> PARSEOP_I2C_SERIALBUS
-%token <i> PARSEOP_IF
-%token <i> PARSEOP_INCLUDE
-%token <i> PARSEOP_INCLUDE_END
-%token <i> PARSEOP_INCREMENT
-%token <i> PARSEOP_INDEX
-%token <i> PARSEOP_INDEXFIELD
-%token <i> PARSEOP_INTEGER
-%token <i> PARSEOP_INTERRUPT
-%token <i> PARSEOP_INTLEVEL_ACTIVEBOTH
-%token <i> PARSEOP_INTLEVEL_ACTIVEHIGH
-%token <i> PARSEOP_INTLEVEL_ACTIVELOW
-%token <i> PARSEOP_INTTYPE_EDGE
-%token <i> PARSEOP_INTTYPE_LEVEL
-%token <i> PARSEOP_IO
-%token <i> PARSEOP_IODECODETYPE_10
-%token <i> PARSEOP_IODECODETYPE_16
-%token <i> PARSEOP_IORESTRICT_IN
-%token <i> PARSEOP_IORESTRICT_NONE
-%token <i> PARSEOP_IORESTRICT_OUT
-%token <i> PARSEOP_IORESTRICT_PRESERVE
-%token <i> PARSEOP_IRQ
-%token <i> PARSEOP_IRQNOFLAGS
-%token <i> PARSEOP_LAND
-%token <i> PARSEOP_LEQUAL
-%token <i> PARSEOP_LGREATER
-%token <i> PARSEOP_LGREATEREQUAL
-%token <i> PARSEOP_LLESS
-%token <i> PARSEOP_LLESSEQUAL
-%token <i> PARSEOP_LNOT
-%token <i> PARSEOP_LNOTEQUAL
-%token <i> PARSEOP_LOAD
-%token <i> PARSEOP_LOADTABLE
-%token <i> PARSEOP_LOCAL0
-%token <i> PARSEOP_LOCAL1
-%token <i> PARSEOP_LOCAL2
-%token <i> PARSEOP_LOCAL3
-%token <i> PARSEOP_LOCAL4
-%token <i> PARSEOP_LOCAL5
-%token <i> PARSEOP_LOCAL6
-%token <i> PARSEOP_LOCAL7
-%token <i> PARSEOP_LOCKRULE_LOCK
-%token <i> PARSEOP_LOCKRULE_NOLOCK
-%token <i> PARSEOP_LOR
-%token <i> PARSEOP_MATCH
-%token <i> PARSEOP_MATCHTYPE_MEQ
-%token <i> PARSEOP_MATCHTYPE_MGE
-%token <i> PARSEOP_MATCHTYPE_MGT
-%token <i> PARSEOP_MATCHTYPE_MLE
-%token <i> PARSEOP_MATCHTYPE_MLT
-%token <i> PARSEOP_MATCHTYPE_MTR
-%token <i> PARSEOP_MAXTYPE_FIXED
-%token <i> PARSEOP_MAXTYPE_NOTFIXED
-%token <i> PARSEOP_MEMORY24
-%token <i> PARSEOP_MEMORY32
-%token <i> PARSEOP_MEMORY32FIXED
-%token <i> PARSEOP_MEMTYPE_CACHEABLE
-%token <i> PARSEOP_MEMTYPE_NONCACHEABLE
-%token <i> PARSEOP_MEMTYPE_PREFETCHABLE
-%token <i> PARSEOP_MEMTYPE_WRITECOMBINING
-%token <i> PARSEOP_METHOD
-%token <i> PARSEOP_METHODCALL
-%token <i> PARSEOP_MID
-%token <i> PARSEOP_MINTYPE_FIXED
-%token <i> PARSEOP_MINTYPE_NOTFIXED
-%token <i> PARSEOP_MOD
-%token <i> PARSEOP_MULTIPLY
-%token <i> PARSEOP_MUTEX
-%token <i> PARSEOP_NAME
-%token <s> PARSEOP_NAMESEG
-%token <s> PARSEOP_NAMESTRING
-%token <i> PARSEOP_NAND
-%token <i> PARSEOP_NOOP
-%token <i> PARSEOP_NOR
-%token <i> PARSEOP_NOT
-%token <i> PARSEOP_NOTIFY
-%token <i> PARSEOP_OBJECTTYPE
-%token <i> PARSEOP_OBJECTTYPE_BFF
-%token <i> PARSEOP_OBJECTTYPE_BUF
-%token <i> PARSEOP_OBJECTTYPE_DDB
-%token <i> PARSEOP_OBJECTTYPE_DEV
-%token <i> PARSEOP_OBJECTTYPE_EVT
-%token <i> PARSEOP_OBJECTTYPE_FLD
-%token <i> PARSEOP_OBJECTTYPE_INT
-%token <i> PARSEOP_OBJECTTYPE_MTH
-%token <i> PARSEOP_OBJECTTYPE_MTX
-%token <i> PARSEOP_OBJECTTYPE_OPR
-%token <i> PARSEOP_OBJECTTYPE_PKG
-%token <i> PARSEOP_OBJECTTYPE_POW
-%token <i> PARSEOP_OBJECTTYPE_PRO
-%token <i> PARSEOP_OBJECTTYPE_STR
-%token <i> PARSEOP_OBJECTTYPE_THZ
-%token <i> PARSEOP_OBJECTTYPE_UNK
-%token <i> PARSEOP_OFFSET
-%token <i> PARSEOP_ONE
-%token <i> PARSEOP_ONES
-%token <i> PARSEOP_OPERATIONREGION
-%token <i> PARSEOP_OR
-%token <i> PARSEOP_PACKAGE
-%token <i> PARSEOP_PACKAGE_LENGTH
-%token <i> PARSEOP_PARITYTYPE_EVEN
-%token <i> PARSEOP_PARITYTYPE_MARK
-%token <i> PARSEOP_PARITYTYPE_NONE
-%token <i> PARSEOP_PARITYTYPE_ODD
-%token <i> PARSEOP_PARITYTYPE_SPACE
-%token <i> PARSEOP_PIN_NOPULL
-%token <i> PARSEOP_PIN_PULLDEFAULT
-%token <i> PARSEOP_PIN_PULLDOWN
-%token <i> PARSEOP_PIN_PULLUP
-%token <i> PARSEOP_POWERRESOURCE
-%token <i> PARSEOP_PROCESSOR
-%token <i> PARSEOP_QWORDCONST
-%token <i> PARSEOP_QWORDIO
-%token <i> PARSEOP_QWORDMEMORY
-%token <i> PARSEOP_QWORDSPACE
-%token <i> PARSEOP_RANGETYPE_ENTIRE
-%token <i> PARSEOP_RANGETYPE_ISAONLY
-%token <i> PARSEOP_RANGETYPE_NONISAONLY
-%token <i> PARSEOP_RAW_DATA
-%token <i> PARSEOP_READWRITETYPE_BOTH
-%token <i> PARSEOP_READWRITETYPE_READONLY
-%token <i> PARSEOP_REFOF
-%token <i> PARSEOP_REGIONSPACE_CMOS
-%token <i> PARSEOP_REGIONSPACE_EC
-%token <i> PARSEOP_REGIONSPACE_FFIXEDHW
-%token <i> PARSEOP_REGIONSPACE_GPIO
-%token <i> PARSEOP_REGIONSPACE_GSBUS
-%token <i> PARSEOP_REGIONSPACE_IO
-%token <i> PARSEOP_REGIONSPACE_IPMI
-%token <i> PARSEOP_REGIONSPACE_MEM
-%token <i> PARSEOP_REGIONSPACE_PCC
-%token <i> PARSEOP_REGIONSPACE_PCI
-%token <i> PARSEOP_REGIONSPACE_PCIBAR
-%token <i> PARSEOP_REGIONSPACE_SMBUS
-%token <i> PARSEOP_REGISTER
-%token <i> PARSEOP_RELEASE
-%token <i> PARSEOP_RESERVED_BYTES
-%token <i> PARSEOP_RESET
-%token <i> PARSEOP_RESOURCETEMPLATE
-%token <i> PARSEOP_RESOURCETYPE_CONSUMER
-%token <i> PARSEOP_RESOURCETYPE_PRODUCER
-%token <i> PARSEOP_RETURN
-%token <i> PARSEOP_REVISION
-%token <i> PARSEOP_SCOPE
-%token <i> PARSEOP_SERIALIZERULE_NOTSERIAL
-%token <i> PARSEOP_SERIALIZERULE_SERIAL
-%token <i> PARSEOP_SHARETYPE_EXCLUSIVE
-%token <i> PARSEOP_SHARETYPE_EXCLUSIVEWAKE
-%token <i> PARSEOP_SHARETYPE_SHARED
-%token <i> PARSEOP_SHARETYPE_SHAREDWAKE
-%token <i> PARSEOP_SHIFTLEFT
-%token <i> PARSEOP_SHIFTRIGHT
-%token <i> PARSEOP_SIGNAL
-%token <i> PARSEOP_SIZEOF
-%token <i> PARSEOP_SLAVEMODE_CONTROLLERINIT
-%token <i> PARSEOP_SLAVEMODE_DEVICEINIT
-%token <i> PARSEOP_SLEEP
-%token <i> PARSEOP_SPI_SERIALBUS
-%token <i> PARSEOP_STALL
-%token <i> PARSEOP_STARTDEPENDENTFN
-%token <i> PARSEOP_STARTDEPENDENTFN_NOPRI
-%token <i> PARSEOP_STOPBITS_ONE
-%token <i> PARSEOP_STOPBITS_ONEPLUSHALF
-%token <i> PARSEOP_STOPBITS_TWO
-%token <i> PARSEOP_STOPBITS_ZERO
-%token <i> PARSEOP_STORE
-%token <s> PARSEOP_STRING_LITERAL
-%token <i> PARSEOP_SUBTRACT
-%token <i> PARSEOP_SWITCH
-%token <i> PARSEOP_THERMALZONE
-%token <i> PARSEOP_TIMER
-%token <i> PARSEOP_TOBCD
-%token <i> PARSEOP_TOBUFFER
-%token <i> PARSEOP_TODECIMALSTRING
-%token <i> PARSEOP_TOHEXSTRING
-%token <i> PARSEOP_TOINTEGER
-%token <i> PARSEOP_TOSTRING
-%token <i> PARSEOP_TOUUID
-%token <i> PARSEOP_TRANSLATIONTYPE_DENSE
-%token <i> PARSEOP_TRANSLATIONTYPE_SPARSE
-%token <i> PARSEOP_TYPE_STATIC
-%token <i> PARSEOP_TYPE_TRANSLATION
-%token <i> PARSEOP_UART_SERIALBUS
-%token <i> PARSEOP_UNICODE
-%token <i> PARSEOP_UNLOAD
-%token <i> PARSEOP_UPDATERULE_ONES
-%token <i> PARSEOP_UPDATERULE_PRESERVE
-%token <i> PARSEOP_UPDATERULE_ZEROS
-%token <i> PARSEOP_VAR_PACKAGE
-%token <i> PARSEOP_VENDORLONG
-%token <i> PARSEOP_VENDORSHORT
-%token <i> PARSEOP_WAIT
-%token <i> PARSEOP_WHILE
-%token <i> PARSEOP_WIREMODE_FOUR
-%token <i> PARSEOP_WIREMODE_THREE
-%token <i> PARSEOP_WORDBUSNUMBER
-%token <i> PARSEOP_WORDCONST
-%token <i> PARSEOP_WORDIO
-%token <i> PARSEOP_WORDSPACE
-%token <i> PARSEOP_XFERSIZE_8
-%token <i> PARSEOP_XFERSIZE_16
-%token <i> PARSEOP_XFERSIZE_32
-%token <i> PARSEOP_XFERSIZE_64
-%token <i> PARSEOP_XFERSIZE_128
-%token <i> PARSEOP_XFERSIZE_256
-%token <i> PARSEOP_XFERTYPE_8
-%token <i> PARSEOP_XFERTYPE_8_16
-%token <i> PARSEOP_XFERTYPE_16
-%token <i> PARSEOP_XOR
-%token <i> PARSEOP_ZERO
-
-/*
- * Special functions. These should probably stay at the end of this
- * table.
- */
-%token <i> PARSEOP___DATE__
-%token <i> PARSEOP___FILE__
-%token <i> PARSEOP___LINE__
-%token <i> PARSEOP___PATH__
-
-
-/******************************************************************************
- *
- * Production names
- *
- *****************************************************************************/
-
-%type <n> ArgList
-%type <n> ASLCode
-%type <n> BufferData
-%type <n> BufferTermData
-%type <n> CompilerDirective
-%type <n> DataObject
-%type <n> DefinitionBlockTerm
-%type <n> IntegerData
-%type <n> NamedObject
-%type <n> NameSpaceModifier
-%type <n> Object
-%type <n> ObjectList
-%type <n> PackageData
-%type <n> ParameterTypePackage
-%type <n> ParameterTypePackageList
-%type <n> ParameterTypesPackage
-%type <n> ParameterTypesPackageList
-%type <n> RequiredTarget
-%type <n> SimpleTarget
-%type <n> StringData
-%type <n> Target
-%type <n> Term
-%type <n> TermArg
-%type <n> TermList
-%type <n> UserTerm
-
-/* Type4Opcode is obsolete */
-
-%type <n> Type1Opcode
-%type <n> Type2BufferOpcode
-%type <n> Type2BufferOrStringOpcode
-%type <n> Type2IntegerOpcode
-%type <n> Type2Opcode
-%type <n> Type2StringOpcode
-%type <n> Type3Opcode
-%type <n> Type5Opcode
-%type <n> Type6Opcode
-
-%type <n> AccessAsTerm
-%type <n> ExternalTerm
-%type <n> FieldUnit
-%type <n> FieldUnitEntry
-%type <n> FieldUnitList
-%type <n> IncludeTerm
-%type <n> OffsetTerm
-%type <n> OptionalAccessAttribTerm
-
-/* Named Objects */
-
-%type <n> BankFieldTerm
-%type <n> CreateBitFieldTerm
-%type <n> CreateByteFieldTerm
-%type <n> CreateDWordFieldTerm
-%type <n> CreateFieldTerm
-%type <n> CreateQWordFieldTerm
-%type <n> CreateWordFieldTerm
-%type <n> DataRegionTerm
-%type <n> DeviceTerm
-%type <n> EventTerm
-%type <n> FieldTerm
-%type <n> FunctionTerm
-%type <n> IndexFieldTerm
-%type <n> MethodTerm
-%type <n> MutexTerm
-%type <n> OpRegionTerm
-%type <n> OpRegionSpaceIdTerm
-%type <n> PowerResTerm
-%type <n> ProcessorTerm
-%type <n> ThermalZoneTerm
-
-/* Namespace modifiers */
-
-%type <n> AliasTerm
-%type <n> NameTerm
-%type <n> ScopeTerm
-
-/* Type 1 opcodes */
-
-%type <n> BreakPointTerm
-%type <n> BreakTerm
-%type <n> CaseDefaultTermList
-%type <n> CaseTerm
-%type <n> ContinueTerm
-%type <n> DefaultTerm
-%type <n> ElseTerm
-%type <n> FatalTerm
-%type <n> IfElseTerm
-%type <n> IfTerm
-%type <n> LoadTerm
-%type <n> NoOpTerm
-%type <n> NotifyTerm
-%type <n> ReleaseTerm
-%type <n> ResetTerm
-%type <n> ReturnTerm
-%type <n> SignalTerm
-%type <n> SleepTerm
-%type <n> StallTerm
-%type <n> SwitchTerm
-%type <n> UnloadTerm
-%type <n> WhileTerm
-/* %type <n> CaseTermList */
-
-/* Type 2 opcodes */
-
-%type <n> AcquireTerm
-%type <n> AddTerm
-%type <n> AndTerm
-%type <n> ConcatResTerm
-%type <n> ConcatTerm
-%type <n> CondRefOfTerm
-%type <n> CopyObjectTerm
-%type <n> DecTerm
-%type <n> DerefOfTerm
-%type <n> DivideTerm
-%type <n> FindSetLeftBitTerm
-%type <n> FindSetRightBitTerm
-%type <n> FromBCDTerm
-%type <n> IncTerm
-%type <n> IndexTerm
-%type <n> LAndTerm
-%type <n> LEqualTerm
-%type <n> LGreaterEqualTerm
-%type <n> LGreaterTerm
-%type <n> LLessEqualTerm
-%type <n> LLessTerm
-%type <n> LNotEqualTerm
-%type <n> LNotTerm
-%type <n> LoadTableTerm
-%type <n> LOrTerm
-%type <n> MatchTerm
-%type <n> MidTerm
-%type <n> ModTerm
-%type <n> MultiplyTerm
-%type <n> NAndTerm
-%type <n> NOrTerm
-%type <n> NotTerm
-%type <n> ObjectTypeTerm
-%type <n> OrTerm
-%type <n> RefOfTerm
-%type <n> ShiftLeftTerm
-%type <n> ShiftRightTerm
-%type <n> SizeOfTerm
-%type <n> StoreTerm
-%type <n> SubtractTerm
-%type <n> TimerTerm
-%type <n> ToBCDTerm
-%type <n> ToBufferTerm
-%type <n> ToDecimalStringTerm
-%type <n> ToHexStringTerm
-%type <n> ToIntegerTerm
-%type <n> ToStringTerm
-%type <n> WaitTerm
-%type <n> XOrTerm
-
-/* Keywords */
-
-%type <n> AccessAttribKeyword
-%type <n> AccessTypeKeyword
-%type <n> AddressingModeKeyword
-%type <n> AddressKeyword
-%type <n> AddressSpaceKeyword
-%type <n> BitsPerByteKeyword
-%type <n> ClockPhaseKeyword
-%type <n> ClockPolarityKeyword
-%type <n> DecodeKeyword
-%type <n> DevicePolarityKeyword
-%type <n> DMATypeKeyword
-%type <n> EndianKeyword
-%type <n> FlowControlKeyword
-%type <n> InterruptLevel
-%type <n> InterruptTypeKeyword
-%type <n> IODecodeKeyword
-%type <n> IoRestrictionKeyword
-%type <n> LockRuleKeyword
-%type <n> MatchOpKeyword
-%type <n> MaxKeyword
-%type <n> MemTypeKeyword
-%type <n> MinKeyword
-%type <n> ObjectTypeKeyword
-%type <n> OptionalBusMasterKeyword
-%type <n> OptionalReadWriteKeyword
-%type <n> ParityTypeKeyword
-%type <n> PinConfigByte
-%type <n> PinConfigKeyword
-%type <n> RangeTypeKeyword
-%type <n> RegionSpaceKeyword
-%type <n> ResourceTypeKeyword
-%type <n> SerializeRuleKeyword
-%type <n> ShareTypeKeyword
-%type <n> SlaveModeKeyword
-%type <n> StopBitsKeyword
-%type <n> TranslationKeyword
-%type <n> TypeKeyword
-%type <n> UpdateRuleKeyword
-%type <n> WireModeKeyword
-%type <n> XferSizeKeyword
-%type <n> XferTypeKeyword
-
-/* Types */
-
-%type <n> SuperName
-%type <n> ObjectTypeName
-%type <n> ArgTerm
-%type <n> LocalTerm
-%type <n> DebugTerm
-
-%type <n> Integer
-%type <n> ByteConst
-%type <n> WordConst
-%type <n> DWordConst
-%type <n> QWordConst
-%type <n> String
-
-%type <n> ConstTerm
-%type <n> ConstExprTerm
-%type <n> ByteConstExpr
-%type <n> WordConstExpr
-%type <n> DWordConstExpr
-%type <n> QWordConstExpr
-
-%type <n> DWordList
-%type <n> BufferTerm
-%type <n> ByteList
-
-%type <n> PackageElement
-%type <n> PackageList
-%type <n> PackageTerm
-%type <n> VarPackageLengthTerm
-
-/* Macros */
-
-%type <n> EISAIDTerm
-%type <n> ResourceMacroList
-%type <n> ResourceMacroTerm
-%type <n> ResourceTemplateTerm
-%type <n> ToUUIDTerm
-%type <n> UnicodeTerm
-
-/* Resource Descriptors */
-
-%type <n> ConnectionTerm
-%type <n> DataBufferTerm
-%type <n> DMATerm
-%type <n> DWordIOTerm
-%type <n> DWordMemoryTerm
-%type <n> DWordSpaceTerm
-%type <n> EndDependentFnTerm
-%type <n> ExtendedIOTerm
-%type <n> ExtendedMemoryTerm
-%type <n> ExtendedSpaceTerm
-%type <n> FixedDmaTerm
-%type <n> FixedIOTerm
-%type <n> GpioIntTerm
-%type <n> GpioIoTerm
-%type <n> I2cSerialBusTerm
-%type <n> InterruptTerm
-%type <n> IOTerm
-%type <n> IRQNoFlagsTerm
-%type <n> IRQTerm
-%type <n> Memory24Term
-%type <n> Memory32FixedTerm
-%type <n> Memory32Term
-%type <n> NameSeg
-%type <n> NameString
-%type <n> QWordIOTerm
-%type <n> QWordMemoryTerm
-%type <n> QWordSpaceTerm
-%type <n> RegisterTerm
-%type <n> SpiSerialBusTerm
-%type <n> StartDependentFnNoPriTerm
-%type <n> StartDependentFnTerm
-%type <n> UartSerialBusTerm
-%type <n> VendorLongTerm
-%type <n> VendorShortTerm
-%type <n> WordBusNumberTerm
-%type <n> WordIOTerm
-%type <n> WordSpaceTerm
-
-/* Local types that help construct the AML, not in ACPI spec */
-
-%type <n> AmlPackageLengthTerm
-%type <n> IncludeEndTerm
-%type <n> NameStringItem
-%type <n> TermArgItem
-
-%type <n> OptionalAccessSize
-%type <n> OptionalAddressingMode
-%type <n> OptionalAddressRange
-%type <n> OptionalBitsPerByte
-%type <n> OptionalBuffer_Last
-%type <n> OptionalByteConstExpr
-%type <n> OptionalCount
-%type <n> OptionalDecodeType
-%type <n> OptionalDevicePolarity
-%type <n> OptionalDWordConstExpr
-%type <n> OptionalEndian
-%type <n> OptionalFlowControl
-%type <n> OptionalIoRestriction
-%type <n> OptionalListString
-%type <n> OptionalMaxType
-%type <n> OptionalMemType
-%type <n> OptionalMinType
-%type <n> OptionalNameString
-%type <n> OptionalNameString_First
-%type <n> OptionalNameString_Last
-%type <n> OptionalObjectTypeKeyword
-%type <n> OptionalParameterTypePackage
-%type <n> OptionalParameterTypesPackage
-%type <n> OptionalParityType
-%type <n> OptionalQWordConstExpr
-%type <n> OptionalRangeType
-%type <n> OptionalReference
-%type <n> OptionalResourceType
-%type <n> OptionalResourceType_First
-%type <n> OptionalReturnArg
-%type <n> OptionalSerializeRuleKeyword
-%type <n> OptionalShareType
-%type <n> OptionalShareType_First
-%type <n> OptionalSlaveMode
-%type <n> OptionalStopBits
-%type <n> OptionalStringData
-%type <n> OptionalTermArg
-%type <n> OptionalTranslationType_Last
-%type <n> OptionalType
-%type <n> OptionalType_Last
-%type <n> OptionalWireMode
-%type <n> OptionalWordConst
-%type <n> OptionalWordConstExpr
-%type <n> OptionalXferSize
-
-%%
 /*******************************************************************************
  *
  * Production rules start here
@@ -799,10 +52,7 @@ void *                      AslLocalAllocate (unsigned int Size);
 
 /*
  * ASL Names
- */
-
-
-/*
+ *
  * Root rule. Allow multiple #line directives before the definition block
  * to handle output from preprocessors
  */
@@ -3511,77 +2761,3 @@ OptionalXferSize
     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);}
     | ',' XferSizeKeyword           {$$ = $2;}
     ;
-
-%%
-/******************************************************************************
- *
- * Local support functions
- *
- *****************************************************************************/
-
-int
-AslCompilerwrap(void)
-{
-  return (1);
-}
-
-/*! [End] no source code translation !*/
-
-void *
-AslLocalAllocate (unsigned int Size)
-{
-    void                *Mem;
-
-
-    DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
-
-    Mem = ACPI_ALLOCATE_ZEROED (Size);
-    if (!Mem)
-    {
-        AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
-                        Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
-                        Gbl_InputByteCount, Gbl_CurrentColumn,
-                        Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
-        exit (1);
-    }
-
-    return (Mem);
-}
-
-ACPI_PARSE_OBJECT *
-AslDoError (void)
-{
-
-
-    return (TrCreateLeafNode (PARSEOP_ERRORNODE));
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    UtGetOpName
- *
- * PARAMETERS:  ParseOpcode         - Parser keyword ID
- *
- * RETURN:      Pointer to the opcode name
- *
- * DESCRIPTION: Get the ascii name of the parse opcode
- *
- ******************************************************************************/
-
-char *
-UtGetOpName (
-    UINT32                  ParseOpcode)
-{
-#ifdef ASL_YYTNAME_START
-    /*
-     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
-     * Ignore first 8 characters of the name
-     */
-    return ((char *) yytname
-        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
-#else
-    return ("[Unknown parser generator]");
-#endif
-}
index 1ed6972..84a23db 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "actables.h"
 #include "acdisasm.h"
@@ -284,8 +283,11 @@ AslDoDisassembly (
         return (AE_CTRL_CONTINUE);
     }
 
-    ACPI_FREE (Gbl_Files[ASL_FILE_INPUT].Filename);
+    /* No need to free the filename string */
+
     Gbl_Files[ASL_FILE_INPUT].Filename = NULL;
+
+    CmDeleteCaches ();
     return (AE_OK);
 }
 
@@ -325,8 +327,13 @@ AslDoOneFile (
         return (Status);
     }
 
-    Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
-    UtConvertBackslashes (Filename);
+    /* Take a copy of the input filename, convert any backslashes */
+
+    Gbl_Files[ASL_FILE_INPUT].Filename =
+        UtStringCacheCalloc (strlen (Filename) + 1);
+
+    strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
+    UtConvertBackslashes (Gbl_Files[ASL_FILE_INPUT].Filename);
 
     /*
      * AML Disassembly (Optional)
@@ -396,7 +403,6 @@ AslDoOneFile (
 
         if (Gbl_Signature)
         {
-            ACPI_FREE (Gbl_Signature);
             Gbl_Signature = NULL;
         }
 
index 0317041..7ea43a0 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /* Configuration */
 
 #define ASL_SPACES_PER_TAB      4
@@ -70,6 +69,15 @@ typedef struct asl_file_node
 ASL_FILE_NODE               *Gbl_IncludeFileStack = NULL;
 
 
+void
+AslParserCleanup (
+    void)
+{
+
+    yy_delete_buffer (YY_CURRENT_BUFFER);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    AslDoLineDirective
@@ -259,7 +267,11 @@ AslPushInputFileStack (
 
     /* Reset the global line count and filename */
 
-    Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
+    Gbl_Files[ASL_FILE_INPUT].Filename =
+        UtStringCacheCalloc (strlen (Filename) + 1);
+
+    strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
+
     Gbl_CurrentLineNumber = 1;
     yyin = InputFile;
 }
@@ -797,7 +809,7 @@ CompletedString:
      */
     *StringBuffer = 0;
 
-    CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
+    CleanString = UtStringCacheCalloc (strlen (MsgBuffer) + 1);
     if (!CleanString)
     {
         AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
@@ -1,6 +1,7 @@
+NoEcho('
 /******************************************************************************
  *
- * Module Name: pswalk - Parser routines to walk parsed op tree(s)
+ * Module Name: aslsupport.y - Bison/Yacc C support functions
  *
  *****************************************************************************/
 
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
+')
 
-#include "acpi.h"
-#include "accommon.h"
-#include "acparser.h"
-
-#define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("pswalk")
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiPsDeleteParseTree
- *
- * PARAMETERS:  SubtreeRoot         - Root of tree (or subtree) to delete
- *
- * RETURN:      None
+/******************************************************************************
  *
- * DESCRIPTION: Delete a portion of or an entire parse tree.
+ * Local support functions
  *
- ******************************************************************************/
+ *****************************************************************************/
 
-void
-AcpiPsDeleteParseTree (
-    ACPI_PARSE_OBJECT       *SubtreeRoot)
+/*! [Begin] no source code translation */
+int
+AslCompilerwrap(void)
 {
-    ACPI_PARSE_OBJECT       *Op = SubtreeRoot;
-    ACPI_PARSE_OBJECT       *Next = NULL;
-    ACPI_PARSE_OBJECT       *Parent = NULL;
+  return (1);
+}
+/*! [End] no source code translation !*/
 
 
-    ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
+void *
+AslLocalAllocate (unsigned int Size)
+{
+    void                *Mem;
 
 
-    /* Visit all nodes in the subtree */
+    DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
 
-    while (Op)
+    Mem = UtStringCacheCalloc (Size);
+    if (!Mem)
     {
-        /* Check if we are not ascending */
-
-        if (Op != Parent)
-        {
-            /* Look for an argument or child of the current op */
-
-            Next = AcpiPsGetArg (Op, 0);
-            if (Next)
-            {
-                /* Still going downward in tree (Op is not completed yet) */
-
-                Op = Next;
-                continue;
-            }
-        }
-
-        /* No more children, this Op is complete. */
-
-        Next = Op->Common.Next;
-        Parent = Op->Common.Parent;
-
-        AcpiPsFreeOp (Op);
-
-        /* If we are back to the starting point, the walk is complete. */
-
-        if (Op == SubtreeRoot)
-        {
-            return_VOID;
-        }
-        if (Next)
-        {
-            Op = Next;
-        }
-        else
-        {
-            Op = Parent;
-        }
+        AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
+                        Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+                        Gbl_InputByteCount, Gbl_CurrentColumn,
+                        Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
+        exit (1);
     }
 
-    return_VOID;
+    return (Mem);
+}
+
+ACPI_PARSE_OBJECT *
+AslDoError (void)
+{
+
+
+    return (TrCreateLeafNode (PARSEOP_ERRORNODE));
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    UtGetOpName
+ *
+ * PARAMETERS:  ParseOpcode         - Parser keyword ID
+ *
+ * RETURN:      Pointer to the opcode name
+ *
+ * DESCRIPTION: Get the ascii name of the parse opcode
+ *
+ ******************************************************************************/
+
+char *
+UtGetOpName (
+    UINT32                  ParseOpcode)
+{
+#ifdef ASL_YYTNAME_START
+    /*
+     * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
+     * Ignore first 8 characters of the name
+     */
+    return ((char *) yytname
+        [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
+#else
+    return ("[Unknown parser generator]");
+#endif
 }
diff --git a/sys/contrib/dev/acpica/source/compiler/asltokens.y b/sys/contrib/dev/acpica/source/compiler/asltokens.y
new file mode 100644 (file)
index 0000000..c296fea
--- /dev/null
@@ -0,0 +1,386 @@
+NoEcho('
+/******************************************************************************
+ *
+ * Module Name: asltokens.y - Bison/Yacc token types
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+')
+
+/******************************************************************************
+ *
+ * Token types: These are returned by the lexer
+ *
+ * NOTE: This list MUST match the AslKeywordMapping table found
+ *       in aslmap.c EXACTLY!  Double check any changes!
+ *
+ *****************************************************************************/
+
+%token <i> PARSEOP_ACCESSAS
+%token <i> PARSEOP_ACCESSATTRIB_BLOCK
+%token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
+%token <i> PARSEOP_ACCESSATTRIB_BYTE
+%token <i> PARSEOP_ACCESSATTRIB_MULTIBYTE
+%token <i> PARSEOP_ACCESSATTRIB_QUICK
+%token <i> PARSEOP_ACCESSATTRIB_RAW_BYTES
+%token <i> PARSEOP_ACCESSATTRIB_RAW_PROCESS
+%token <i> PARSEOP_ACCESSATTRIB_SND_RCV
+%token <i> PARSEOP_ACCESSATTRIB_WORD
+%token <i> PARSEOP_ACCESSATTRIB_WORD_CALL
+%token <i> PARSEOP_ACCESSTYPE_ANY
+%token <i> PARSEOP_ACCESSTYPE_BUF
+%token <i> PARSEOP_ACCESSTYPE_BYTE
+%token <i> PARSEOP_ACCESSTYPE_DWORD
+%token <i> PARSEOP_ACCESSTYPE_QWORD
+%token <i> PARSEOP_ACCESSTYPE_WORD
+%token <i> PARSEOP_ACQUIRE
+%token <i> PARSEOP_ADD
+%token <i> PARSEOP_ADDRESSINGMODE_7BIT
+%token <i> PARSEOP_ADDRESSINGMODE_10BIT
+%token <i> PARSEOP_ADDRESSTYPE_ACPI
+%token <i> PARSEOP_ADDRESSTYPE_MEMORY
+%token <i> PARSEOP_ADDRESSTYPE_NVS
+%token <i> PARSEOP_ADDRESSTYPE_RESERVED
+%token <i> PARSEOP_ALIAS
+%token <i> PARSEOP_AND
+%token <i> PARSEOP_ARG0
+%token <i> PARSEOP_ARG1
+%token <i> PARSEOP_ARG2
+%token <i> PARSEOP_ARG3
+%token <i> PARSEOP_ARG4
+%token <i> PARSEOP_ARG5
+%token <i> PARSEOP_ARG6
+%token <i> PARSEOP_BANKFIELD
+%token <i> PARSEOP_BITSPERBYTE_EIGHT
+%token <i> PARSEOP_BITSPERBYTE_FIVE
+%token <i> PARSEOP_BITSPERBYTE_NINE
+%token <i> PARSEOP_BITSPERBYTE_SEVEN
+%token <i> PARSEOP_BITSPERBYTE_SIX
+%token <i> PARSEOP_BREAK
+%token <i> PARSEOP_BREAKPOINT
+%token <i> PARSEOP_BUFFER
+%token <i> PARSEOP_BUSMASTERTYPE_MASTER
+%token <i> PARSEOP_BUSMASTERTYPE_NOTMASTER
+%token <i> PARSEOP_BYTECONST
+%token <i> PARSEOP_CASE
+%token <i> PARSEOP_CLOCKPHASE_FIRST
+%token <i> PARSEOP_CLOCKPHASE_SECOND
+%token <i> PARSEOP_CLOCKPOLARITY_HIGH
+%token <i> PARSEOP_CLOCKPOLARITY_LOW
+%token <i> PARSEOP_CONCATENATE
+%token <i> PARSEOP_CONCATENATERESTEMPLATE
+%token <i> PARSEOP_CONDREFOF
+%token <i> PARSEOP_CONNECTION
+%token <i> PARSEOP_CONTINUE
+%token <i> PARSEOP_COPYOBJECT
+%token <i> PARSEOP_CREATEBITFIELD
+%token <i> PARSEOP_CREATEBYTEFIELD
+%token <i> PARSEOP_CREATEDWORDFIELD
+%token <i> PARSEOP_CREATEFIELD
+%token <i> PARSEOP_CREATEQWORDFIELD
+%token <i> PARSEOP_CREATEWORDFIELD
+%token <i> PARSEOP_DATABUFFER
+%token <i> PARSEOP_DATATABLEREGION
+%token <i> PARSEOP_DEBUG
+%token <i> PARSEOP_DECODETYPE_POS
+%token <i> PARSEOP_DECODETYPE_SUB
+%token <i> PARSEOP_DECREMENT
+%token <i> PARSEOP_DEFAULT
+%token <i> PARSEOP_DEFAULT_ARG
+%token <i> PARSEOP_DEFINITIONBLOCK
+%token <i> PARSEOP_DEREFOF
+%token <i> PARSEOP_DEVICE
+%token <i> PARSEOP_DEVICEPOLARITY_HIGH
+%token <i> PARSEOP_DEVICEPOLARITY_LOW
+%token <i> PARSEOP_DIVIDE
+%token <i> PARSEOP_DMA
+%token <i> PARSEOP_DMATYPE_A
+%token <i> PARSEOP_DMATYPE_COMPATIBILITY
+%token <i> PARSEOP_DMATYPE_B
+%token <i> PARSEOP_DMATYPE_F
+%token <i> PARSEOP_DWORDCONST
+%token <i> PARSEOP_DWORDIO
+%token <i> PARSEOP_DWORDMEMORY
+%token <i> PARSEOP_DWORDSPACE
+%token <i> PARSEOP_EISAID
+%token <i> PARSEOP_ELSE
+%token <i> PARSEOP_ELSEIF
+%token <i> PARSEOP_ENDDEPENDENTFN
+%token <i> PARSEOP_ENDIAN_BIG
+%token <i> PARSEOP_ENDIAN_LITTLE
+%token <i> PARSEOP_ENDTAG
+%token <i> PARSEOP_ERRORNODE
+%token <i> PARSEOP_EVENT
+%token <i> PARSEOP_EXTENDEDIO
+%token <i> PARSEOP_EXTENDEDMEMORY
+%token <i> PARSEOP_EXTENDEDSPACE
+%token <i> PARSEOP_EXTERNAL
+%token <i> PARSEOP_FATAL
+%token <i> PARSEOP_FIELD
+%token <i> PARSEOP_FINDSETLEFTBIT
+%token <i> PARSEOP_FINDSETRIGHTBIT
+%token <i> PARSEOP_FIXEDDMA
+%token <i> PARSEOP_FIXEDIO
+%token <i> PARSEOP_FLOWCONTROL_HW
+%token <i> PARSEOP_FLOWCONTROL_NONE
+%token <i> PARSEOP_FLOWCONTROL_SW
+%token <i> PARSEOP_FROMBCD
+%token <i> PARSEOP_FUNCTION
+%token <i> PARSEOP_GPIO_INT
+%token <i> PARSEOP_GPIO_IO
+%token <i> PARSEOP_I2C_SERIALBUS
+%token <i> PARSEOP_IF
+%token <i> PARSEOP_INCLUDE
+%token <i> PARSEOP_INCLUDE_END
+%token <i> PARSEOP_INCREMENT
+%token <i> PARSEOP_INDEX
+%token <i> PARSEOP_INDEXFIELD
+%token <i> PARSEOP_INTEGER
+%token <i> PARSEOP_INTERRUPT
+%token <i> PARSEOP_INTLEVEL_ACTIVEBOTH
+%token <i> PARSEOP_INTLEVEL_ACTIVEHIGH
+%token <i> PARSEOP_INTLEVEL_ACTIVELOW
+%token <i> PARSEOP_INTTYPE_EDGE
+%token <i> PARSEOP_INTTYPE_LEVEL
+%token <i> PARSEOP_IO
+%token <i> PARSEOP_IODECODETYPE_10
+%token <i> PARSEOP_IODECODETYPE_16
+%token <i> PARSEOP_IORESTRICT_IN
+%token <i> PARSEOP_IORESTRICT_NONE
+%token <i> PARSEOP_IORESTRICT_OUT
+%token <i> PARSEOP_IORESTRICT_PRESERVE
+%token <i> PARSEOP_IRQ
+%token <i> PARSEOP_IRQNOFLAGS
+%token <i> PARSEOP_LAND
+%token <i> PARSEOP_LEQUAL
+%token <i> PARSEOP_LGREATER
+%token <i> PARSEOP_LGREATEREQUAL
+%token <i> PARSEOP_LLESS
+%token <i> PARSEOP_LLESSEQUAL
+%token <i> PARSEOP_LNOT
+%token <i> PARSEOP_LNOTEQUAL
+%token <i> PARSEOP_LOAD
+%token <i> PARSEOP_LOADTABLE
+%token <i> PARSEOP_LOCAL0
+%token <i> PARSEOP_LOCAL1
+%token <i> PARSEOP_LOCAL2
+%token <i> PARSEOP_LOCAL3
+%token <i> PARSEOP_LOCAL4
+%token <i> PARSEOP_LOCAL5
+%token <i> PARSEOP_LOCAL6
+%token <i> PARSEOP_LOCAL7
+%token <i> PARSEOP_LOCKRULE_LOCK
+%token <i> PARSEOP_LOCKRULE_NOLOCK
+%token <i> PARSEOP_LOR
+%token <i> PARSEOP_MATCH
+%token <i> PARSEOP_MATCHTYPE_MEQ
+%token <i> PARSEOP_MATCHTYPE_MGE
+%token <i> PARSEOP_MATCHTYPE_MGT
+%token <i> PARSEOP_MATCHTYPE_MLE
+%token <i> PARSEOP_MATCHTYPE_MLT
+%token <i> PARSEOP_MATCHTYPE_MTR
+%token <i> PARSEOP_MAXTYPE_FIXED
+%token <i> PARSEOP_MAXTYPE_NOTFIXED
+%token <i> PARSEOP_MEMORY24
+%token <i> PARSEOP_MEMORY32
+%token <i> PARSEOP_MEMORY32FIXED
+%token <i> PARSEOP_MEMTYPE_CACHEABLE
+%token <i> PARSEOP_MEMTYPE_NONCACHEABLE
+%token <i> PARSEOP_MEMTYPE_PREFETCHABLE
+%token <i> PARSEOP_MEMTYPE_WRITECOMBINING
+%token <i> PARSEOP_METHOD
+%token <i> PARSEOP_METHODCALL
+%token <i> PARSEOP_MID
+%token <i> PARSEOP_MINTYPE_FIXED
+%token <i> PARSEOP_MINTYPE_NOTFIXED
+%token <i> PARSEOP_MOD
+%token <i> PARSEOP_MULTIPLY
+%token <i> PARSEOP_MUTEX
+%token <i> PARSEOP_NAME
+%token <s> PARSEOP_NAMESEG
+%token <s> PARSEOP_NAMESTRING
+%token <i> PARSEOP_NAND
+%token <i> PARSEOP_NOOP
+%token <i> PARSEOP_NOR
+%token <i> PARSEOP_NOT
+%token <i> PARSEOP_NOTIFY
+%token <i> PARSEOP_OBJECTTYPE
+%token <i> PARSEOP_OBJECTTYPE_BFF
+%token <i> PARSEOP_OBJECTTYPE_BUF
+%token <i> PARSEOP_OBJECTTYPE_DDB
+%token <i> PARSEOP_OBJECTTYPE_DEV
+%token <i> PARSEOP_OBJECTTYPE_EVT
+%token <i> PARSEOP_OBJECTTYPE_FLD
+%token <i> PARSEOP_OBJECTTYPE_INT
+%token <i> PARSEOP_OBJECTTYPE_MTH
+%token <i> PARSEOP_OBJECTTYPE_MTX
+%token <i> PARSEOP_OBJECTTYPE_OPR
+%token <i> PARSEOP_OBJECTTYPE_PKG
+%token <i> PARSEOP_OBJECTTYPE_POW
+%token <i> PARSEOP_OBJECTTYPE_PRO
+%token <i> PARSEOP_OBJECTTYPE_STR
+%token <i> PARSEOP_OBJECTTYPE_THZ
+%token <i> PARSEOP_OBJECTTYPE_UNK
+%token <i> PARSEOP_OFFSET
+%token <i> PARSEOP_ONE
+%token <i> PARSEOP_ONES
+%token <i> PARSEOP_OPERATIONREGION
+%token <i> PARSEOP_OR
+%token <i> PARSEOP_PACKAGE
+%token <i> PARSEOP_PACKAGE_LENGTH
+%token <i> PARSEOP_PARITYTYPE_EVEN
+%token <i> PARSEOP_PARITYTYPE_MARK
+%token <i> PARSEOP_PARITYTYPE_NONE
+%token <i> PARSEOP_PARITYTYPE_ODD
+%token <i> PARSEOP_PARITYTYPE_SPACE
+%token <i> PARSEOP_PIN_NOPULL
+%token <i> PARSEOP_PIN_PULLDEFAULT
+%token <i> PARSEOP_PIN_PULLDOWN
+%token <i> PARSEOP_PIN_PULLUP
+%token <i> PARSEOP_POWERRESOURCE
+%token <i> PARSEOP_PROCESSOR
+%token <i> PARSEOP_QWORDCONST
+%token <i> PARSEOP_QWORDIO
+%token <i> PARSEOP_QWORDMEMORY
+%token <i> PARSEOP_QWORDSPACE
+%token <i> PARSEOP_RANGETYPE_ENTIRE
+%token <i> PARSEOP_RANGETYPE_ISAONLY
+%token <i> PARSEOP_RANGETYPE_NONISAONLY
+%token <i> PARSEOP_RAW_DATA
+%token <i> PARSEOP_READWRITETYPE_BOTH
+%token <i> PARSEOP_READWRITETYPE_READONLY
+%token <i> PARSEOP_REFOF
+%token <i> PARSEOP_REGIONSPACE_CMOS
+%token <i> PARSEOP_REGIONSPACE_EC
+%token <i> PARSEOP_REGIONSPACE_FFIXEDHW
+%token <i> PARSEOP_REGIONSPACE_GPIO
+%token <i> PARSEOP_REGIONSPACE_GSBUS
+%token <i> PARSEOP_REGIONSPACE_IO
+%token <i> PARSEOP_REGIONSPACE_IPMI
+%token <i> PARSEOP_REGIONSPACE_MEM
+%token <i> PARSEOP_REGIONSPACE_PCC
+%token <i> PARSEOP_REGIONSPACE_PCI
+%token <i> PARSEOP_REGIONSPACE_PCIBAR
+%token <i> PARSEOP_REGIONSPACE_SMBUS
+%token <i> PARSEOP_REGISTER
+%token <i> PARSEOP_RELEASE
+%token <i> PARSEOP_RESERVED_BYTES
+%token <i> PARSEOP_RESET
+%token <i> PARSEOP_RESOURCETEMPLATE
+%token <i> PARSEOP_RESOURCETYPE_CONSUMER
+%token <i> PARSEOP_RESOURCETYPE_PRODUCER
+%token <i> PARSEOP_RETURN
+%token <i> PARSEOP_REVISION
+%token <i> PARSEOP_SCOPE
+%token <i> PARSEOP_SERIALIZERULE_NOTSERIAL
+%token <i> PARSEOP_SERIALIZERULE_SERIAL
+%token <i> PARSEOP_SHARETYPE_EXCLUSIVE
+%token <i> PARSEOP_SHARETYPE_EXCLUSIVEWAKE
+%token <i> PARSEOP_SHARETYPE_SHARED
+%token <i> PARSEOP_SHARETYPE_SHAREDWAKE
+%token <i> PARSEOP_SHIFTLEFT
+%token <i> PARSEOP_SHIFTRIGHT
+%token <i> PARSEOP_SIGNAL
+%token <i> PARSEOP_SIZEOF
+%token <i> PARSEOP_SLAVEMODE_CONTROLLERINIT
+%token <i> PARSEOP_SLAVEMODE_DEVICEINIT
+%token <i> PARSEOP_SLEEP
+%token <i> PARSEOP_SPI_SERIALBUS
+%token <i> PARSEOP_STALL
+%token <i> PARSEOP_STARTDEPENDENTFN
+%token <i> PARSEOP_STARTDEPENDENTFN_NOPRI
+%token <i> PARSEOP_STOPBITS_ONE
+%token <i> PARSEOP_STOPBITS_ONEPLUSHALF
+%token <i> PARSEOP_STOPBITS_TWO
+%token <i> PARSEOP_STOPBITS_ZERO
+%token <i> PARSEOP_STORE
+%token <s> PARSEOP_STRING_LITERAL
+%token <i> PARSEOP_SUBTRACT
+%token <i> PARSEOP_SWITCH
+%token <i> PARSEOP_THERMALZONE
+%token <i> PARSEOP_TIMER
+%token <i> PARSEOP_TOBCD
+%token <i> PARSEOP_TOBUFFER
+%token <i> PARSEOP_TODECIMALSTRING
+%token <i> PARSEOP_TOHEXSTRING
+%token <i> PARSEOP_TOINTEGER
+%token <i> PARSEOP_TOSTRING
+%token <i> PARSEOP_TOUUID
+%token <i> PARSEOP_TRANSLATIONTYPE_DENSE
+%token <i> PARSEOP_TRANSLATIONTYPE_SPARSE
+%token <i> PARSEOP_TYPE_STATIC
+%token <i> PARSEOP_TYPE_TRANSLATION
+%token <i> PARSEOP_UART_SERIALBUS
+%token <i> PARSEOP_UNICODE
+%token <i> PARSEOP_UNLOAD
+%token <i> PARSEOP_UPDATERULE_ONES
+%token <i> PARSEOP_UPDATERULE_PRESERVE
+%token <i> PARSEOP_UPDATERULE_ZEROS
+%token <i> PARSEOP_VAR_PACKAGE
+%token <i> PARSEOP_VENDORLONG
+%token <i> PARSEOP_VENDORSHORT
+%token <i> PARSEOP_WAIT
+%token <i> PARSEOP_WHILE
+%token <i> PARSEOP_WIREMODE_FOUR
+%token <i> PARSEOP_WIREMODE_THREE
+%token <i> PARSEOP_WORDBUSNUMBER
+%token <i> PARSEOP_WORDCONST
+%token <i> PARSEOP_WORDIO
+%token <i> PARSEOP_WORDSPACE
+%token <i> PARSEOP_XFERSIZE_8
+%token <i> PARSEOP_XFERSIZE_16
+%token <i> PARSEOP_XFERSIZE_32
+%token <i> PARSEOP_XFERSIZE_64
+%token <i> PARSEOP_XFERSIZE_128
+%token <i> PARSEOP_XFERSIZE_256
+%token <i> PARSEOP_XFERTYPE_8
+%token <i> PARSEOP_XFERTYPE_8_16
+%token <i> PARSEOP_XFERTYPE_16
+%token <i> PARSEOP_XOR
+%token <i> PARSEOP_ZERO
+
+/*
+ * Special functions. These should probably stay at the end of this
+ * table.
+ */
+%token <i> PARSEOP___DATE__
+%token <i> PARSEOP___FILE__
+%token <i> PARSEOP___LINE__
+%token <i> PARSEOP___PATH__
index 9615fe6..34c6ae7 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 
@@ -377,7 +376,6 @@ TrDoDefinitionBlock (
  *
  * RETURN:      None
  *
- *
  * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is
  *              no actual AML opcode for SWITCH -- it must be simulated.
  *
index 0ea4528..cd84d8b 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acapps.h"
@@ -79,15 +78,29 @@ static ACPI_PARSE_OBJECT *
 TrGetNextNode (
     void)
 {
+    ASL_CACHE_INFO          *Cache;
+
 
-    if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
+    if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast)
     {
-        Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) *
-                                ASL_NODE_CACHE_SIZE);
-        Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
+        /* Allocate a new buffer */
+
+        Cache = UtLocalCalloc (sizeof (Cache->Next) +
+            (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE));
+
+        /* Link new cache buffer to head of list */
+
+        Cache->Next = Gbl_ParseOpCacheList;
+        Gbl_ParseOpCacheList = Cache;
+
+        /* Setup cache management pointers */
+
+        Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer);
+        Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE;
     }
 
-    return (Gbl_NodeCacheNext++);
+    Gbl_ParseOpCount++;
+    return (Gbl_ParseOpCacheNext++);
 }
 
 
index 7e297d3..44c937f 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ASLTYPES_H
 #define __ASLTYPES_H
 
@@ -175,6 +174,16 @@ typedef enum
 #define ASL_NUM_FILES           (ASL_MAX_FILE_TYPE + 1)
 
 
+/* Cache block structure for ParseOps and Strings */
+
+typedef struct asl_cache_info
+{
+    void                            *Next;
+    char                            Buffer[1];
+
+} ASL_CACHE_INFO;
+
+
 typedef struct asl_include_dir
 {
     char                        *Dir;
diff --git a/sys/contrib/dev/acpica/source/compiler/asltypes.y b/sys/contrib/dev/acpica/source/compiler/asltypes.y
new file mode 100644 (file)
index 0000000..b991453
--- /dev/null
@@ -0,0 +1,381 @@
+NoEcho('
+/******************************************************************************
+ *
+ * Module Name: asltypes.y - Bison/Yacc production types/names
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+')
+
+/******************************************************************************
+ *
+ * Production names
+ *
+ *****************************************************************************/
+
+%type <n> ArgList
+%type <n> ASLCode
+%type <n> BufferData
+%type <n> BufferTermData
+%type <n> CompilerDirective
+%type <n> DataObject
+%type <n> DefinitionBlockTerm
+%type <n> IntegerData
+%type <n> NamedObject
+%type <n> NameSpaceModifier
+%type <n> Object
+%type <n> ObjectList
+%type <n> PackageData
+%type <n> ParameterTypePackage
+%type <n> ParameterTypePackageList
+%type <n> ParameterTypesPackage
+%type <n> ParameterTypesPackageList
+%type <n> RequiredTarget
+%type <n> SimpleTarget
+%type <n> StringData
+%type <n> Target
+%type <n> Term
+%type <n> TermArg
+%type <n> TermList
+%type <n> UserTerm
+
+/* Type4Opcode is obsolete */
+
+%type <n> Type1Opcode
+%type <n> Type2BufferOpcode
+%type <n> Type2BufferOrStringOpcode
+%type <n> Type2IntegerOpcode
+%type <n> Type2Opcode
+%type <n> Type2StringOpcode
+%type <n> Type3Opcode
+%type <n> Type5Opcode
+%type <n> Type6Opcode
+
+%type <n> AccessAsTerm
+%type <n> ExternalTerm
+%type <n> FieldUnit
+%type <n> FieldUnitEntry
+%type <n> FieldUnitList
+%type <n> IncludeTerm
+%type <n> OffsetTerm
+%type <n> OptionalAccessAttribTerm
+
+/* Named Objects */
+
+%type <n> BankFieldTerm
+%type <n> CreateBitFieldTerm
+%type <n> CreateByteFieldTerm
+%type <n> CreateDWordFieldTerm
+%type <n> CreateFieldTerm
+%type <n> CreateQWordFieldTerm
+%type <n> CreateWordFieldTerm
+%type <n> DataRegionTerm
+%type <n> DeviceTerm
+%type <n> EventTerm
+%type <n> FieldTerm
+%type <n> FunctionTerm
+%type <n> IndexFieldTerm
+%type <n> MethodTerm
+%type <n> MutexTerm
+%type <n> OpRegionTerm
+%type <n> OpRegionSpaceIdTerm
+%type <n> PowerResTerm
+%type <n> ProcessorTerm
+%type <n> ThermalZoneTerm
+
+/* Namespace modifiers */
+
+%type <n> AliasTerm
+%type <n> NameTerm
+%type <n> ScopeTerm
+
+/* Type 1 opcodes */
+
+%type <n> BreakPointTerm
+%type <n> BreakTerm
+%type <n> CaseDefaultTermList
+%type <n> CaseTerm
+%type <n> ContinueTerm
+%type <n> DefaultTerm
+%type <n> ElseTerm
+%type <n> FatalTerm
+%type <n> IfElseTerm
+%type <n> IfTerm
+%type <n> LoadTerm
+%type <n> NoOpTerm
+%type <n> NotifyTerm
+%type <n> ReleaseTerm
+%type <n> ResetTerm
+%type <n> ReturnTerm
+%type <n> SignalTerm
+%type <n> SleepTerm
+%type <n> StallTerm
+%type <n> SwitchTerm
+%type <n> UnloadTerm
+%type <n> WhileTerm
+/* %type <n> CaseTermList */
+
+/* Type 2 opcodes */
+
+%type <n> AcquireTerm
+%type <n> AddTerm
+%type <n> AndTerm
+%type <n> ConcatResTerm
+%type <n> ConcatTerm
+%type <n> CondRefOfTerm
+%type <n> CopyObjectTerm
+%type <n> DecTerm
+%type <n> DerefOfTerm
+%type <n> DivideTerm
+%type <n> FindSetLeftBitTerm
+%type <n> FindSetRightBitTerm
+%type <n> FromBCDTerm
+%type <n> IncTerm
+%type <n> IndexTerm
+%type <n> LAndTerm
+%type <n> LEqualTerm
+%type <n> LGreaterEqualTerm
+%type <n> LGreaterTerm
+%type <n> LLessEqualTerm
+%type <n> LLessTerm
+%type <n> LNotEqualTerm
+%type <n> LNotTerm
+%type <n> LoadTableTerm
+%type <n> LOrTerm
+%type <n> MatchTerm
+%type <n> MidTerm
+%type <n> ModTerm
+%type <n> MultiplyTerm
+%type <n> NAndTerm
+%type <n> NOrTerm
+%type <n> NotTerm
+%type <n> ObjectTypeTerm
+%type <n> OrTerm
+%type <n> RefOfTerm
+%type <n> ShiftLeftTerm
+%type <n> ShiftRightTerm
+%type <n> SizeOfTerm
+%type <n> StoreTerm
+%type <n> SubtractTerm
+%type <n> TimerTerm
+%type <n> ToBCDTerm
+%type <n> ToBufferTerm
+%type <n> ToDecimalStringTerm
+%type <n> ToHexStringTerm
+%type <n> ToIntegerTerm
+%type <n> ToStringTerm
+%type <n> WaitTerm
+%type <n> XOrTerm
+
+/* Keywords */
+
+%type <n> AccessAttribKeyword
+%type <n> AccessTypeKeyword
+%type <n> AddressingModeKeyword
+%type <n> AddressKeyword
+%type <n> AddressSpaceKeyword
+%type <n> BitsPerByteKeyword
+%type <n> ClockPhaseKeyword
+%type <n> ClockPolarityKeyword
+%type <n> DecodeKeyword
+%type <n> DevicePolarityKeyword
+%type <n> DMATypeKeyword
+%type <n> EndianKeyword
+%type <n> FlowControlKeyword
+%type <n> InterruptLevel
+%type <n> InterruptTypeKeyword
+%type <n> IODecodeKeyword
+%type <n> IoRestrictionKeyword
+%type <n> LockRuleKeyword
+%type <n> MatchOpKeyword
+%type <n> MaxKeyword
+%type <n> MemTypeKeyword
+%type <n> MinKeyword
+%type <n> ObjectTypeKeyword
+%type <n> OptionalBusMasterKeyword
+%type <n> OptionalReadWriteKeyword
+%type <n> ParityTypeKeyword
+%type <n> PinConfigByte
+%type <n> PinConfigKeyword
+%type <n> RangeTypeKeyword
+%type <n> RegionSpaceKeyword
+%type <n> ResourceTypeKeyword
+%type <n> SerializeRuleKeyword
+%type <n> ShareTypeKeyword
+%type <n> SlaveModeKeyword
+%type <n> StopBitsKeyword
+%type <n> TranslationKeyword
+%type <n> TypeKeyword
+%type <n> UpdateRuleKeyword
+%type <n> WireModeKeyword
+%type <n> XferSizeKeyword
+%type <n> XferTypeKeyword
+
+/* Types */
+
+%type <n> SuperName
+%type <n> ObjectTypeName
+%type <n> ArgTerm
+%type <n> LocalTerm
+%type <n> DebugTerm
+
+%type <n> Integer
+%type <n> ByteConst
+%type <n> WordConst
+%type <n> DWordConst
+%type <n> QWordConst
+%type <n> String
+
+%type <n> ConstTerm
+%type <n> ConstExprTerm
+%type <n> ByteConstExpr
+%type <n> WordConstExpr
+%type <n> DWordConstExpr
+%type <n> QWordConstExpr
+
+%type <n> DWordList
+%type <n> BufferTerm
+%type <n> ByteList
+
+%type <n> PackageElement
+%type <n> PackageList
+%type <n> PackageTerm
+%type <n> VarPackageLengthTerm
+
+/* Macros */
+
+%type <n> EISAIDTerm
+%type <n> ResourceMacroList
+%type <n> ResourceMacroTerm
+%type <n> ResourceTemplateTerm
+%type <n> ToUUIDTerm
+%type <n> UnicodeTerm
+
+/* Resource Descriptors */
+
+%type <n> ConnectionTerm
+%type <n> DataBufferTerm
+%type <n> DMATerm
+%type <n> DWordIOTerm
+%type <n> DWordMemoryTerm
+%type <n> DWordSpaceTerm
+%type <n> EndDependentFnTerm
+%type <n> ExtendedIOTerm
+%type <n> ExtendedMemoryTerm
+%type <n> ExtendedSpaceTerm
+%type <n> FixedDmaTerm
+%type <n> FixedIOTerm
+%type <n> GpioIntTerm
+%type <n> GpioIoTerm
+%type <n> I2cSerialBusTerm
+%type <n> InterruptTerm
+%type <n> IOTerm
+%type <n> IRQNoFlagsTerm
+%type <n> IRQTerm
+%type <n> Memory24Term
+%type <n> Memory32FixedTerm
+%type <n> Memory32Term
+%type <n> NameSeg
+%type <n> NameString
+%type <n> QWordIOTerm
+%type <n> QWordMemoryTerm
+%type <n> QWordSpaceTerm
+%type <n> RegisterTerm
+%type <n> SpiSerialBusTerm
+%type <n> StartDependentFnNoPriTerm
+%type <n> StartDependentFnTerm
+%type <n> UartSerialBusTerm
+%type <n> VendorLongTerm
+%type <n> VendorShortTerm
+%type <n> WordBusNumberTerm
+%type <n> WordIOTerm
+%type <n> WordSpaceTerm
+
+/* Local types that help construct the AML, not in ACPI spec */
+
+%type <n> AmlPackageLengthTerm
+%type <n> IncludeEndTerm
+%type <n> NameStringItem
+%type <n> TermArgItem
+
+%type <n> OptionalAccessSize
+%type <n> OptionalAddressingMode
+%type <n> OptionalAddressRange
+%type <n> OptionalBitsPerByte
+%type <n> OptionalBuffer_Last
+%type <n> OptionalByteConstExpr
+%type <n> OptionalCount
+%type <n> OptionalDecodeType
+%type <n> OptionalDevicePolarity
+%type <n> OptionalDWordConstExpr
+%type <n> OptionalEndian
+%type <n> OptionalFlowControl
+%type <n> OptionalIoRestriction
+%type <n> OptionalListString
+%type <n> OptionalMaxType
+%type <n> OptionalMemType
+%type <n> OptionalMinType
+%type <n> OptionalNameString
+%type <n> OptionalNameString_First
+%type <n> OptionalNameString_Last
+%type <n> OptionalObjectTypeKeyword
+%type <n> OptionalParameterTypePackage
+%type <n> OptionalParameterTypesPackage
+%type <n> OptionalParityType
+%type <n> OptionalQWordConstExpr
+%type <n> OptionalRangeType
+%type <n> OptionalReference
+%type <n> OptionalResourceType
+%type <n> OptionalResourceType_First
+%type <n> OptionalReturnArg
+%type <n> OptionalSerializeRuleKeyword
+%type <n> OptionalShareType
+%type <n> OptionalShareType_First
+%type <n> OptionalSlaveMode
+%type <n> OptionalStopBits
+%type <n> OptionalStringData
+%type <n> OptionalTermArg
+%type <n> OptionalTranslationType_Last
+%type <n> OptionalType
+%type <n> OptionalType_Last
+%type <n> OptionalWireMode
+%type <n> OptionalWordConst
+%type <n> OptionalWordConstExpr
+%type <n> OptionalXferSize
index b6e6087..c9a9fac 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acdisasm.h"
@@ -554,7 +553,7 @@ UtCheckIntegerRange (
 
 /*******************************************************************************
  *
- * FUNCTION:    UtGetStringBuffer
+ * FUNCTION:    UtStringCacheCalloc
  *
  * PARAMETERS:  Length              - Size of buffer requested
  *
@@ -567,22 +566,42 @@ UtCheckIntegerRange (
  ******************************************************************************/
 
 char *
-UtGetStringBuffer (
+UtStringCacheCalloc (
     UINT32                  Length)
 {
     char                    *Buffer;
+    ASL_CACHE_INFO          *Cache;
+
 
+    if (Length > ASL_STRING_CACHE_SIZE)
+    {
+        Buffer = UtLocalCalloc (Length);
+        return (Buffer);
+    }
 
     if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
     {
-        Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
-        Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE +
-                                Length;
+        /* Allocate a new buffer */
+
+        Cache = UtLocalCalloc (sizeof (Cache->Next) +
+            ASL_STRING_CACHE_SIZE);
+
+        /* Link new cache buffer to head of list */
+
+        Cache->Next = Gbl_StringCacheList;
+        Gbl_StringCacheList = Cache;
+
+        /* Setup cache management pointers */
+
+        Gbl_StringCacheNext = Cache->Buffer;
+        Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE;
     }
 
+    Gbl_StringCount++;
+    Gbl_StringSize += Length;
+
     Buffer = Gbl_StringCacheNext;
     Gbl_StringCacheNext += Length;
-
     return (Buffer);
 }
 
@@ -615,7 +634,8 @@ UtExpandLineBuffers (
     NewSize = Gbl_LineBufferSize * 2;
     if (Gbl_CurrentLineBuffer)
     {
-        DbgPrint (ASL_DEBUG_OUTPUT,"Increasing line buffer size from %u to %u\n",
+        DbgPrint (ASL_DEBUG_OUTPUT,
+            "Increasing line buffer size from %u to %u\n",
             Gbl_LineBufferSize, NewSize);
     }
 
@@ -660,6 +680,30 @@ ErrorExit:
 }
 
 
+/******************************************************************************
+ *
+ * FUNCTION:    UtFreeLineBuffers
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Free all line buffers
+ *
+ *****************************************************************************/
+
+void
+UtFreeLineBuffers (
+    void)
+{
+
+    free (Gbl_CurrentLineBuffer);
+    free (Gbl_MainTokenBuffer);
+    free (Gbl_MacroTokenBuffer);
+    free (Gbl_ExpressionTokenBuffer);
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    UtInternalizeName
@@ -692,9 +736,9 @@ UtInternalizeName (
     Info.ExternalName = ExternalName;
     AcpiNsGetInternalNameLength (&Info);
 
-    /* We need a segment to store the internal  name */
+    /* We need a segment to store the internal name */
 
-    Info.InternalName = UtGetStringBuffer (Info.Length);
+    Info.InternalName = UtStringCacheCalloc (Info.Length);
     if (!Info.InternalName)
     {
         return (AE_NO_MEMORY);
index 960bebc..da4e9e3 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acparser.h"
index ee3a0f8..1cbd6e0 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "aslcompiler.h"
 #include "aslcompiler.y.h"
 #include "acparser.h"
@@ -86,6 +85,20 @@ XfCheckFieldRange (
     UINT32                  FieldBitLength,
     UINT32                  AccessBitWidth);
 
+static BOOLEAN
+XfIsObjectParental (
+    ACPI_PARSE_OBJECT       *MethodOp1,
+    ACPI_PARSE_OBJECT       *MethodOp2);
+
+static ACPI_PARSE_OBJECT *
+XfGetParentMethod (
+    ACPI_PARSE_OBJECT       *Op);
+
+static void
+XfCheckIllegalReference (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_NAMESPACE_NODE     *Node);
+
 
 /*******************************************************************************
  *
@@ -130,6 +143,8 @@ XfCrossReferenceNamespace (
 
     TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin,
                         XfNamespaceLocateEnd, WalkState);
+
+    ACPI_FREE (WalkState);
     return (AE_OK);
 }
 
@@ -262,6 +277,178 @@ XfCheckFieldRange (
     }
 }
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    XfIsObjectParental
+ *
+ * PARAMETERS:  ChildOp                 - Op to be checked
+ *              PossibleParentOp        - Determine if this op is in the family
+ *
+ * RETURN:      TRUE if ChildOp is a descendent of PossibleParentOp
+ *
+ * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to
+ *              detect if a method is declared within another method.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+XfIsObjectParental (
+    ACPI_PARSE_OBJECT       *ChildOp,
+    ACPI_PARSE_OBJECT       *PossibleParentOp)
+{
+    ACPI_PARSE_OBJECT       *ParentOp;
+
+
+    /* Search upwards through the tree for possible parent */
+
+    ParentOp = ChildOp;
+    while (ParentOp)
+    {
+        if (ParentOp == PossibleParentOp)
+        {
+            return (TRUE);
+        }
+
+        ParentOp = ParentOp->Asl.Parent;
+    }
+
+    return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    XfGetParentMethod
+ *
+ * PARAMETERS:  Op                      - Op to be checked
+ *
+ * RETURN:      Op for parent method. NULL if object is not within a method.
+ *
+ * DESCRIPTION: Determine if an object is within a control method. Used to
+ *              implement special rules for named references from within a
+ *              control method.
+ *
+ * NOTE: It would be better to have the parser set a flag in the Op if possible.
+ *
+ ******************************************************************************/
+
+static ACPI_PARSE_OBJECT *
+XfGetParentMethod (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *ParentOp;
+
+
+    if (!Op)
+    {
+        return (NULL);
+    }
+
+    if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
+    {
+        return (NULL);
+    }
+
+    /* Walk upwards through the parse tree, up to the root if necessary */
+
+    ParentOp = Op;
+    while (ParentOp)
+    {
+        if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD)
+        {
+            return (ParentOp);
+        }
+
+        ParentOp = ParentOp->Asl.Parent;
+    }
+
+    /* Object is not within a method */
+
+    return (NULL);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    XfCheckIllegalReference
+ *
+ * PARAMETERS:  Op                      - Op referring to the target
+ *              TargetNode              - Target of the reference
+ *
+ * RETURN:      None. Emits error message for an illegal reference
+ *
+ * DESCRIPTION: Determine if a named reference is legal. A "named" reference
+ *              is something like: Store(ABCD, ...), where ABCD is an AML
+ *              Nameseg or Namepath.
+ *
+ * NOTE: Caller must ensure that the name Op is in fact a reference, and not
+ *       an actual name declaration (creation of a named object).
+ *
+ ******************************************************************************/
+
+static void
+XfCheckIllegalReference (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_NAMESPACE_NODE     *TargetNode)
+{
+    ACPI_PARSE_OBJECT       *MethodOp1;
+    ACPI_PARSE_OBJECT       *MethodOp2;
+    ACPI_PARSE_OBJECT       *TargetOp;
+
+
+    /*
+     * Check for an illegal reference to a named object:
+     *
+     * 1) References from one control method to another, non-parent
+     *    method are not allowed, they will fail at runtime.
+     *
+     * 2) Forward references within a control method are not allowed.
+     *    AML interpreters use a one-pass parse of control methods
+     *    so these forward references will fail at runtime.
+     */
+    TargetOp = TargetNode->Op;
+
+    MethodOp1 = XfGetParentMethod (Op);
+    MethodOp2 = XfGetParentMethod (TargetOp);
+
+    /* Are both objects within control method(s)? */
+
+    if (!MethodOp1 || !MethodOp2)
+    {
+        return;
+    }
+
+    /* Objects not in the same method? */
+
+    if (MethodOp1 != MethodOp2)
+    {
+        /*
+         * 1) Cross-method named reference
+         *
+         * This is OK if and only if the target reference is within in a
+         * method that is a parent of current method
+         */
+        if (!XfIsObjectParental (MethodOp1, MethodOp2))
+        {
+            AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op,
+                Op->Asl.ExternalName);
+        }
+    }
+
+    /*
+     * 2) Both reference and target are in the same method. Check if this is
+     * an (illegal) forward reference by examining the exact source code
+     * location of each (the referenced object and the object declaration).
+     * This is a bit nasty, yet effective.
+     */
+    else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset)
+    {
+        AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
+            Op->Asl.ExternalName);
+    }
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    XfNamespaceLocateBegin
@@ -471,6 +658,10 @@ XfNamespaceLocateBegin (
         /* This node has been referenced, mark it for reference check */
 
         Node->Flags |= ANOBJ_IS_REFERENCED;
+
+        /* Check for an illegal reference */
+
+        XfCheckIllegalReference (Op, Node);
     }
 
     /* Attempt to optimize the NamePath */
index aa1f9d1..5c8fea3 100644 (file)
@@ -141,8 +141,6 @@ DtDoCompile (
     Status = DtCompileDataTable (&FieldList);
     UtEndEvent (Event);
 
-    DtFreeFieldList ();
-
     if (ACPI_FAILURE (Status))
     {
         /* TBD: temporary error message. Msgs should come from function above */
@@ -170,6 +168,8 @@ DtDoCompile (
 
 CleanupAndExit:
 
+    AcpiUtDeleteCaches ();
+    DtDeleteCaches ();
     CmCleanupAndExit ();
     return (Status);
 }
@@ -298,7 +298,7 @@ DtCompileDataTable (
         return (AE_ERROR);
     }
 
-    Gbl_Signature = UtLocalCalloc (ACPI_STRLEN (Signature) + 1);
+    Gbl_Signature = UtStringCacheCalloc (ACPI_STRLEN (Signature) + 1);
     strcpy (Gbl_Signature, Signature);
 
     /*
@@ -461,11 +461,11 @@ DtCompileTable (
         return (AE_ERROR);
     }
 
-    Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
+    Subtable = UtSubtableCacheCalloc ();
 
     if (Length > 0)
     {
-        Subtable->Buffer = UtLocalCalloc (Length);
+        Subtable->Buffer = ACPI_CAST_PTR (UINT8, UtStringCacheCalloc (Length));
     }
     Subtable->Length = Length;
     Subtable->TotalLength = Length;
@@ -567,8 +567,6 @@ DtCompileTable (
             DtSetSubtableLength (InlineSubtable);
 
             ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
-            ACPI_FREE (InlineSubtable->Buffer);
-            ACPI_FREE (InlineSubtable);
             LocalField = *Field;
             break;
 
index cec699c..553f5e6 100644 (file)
 #include "acdisasm.h"
 
 
+#define ASL_FIELD_CACHE_SIZE            512
+#define ASL_SUBTABLE_CACHE_SIZE         128
+
+
 #undef DT_EXTERN
 
 #ifdef _DECLARE_DT_GLOBALS
@@ -143,6 +147,18 @@ DT_EXTERN DT_FIELD          DT_INIT_GLOBAL (*Gbl_LabelList, NULL);
 
 DT_EXTERN UINT32            DT_INIT_GLOBAL (Gbl_CurrentTableOffset, 0);
 
+/* Local caches */
+
+DT_EXTERN UINT32            DT_INIT_GLOBAL (Gbl_SubtableCount, 0);
+DT_EXTERN ASL_CACHE_INFO    DT_INIT_GLOBAL (*Gbl_SubtableCacheList, NULL);
+DT_EXTERN DT_SUBTABLE       DT_INIT_GLOBAL (*Gbl_SubtableCacheNext, NULL);
+DT_EXTERN DT_SUBTABLE       DT_INIT_GLOBAL (*Gbl_SubtableCacheLast, NULL);
+
+DT_EXTERN UINT32            DT_INIT_GLOBAL (Gbl_FieldCount, 0);
+DT_EXTERN ASL_CACHE_INFO    DT_INIT_GLOBAL (*Gbl_FieldCacheList, NULL);
+DT_EXTERN DT_FIELD          DT_INIT_GLOBAL (*Gbl_FieldCacheNext, NULL);
+DT_EXTERN DT_FIELD          DT_INIT_GLOBAL (*Gbl_FieldCacheLast, NULL);
+
 
 /* dtcompiler - main module */
 
@@ -368,8 +384,16 @@ void
 DtSetTableLength(
     void);
 
+DT_SUBTABLE *
+UtSubtableCacheCalloc (
+    void);
+
+DT_FIELD *
+UtFieldCacheCalloc (
+    void);
+
 void
-DtFreeFieldList (
+DtDeleteCaches (
     void);
 
 
index 25d84ab..f8e35fd 100644 (file)
@@ -133,7 +133,7 @@ DtTrim (
 
     if (!ACPI_STRCMP (String, " "))
     {
-        ReturnString = UtLocalCalloc (1);
+        ReturnString = UtStringCacheCalloc (1);
         return (ReturnString);
     }
 
@@ -181,7 +181,7 @@ DtTrim (
     /* Create the trimmed return string */
 
     Length = ACPI_PTR_DIFF (End, Start) + 1;
-    ReturnString = UtLocalCalloc (Length + 1);
+    ReturnString = UtStringCacheCalloc (Length + 1);
     if (ACPI_STRLEN (Start))
     {
         ACPI_STRNCPY (ReturnString, Start, Length);
@@ -370,7 +370,7 @@ DtParseLine (
 
     if ((Value && *Value) || IsNullString)
     {
-        Field = UtLocalCalloc (sizeof (DT_FIELD));
+        Field = UtFieldCacheCalloc ();
         Field->Name = Name;
         Field->Value = Value;
         Field->Line = Line;
@@ -380,11 +380,7 @@ DtParseLine (
 
         DtLinkField (Field);
     }
-    else /* Ignore this field, it has no valid data */
-    {
-        ACPI_FREE (Name);
-        ACPI_FREE (Value);
-    }
+    /* Else -- Ignore this field, it has no valid data */
 
     return (AE_OK);
 }
@@ -1035,6 +1031,8 @@ DtDumpSubtableList (
     DbgPrint (ASL_DEBUG_OUTPUT,
         "\nSubtable Tree: (Depth, Subtable, Length, TotalLength)\n\n");
     DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL);
+
+    DbgPrint (ASL_DEBUG_OUTPUT, "\n");
 }
 
 
index 90cb067..a87198d 100644 (file)
@@ -75,11 +75,11 @@ DtCreateSubtable (
     DT_SUBTABLE             *Subtable;
 
 
-    Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
+    Subtable = UtSubtableCacheCalloc ();
 
     /* Create a new buffer for the subtable data */
 
-    Subtable->Buffer = UtLocalCalloc (Length);
+    Subtable->Buffer = ACPI_CAST_PTR (UINT8, UtStringCacheCalloc (Length));
     ACPI_MEMCPY (Subtable->Buffer, Buffer, Length);
 
     Subtable->Length = Length;
index 78a459f..a0dee31 100644 (file)
@@ -2420,6 +2420,11 @@ DtCompileSrat (
             InfoTable = AcpiDmTableInfoSrat2;
             break;
 
+        case ACPI_SRAT_TYPE_GICC_AFFINITY:
+
+            InfoTable = AcpiDmTableInfoSrat3;
+            break;
+
         default:
 
             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT");
index 8cafbf9..4fb6be0 100644 (file)
@@ -187,6 +187,12 @@ GetTemplate:
     }
 
     Status = DtCreateOneTemplate (Signature, TableData);
+
+
+    /* Shutdown ACPICA subsystem */
+
+    (void) AcpiTerminate ();
+    CmDeleteCaches ();
     return (Status);
 }
 
@@ -397,6 +403,5 @@ DtCreateOneTemplate (
 Cleanup:
     fclose (File);
     AcpiOsRedirectOutput (stdout);
-    ACPI_FREE (DisasmFilename);
     return (Status);
 }
index 67515ea..4011f08 100644 (file)
@@ -961,11 +961,11 @@ const unsigned char TemplateSpmi[] =
 
 const unsigned char TemplateSrat[] =
 {
-    0x53,0x52,0x41,0x54,0x80,0x00,0x00,0x00,  /* 00000000    "SRAT...." */
-    0x03,0x5A,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    ".ZINTEL " */
-    0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
+    0x53,0x52,0x41,0x54,0x92,0x00,0x00,0x00,  /* 00000000    "SRAT...." */
+    0x03,0x50,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    ".PINTEL " */
+    0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65,  /* 00000010    "Template" */
     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
-    0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00,  /* 00000020    "(.. ...." */
+    0x24,0x07,0x14,0x20,0x01,0x00,0x00,0x00,  /* 00000020    "$.. ...." */
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */
     0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x00,  /* 00000030    "........" */
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
@@ -976,7 +976,10 @@ const unsigned char TemplateSrat[] =
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000060    "........" */
     0x02,0x18,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000068    "........" */
     0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,  /* 00000070    "........" */
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00   /* 00000078    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000078    "........" */
+    0x03,0x12,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000080    "........" */
+    0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,  /* 00000088    "........" */
+    0x00,0x00                                 /* 00000090    ".."       */
 };
 
 const unsigned char TemplateTcpa[] =
index 9cfd314..6927c56 100644 (file)
@@ -845,39 +845,151 @@ DtWalkTableTree (
 }
 
 
-/******************************************************************************
+/*******************************************************************************
+ *
+ * FUNCTION:    UtSubtableCacheCalloc
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Pointer to the buffer. Aborts on allocation failure
+ *
+ * DESCRIPTION: Allocate a subtable object buffer. Bypass the local
+ *              dynamic memory manager for performance reasons (This has a
+ *              major impact on the speed of the compiler.)
+ *
+ ******************************************************************************/
+
+DT_SUBTABLE *
+UtSubtableCacheCalloc (
+    void)
+{
+    ASL_CACHE_INFO          *Cache;
+
+
+    if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast)
+    {
+        /* Allocate a new buffer */
+
+        Cache = UtLocalCalloc (sizeof (Cache->Next) +
+            (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE));
+
+        /* Link new cache buffer to head of list */
+
+        Cache->Next = Gbl_SubtableCacheList;
+        Gbl_SubtableCacheList = Cache;
+
+        /* Setup cache management pointers */
+
+        Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer);
+        Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE;
+    }
+
+    Gbl_SubtableCount++;
+    return (Gbl_SubtableCacheNext++);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    UtFieldCacheCalloc
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Pointer to the buffer. Aborts on allocation failure
  *
- * FUNCTION:    DtFreeFieldList
+ * DESCRIPTION: Allocate a field object buffer. Bypass the local
+ *              dynamic memory manager for performance reasons (This has a
+ *              major impact on the speed of the compiler.)
+ *
+ ******************************************************************************/
+
+DT_FIELD *
+UtFieldCacheCalloc (
+    void)
+{
+    ASL_CACHE_INFO          *Cache;
+
+
+    if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast)
+    {
+        /* Allocate a new buffer */
+
+        Cache = UtLocalCalloc (sizeof (Cache->Next) +
+            (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE));
+
+        /* Link new cache buffer to head of list */
+
+        Cache->Next = Gbl_FieldCacheList;
+        Gbl_FieldCacheList = Cache;
+
+        /* Setup cache management pointers */
+
+        Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer);
+        Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE;
+    }
+
+    Gbl_FieldCount++;
+    return (Gbl_FieldCacheNext++);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    DtDeleteCaches
  *
  * PARAMETERS:  None
  *
  * RETURN:      None
  *
- * DESCRIPTION: Free the field list
+ * DESCRIPTION: Delete all local cache buffer blocks
  *
- *****************************************************************************/
+ ******************************************************************************/
 
 void
-DtFreeFieldList (
+DtDeleteCaches (
     void)
 {
-    DT_FIELD                *Field = Gbl_FieldList;
-    DT_FIELD                *NextField;
+    UINT32                  BufferCount;
+    ASL_CACHE_INFO          *Next;
 
 
-    /* Walk and free entire field list */
+    /* Field cache */
 
-    while (Field)
+    BufferCount = 0;
+    while (Gbl_FieldCacheList)
     {
-        NextField = Field->Next; /* Save link */
+        Next = Gbl_FieldCacheList->Next;
+        ACPI_FREE (Gbl_FieldCacheList);
+        Gbl_FieldCacheList = Next;
+        BufferCount++;
+    }
 
-        if (!(Field->Flags & DT_FIELD_NOT_ALLOCATED))
-        {
-            ACPI_FREE (Field->Name);
-            ACPI_FREE (Field->Value);
-        }
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n",
+        Gbl_FieldCount, ASL_FIELD_CACHE_SIZE,
+        (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
+
+    Gbl_FieldCount = 0;
+    Gbl_FieldCacheNext = NULL;
+    Gbl_FieldCacheLast = NULL;
+
+    /* Subtable cache */
 
-        ACPI_FREE (Field);
-        Field = NextField;
+    BufferCount = 0;
+    while (Gbl_SubtableCacheList)
+    {
+        Next = Gbl_SubtableCacheList->Next;
+        ACPI_FREE (Gbl_SubtableCacheList);
+        Gbl_SubtableCacheList = Next;
+        BufferCount++;
     }
+
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n",
+        Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE,
+        (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
+
+    Gbl_SubtableCount = 0;
+    Gbl_SubtableCacheNext = NULL;
+    Gbl_SubtableCacheLast = NULL;
 }
index d8b7d45..a93a14e 100644 (file)
@@ -340,7 +340,6 @@ PrOpenIncludeWithPrefix (
     if (!IncludeFile)
     {
         fprintf (stderr, "Could not open include file %s\n", Pathname);
-        ACPI_FREE (Pathname);
         return (NULL);
     }
 
@@ -393,15 +392,17 @@ PrPushInputFileStack (
 
     /* Reset the global line count and filename */
 
-    Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
+    Gbl_Files[ASL_FILE_INPUT].Filename =
+        UtStringCacheCalloc (strlen (Filename) + 1);
+    strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename);
+
     Gbl_Files[ASL_FILE_INPUT].Handle = InputFile;
     Gbl_PreviousLineNumber = 0;
     Gbl_CurrentLineNumber = 0;
 
     /* Emit a new #line directive for the include file */
 
-    FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
-        1, Filename);
+    FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n", 1, Filename);
 }
 
 
index d9aa2e7..44aafbf 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acevents.h"
index fb47c7b..9d0a216 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "amlcode.h"
index 806b80f..71db787 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdebug.h"
index ee4ba15..abdc454 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdebug.h"
index b56d4ef..6680306 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdebug.h"
index 88fbb94..abf9688 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdebug.h"
index 90d1314..05fd2af 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdispat.h"
index de02fb6..29fe1ec 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acnamesp.h"
index 450afcb..db29db5 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdebug.h"
index fcc33ed..1d4963d 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acnamesp.h"
index 671a8f3..9a304ad 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "amlcode.h"
index 3e48afc..dd9039e 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acdisasm.h"
@@ -274,7 +273,7 @@ AcpiDmGpioIntDescriptor (
     AcpiDmIndent (Level);
     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
         AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
-        AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Gpio.IntFlags, 1)],
+        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
 
     /* PinConfig, DebounceTimeout */
index 6251b36..a8aea02 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acevents.h"
index 51437a9..bbd88dc 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #define __EVXFACE_C__
 #define EXPORT_ACPI_INTERFACES
 
index 9e7436a..79e888f 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #define __EVXFGPE_C__
 #define EXPORT_ACPI_INTERFACES
 
index 9223e4b..5b13d19 100644 (file)
@@ -101,7 +101,7 @@ AcpiExDoDebugObject (
      * debug output. Only need the lower 26 bits. This allows for 67
      * million microseconds or 67 seconds before rollover.
      */
-    Timer = (UINT32) (AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */
+    Timer = ((UINT32) AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */
     Timer &= 0x03FFFFFF;
 
     /*
index 1e66b5a..6cc3c70 100644 (file)
@@ -321,6 +321,46 @@ AcpiNsCheckPackage (
         Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
         break;
 
+    case ACPI_PTYPE2_UUID_PAIR:
+
+        /* The package must contain pairs of (UUID + type) */
+
+        if (Count & 1)
+        {
+            ExpectedCount = Count + 1;
+            goto PackageTooSmall;
+        }
+
+        while (Count > 0)
+        {
+            Status = AcpiNsCheckObjectType(Info, Elements,
+                        Package->RetInfo.ObjectType1, 0);
+            if (ACPI_FAILURE(Status))
+            {
+                return (Status);
+            }
+
+            /* Validate length of the UUID buffer */
+
+            if ((*Elements)->Buffer.Length != 16)
+            {
+                ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
+                    Info->NodeFlags, "Invalid length for UUID Buffer"));
+                return (AE_AML_OPERAND_VALUE);
+            }
+
+            Status = AcpiNsCheckObjectType(Info, Elements + 1,
+                        Package->RetInfo.ObjectType2, 0);
+            if (ACPI_FAILURE(Status))
+            {
+                return (Status);
+            }
+
+            Elements += 2;
+            Count -= 2;
+         }
+         break;
+
     default:
 
         /* Should not get here if predefined info table is correct */
index ace1d6b..5d5dab4 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Parse the AML and build an operation tree as most interpreters, (such as
  * Perl) do. Parsing is done by hand rather than with a YACC generated parser
index 6618171..2f69a14 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index bcfb57d..60758e4 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acopcode.h"
index af15d30..d419aa0 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index 7b8e1b9..31899bd 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Parse the AML and build an operation tree as most interpreters,
  * like Perl, do. Parsing is done by hand rather than with a YACC
index 1a51241..d0068b7 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index 6c37839..f6d8c59 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index 4e41d4b..026205d 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acparser.h"
index 53ad155..af077ae 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #define __UTRESRC_C__
 
 #include "acpi.h"
@@ -100,7 +99,9 @@ const char                      *AcpiGbl_IoDecode[] =
 const char                      *AcpiGbl_LlDecode[] =
 {
     "ActiveHigh",
-    "ActiveLow"
+    "ActiveLow",
+    "ActiveBoth",
+    "Reserved"
 };
 
 const char                      *AcpiGbl_MaxDecode[] =
index 094356a..a732d17 100644 (file)
@@ -360,6 +360,7 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSratHdr[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat0[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat1[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat2[];
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat3[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpa[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTpm2[];
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoUefi[];
index 5715ab3..c4abebb 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef _ACDISPAT_H_
 #define _ACDISPAT_H_
 
index b8322e6..bd2a168 100644 (file)
 #define METHOD_NAME__PRS        "_PRS"
 #define METHOD_NAME__PRT        "_PRT"
 #define METHOD_NAME__PRW        "_PRW"
+#define METHOD_NAME__PS0        "_PS0"
+#define METHOD_NAME__PS1        "_PS1"
+#define METHOD_NAME__PS2        "_PS2"
+#define METHOD_NAME__PS3        "_PS3"
 #define METHOD_NAME__REG        "_REG"
 #define METHOD_NAME__SB_        "_SB_"
 #define METHOD_NAME__SEG        "_SEG"
index bddd3c1..8d8adba 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ACPARSER_H__
 #define __ACPARSER_H__
 
index 7174101..40037b1 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20140724
+#define ACPI_CA_VERSION                 0x20140828
 
 #include "acconfig.h"
 #include "actypes.h"
index f9aa1e0..a781056 100644 (file)
@@ -1118,7 +1118,8 @@ enum AcpiSratType
     ACPI_SRAT_TYPE_CPU_AFFINITY         = 0,
     ACPI_SRAT_TYPE_MEMORY_AFFINITY      = 1,
     ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY  = 2,
-    ACPI_SRAT_TYPE_RESERVED             = 3     /* 3 and greater are reserved */
+    ACPI_SRAT_TYPE_GICC_AFFINITY        = 3,
+    ACPI_SRAT_TYPE_RESERVED             = 4     /* 4 and greater are reserved */
 };
 
 /*
@@ -1135,7 +1136,7 @@ typedef struct acpi_srat_cpu_affinity
     UINT32                  Flags;
     UINT8                   LocalSapicEid;
     UINT8                   ProximityDomainHi[3];
-    UINT32                  Reserved;           /* Reserved, must be zero */
+    UINT32                  ClockDomain;
 
 } ACPI_SRAT_CPU_AFFINITY;
 
@@ -1185,6 +1186,22 @@ typedef struct acpi_srat_x2apic_cpu_affinity
 #define ACPI_SRAT_CPU_ENABLED       (1)         /* 00: Use affinity structure */
 
 
+/* 3: GICC Affinity (ACPI 5.1) */
+
+typedef struct acpi_srat_gicc_affinity
+{
+    ACPI_SUBTABLE_HEADER    Header;
+    UINT32                  ProximityDomain;
+    UINT32                  AcpiProcessorUid;
+    UINT32                  Flags;
+    UINT32                  ClockDomain;
+
+} ACPI_SRAT_GICC_AFFINITY;
+
+/* Flags for ACPI_SRAT_GICC_AFFINITY */
+
+#define ACPI_SRAT_GICC_ENABLED     (1)         /* 00: Use affinity structure */
+
 /* Reset to default packing */
 
 #pragma pack()
index 37bbd3e..2f98b37 100644 (file)
@@ -360,11 +360,15 @@ typedef struct acpi_gtdt_timer_entry
 
 } ACPI_GTDT_TIMER_ENTRY;
 
+/* Flag Definitions: TimerFlags and VirtualTimerFlags above */
+
+#define ACPI_GTDT_GT_IRQ_MODE               (1)
+#define ACPI_GTDT_GT_IRQ_POLARITY           (1<<1)
 
 /* Flag Definitions: CommonFlags above */
 
-#define ACPI_GTDT_GT_IS_SECURE_TIMER    (1)
-#define ACPI_GTDT_GT_ALWAYS_ON          (1<<1)
+#define ACPI_GTDT_GT_IS_SECURE_TIMER        (1)
+#define ACPI_GTDT_GT_ALWAYS_ON              (1<<1)
 
 
 /* 1: SBSA Generic Watchdog Structure */
index 30f53e9..a56a513 100644 (file)
 #ifndef __ACLINUX_H__
 #define __ACLINUX_H__
 
+#ifdef __KERNEL__
+
+/* ACPICA external files should not include ACPICA headers directly. */
+
+#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H)
+#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead."
+#endif
+
+#endif
+
 /* Common (in-kernel/user-space) ACPICA configuration */
 
 #define ACPI_USE_SYSTEM_CLIBRARY
@@ -71,7 +81,9 @@
 #ifdef EXPORT_ACPI_INTERFACES
 #include <linux/export.h>
 #endif
+#ifdef CONFIG_ACPI
 #include <asm/acenv.h>
+#endif
 
 #ifndef CONFIG_ACPI
 
index c51f90c..cc6d2ce 100644 (file)
 
 #ifdef __KERNEL__
 
+#ifndef ACPI_USE_NATIVE_DIVIDE
+
+#ifndef ACPI_DIV_64_BY_32
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+    do { \
+        UINT64 (__n) = ((UINT64) n_hi) << 32 | (n_lo); \
+        (r32) = do_div ((__n), (d32)); \
+        (q32) = (UINT32) (__n); \
+    } while (0)
+#endif
+
+#ifndef ACPI_SHIFT_RIGHT_64
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+    do { \
+        (n_lo) >>= 1; \
+        (n_lo) |= (((n_hi) & 1) << 31); \
+        (n_hi) >>= 1; \
+    } while (0)
+#endif
+
+#endif
+
 /*
  * Overrides for in-kernel ACPICA
  */
index ec664b0..845a319 100644 (file)
 /* Debug support. Must be last in this file, do not move. */
 
 #ifdef _DEBUG
+#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
+
+#include <stdlib.h>
+#include <malloc.h>
 #include <crtdbg.h>
 
 /*
  * This can quickly localize the memory corruption.
  */
 #define ACPI_DEBUG_INITIALIZE() \
-    _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | \
-        _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_CRT_DF | \
-        _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
+    _CrtSetDbgFlag (\
+        _CRTDBG_CHECK_ALWAYS_DF | \
+        _CRTDBG_ALLOC_MEM_DF | \
+        _CRTDBG_DELAY_FREE_MEM_DF | \
+        _CRTDBG_LEAK_CHECK_DF | \
+        _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
+
+#if 0
+/*
+ * _CrtSetBreakAlloc can be used to set a breakpoint at a particular
+ * memory leak, add to the macro above.
+ */
+Detected memory leaks!
+Dumping objects ->
+..\..\source\os_specific\service_layers\oswinxf.c(701) : {937} normal block at 0x002E9190, 40 bytes long.
+ Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
+_CrtSetBreakAlloc (937);
+#endif
+
 #endif
 
 #endif /* __ACMSVC_H__ */
index b2df842..b656de9 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * These interfaces are required in order to compile the ASL compiler and the
  * various ACPICA tools under Linux or other Unix-like system.
index 140bfdb..5952807 100644 (file)
@@ -627,7 +627,6 @@ AcpiOsAllocate (
 
 
     Mem = (void *) malloc ((size_t) Size);
-
     return (Mem);
 }
 
@@ -653,7 +652,6 @@ AcpiOsAllocateZeroed (
 
 
     Mem = (void *) calloc (1, (size_t) Size);
-
     return (Mem);
 }
 #endif
index d6b1acd..9cfeb32 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #define _DECLARE_GLOBALS
 #include "acpibin.h"
 #include "acapps.h"
index f5c021a..8ac08b3 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Global variables. Defined in main.c only, externed in all other files
  */
index 99dd1a2..c771509 100644 (file)
@@ -314,6 +314,7 @@ AeDoOptions (
         {
         case '^':  /* -v: (Version): signon already emitted, just exit */
 
+            (void) AcpiOsTerminate ();
             exit (0);
 
         case 'i':
@@ -395,6 +396,7 @@ main (
     if (argc < 2)
     {
         usage ();
+        (void) AcpiOsTerminate ();
         return (0);
     }
 
index cdf7f0d..355657f 100644 (file)
@@ -210,6 +210,19 @@ extern ACPI_CONVERSION_TABLE       CustomConversionTable;
 extern ACPI_CONVERSION_TABLE       LicenseConversionTable;
 extern ACPI_CONVERSION_TABLE       IndentConversionTable;
 
+typedef
+char * (*AS_SCAN_CALLBACK) (
+    char                    *Buffer,
+    char                    *Filename,
+    UINT32                  LineNumber);
+
+typedef struct as_brace_info
+{
+    char                    *Operator;
+    UINT32                  Length;
+
+} AS_BRACE_INFO;
+
 
 /* Prototypes */
 
index 5184b8b..086f24e 100644 (file)
 
 #include "acpisrc.h"
 
+AS_BRACE_INFO               Gbl_BraceInfo[] =
+{
+    {" if",         3},
+    {" else if",    8},
+    {" else while", 11},
+    {" else",       5},
+    {" do ",        4},
+    {NULL,          0}
+};
+
+
 /* Local prototypes */
 
-char *
-AsCheckAndSkipLiterals (
+static char *
+AsMatchValidToken (
     char                    *Buffer,
-    UINT32                  *TotalLines);
+    char                    *Filename,
+    char                    TargetChar,
+    AS_SCAN_CALLBACK        Callback);
 
-UINT32
+static char *
+AsCheckBracesCallback (
+    char                    *Buffer,
+    char                    *Filename,
+    UINT32                  LineNumber);
+
+static UINT32
 AsCountLines (
     char                    *Buffer,
     char                    *Filename);
 
+
 /* Opening signature of the Intel legal header */
 
 char        *HeaderBegin = "/******************************************************************************\n *\n * 1. Copyright Notice";
 
-
-/******************************************************************************
- *
- * FUNCTION:    AsRemoveExtraLines
- *
- * DESCRIPTION: Remove all extra lines at the start and end of the file.
- *
- ******************************************************************************/
-
-void
-AsRemoveExtraLines (
-    char                    *FileBuffer,
-    char                    *Filename)
-{
-    char                    *FileEnd;
-    int                     Length;
-
-
-    /* Remove any extra lines at the start of the file */
-
-    while (*FileBuffer == '\n')
-    {
-        printf ("Removing extra line at start of file: %s\n", Filename);
-        AsRemoveData (FileBuffer, FileBuffer + 1);
-    }
-
-    /* Remove any extra lines at the end of the file */
-
-    Length = strlen (FileBuffer);
-    FileEnd = FileBuffer + (Length - 2);
-
-    while (*FileEnd == '\n')
-    {
-        printf ("Removing extra line at end of file: %s\n", Filename);
-        AsRemoveData (FileEnd, FileEnd + 1);
-        FileEnd--;
-    }
-}
+UINT32      NonAnsiCommentCount;
 
 
 /******************************************************************************
  *
- * FUNCTION:    AsRemoveSpacesAfterPeriod
+ * FUNCTION:    AsCountNonAnsiComments
  *
- * DESCRIPTION: Remove an extra space after a period.
+ * DESCRIPTION: Count the number of "//" comments. This type of comment is
+ *              non-ANSI C.
+ *
+ * NOTE: July 2014: Allows // within quoted strings and within normal
+ *       comments. Eliminates extraneous warnings from this utility.
  *
  ******************************************************************************/
 
 void
-AsRemoveSpacesAfterPeriod (
-    char                    *FileBuffer,
+AsCountNonAnsiComments (
+    char                    *Buffer,
     char                    *Filename)
 {
-    int                     ReplaceCount = 0;
-    char                    *Possible;
-
-
-    Possible = FileBuffer;
-    while (Possible)
-    {
-        Possible = strstr (Possible, ".  ");
-        if (Possible)
-        {
-            if ((*(Possible -1) == '.')  ||
-                (*(Possible -1) == '\"') ||
-                (*(Possible -1) == '\n'))
-            {
-                Possible += 3;
-                continue;
-            }
-
-            Possible = AsReplaceData (Possible, 3, ". ", 2);
-            ReplaceCount++;
-        }
-    }
-
-    if (ReplaceCount)
-    {
-        printf ("Removed %d extra blanks after a period: %s\n",
-            ReplaceCount, Filename);
-    }
-}
-
-
-/******************************************************************************
- *
- * FUNCTION:    AsMatchExactWord
- *
- * DESCRIPTION: Check previous and next characters for whitespace
- *
- ******************************************************************************/
-
-BOOLEAN
-AsMatchExactWord (
-    char                    *Word,
-    UINT32                  WordLength)
-{
-    char                    NextChar;
-    char                    PrevChar;
 
+    AsMatchValidToken (Buffer, Filename, 0, NULL);
 
-    NextChar = Word[WordLength];
-    PrevChar = * (Word -1);
+    /* Error if any slash-slash comments found */
 
-    if (isalnum ((int) NextChar) ||
-        (NextChar == '_')  ||
-        isalnum ((int) PrevChar) ||
-        (PrevChar == '_'))
+    if (NonAnsiCommentCount)
     {
-        return (FALSE);
+        AsPrint ("Non-ANSI // Comments Found", NonAnsiCommentCount, Filename);
+        Gbl_NonAnsiComments += NonAnsiCommentCount;
     }
-
-    return (TRUE);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AsPrint
+ * FUNCTION:    AsCheckForBraces
  *
- * DESCRIPTION: Common formatted print
+ * DESCRIPTION: Check for an open brace after each if/else/do (etc.)
+ *              statement
  *
  ******************************************************************************/
 
 void
-AsPrint (
-    char                    *Message,
-    UINT32                  Count,
+AsCheckForBraces (
+    char                    *Buffer,
     char                    *Filename)
 {
 
-    if (Gbl_QuietMode)
-    {
-        return;
-    }
-
-    printf ("-- %4u %28.28s : %s\n", Count, Message, Filename);
+    AsMatchValidToken (Buffer, Filename, 0, AsCheckBracesCallback);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AsCheckAndSkipLiterals
+ * FUNCTION:    AsCheckBracesCallback
  *
- * DESCRIPTION: Generic routine to skip comments and quoted string literals.
- *              Keeps a line count.
+ * DESCRIPTION: Check if/else/do statements. Ensure that braces
+ *              are always used.
+ *
+ * TBD: Currently, don't check while() statements. The problem is that there
+ * are two forms: do {} while (); and while () {}.
  *
  ******************************************************************************/
 
-char *
-AsCheckAndSkipLiterals (
+static char *
+AsCheckBracesCallback (
     char                    *Buffer,
-    UINT32                  *TotalLines)
+    char                    *Filename,
+    UINT32                  LineNumber)
 {
-    UINT32                  NewLines = 0;
     char                    *SubBuffer = Buffer;
-    char                    *LiteralEnd;
-
+    char                    *NextBrace;
+    char                    *NextSemicolon;
+    AS_BRACE_INFO           *BraceInfo;
 
-    /* Ignore comments */
 
-    if ((SubBuffer[0] == '/') &&
-        (SubBuffer[1] == '*'))
+    for (BraceInfo = Gbl_BraceInfo; BraceInfo->Operator; BraceInfo++)
     {
-        LiteralEnd = strstr (SubBuffer, "*/");
-        SubBuffer += 2;     /* Get past comment opening */
-
-        if (!LiteralEnd)
+        if (!(strncmp (BraceInfo->Operator, SubBuffer, BraceInfo->Length)))
         {
-            return (SubBuffer);
-        }
+            SubBuffer += (BraceInfo->Length - 1);
 
-        while (SubBuffer < LiteralEnd)
-        {
-            if (*SubBuffer == '\n')
-            {
-                NewLines++;
-            }
+            /* Find next brace and the next semicolon */
 
-            SubBuffer++;
-        }
+            NextBrace = AsMatchValidToken (SubBuffer, Filename, '{', NULL);
+            NextSemicolon = AsMatchValidToken (SubBuffer, Filename, ';', NULL);
 
-        SubBuffer += 2;     /* Get past comment close */
-    }
+            /* Next brace should appear before next semicolon */
 
-    /* Ignore quoted strings */
+            if ((!NextBrace) ||
+               (NextSemicolon && (NextBrace > NextSemicolon)))
+            {
+                Gbl_MissingBraces++;
+
+                if (!Gbl_QuietMode)
+                {
+                    printf ("Missing braces for <%s>, line %u: %s\n",
+                        BraceInfo->Operator + 1, LineNumber, Filename);
+                }
+            }
 
-    else if (*SubBuffer == '\"')
-    {
-        SubBuffer++;
-        LiteralEnd = AsSkipPastChar (SubBuffer, '\"');
-        if (!LiteralEnd)
-        {
             return (SubBuffer);
         }
     }
 
-    if (TotalLines)
-    {
-        (*TotalLines) += NewLines;
-    }
-    return (SubBuffer);
+    /* No match, just return original buffer */
+
+    return (Buffer);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AsAsCheckForBraces
+ * FUNCTION:    AsMatchValidToken
  *
- * DESCRIPTION: Check for an open brace after each if/else statement
+ * DESCRIPTION: Find the next matching token in the input buffer.
  *
  ******************************************************************************/
 
-void
-AsCheckForBraces (
+static char *
+AsMatchValidToken (
     char                    *Buffer,
-    char                    *Filename)
+    char                    *Filename,
+    char                    TargetChar,
+    AS_SCAN_CALLBACK        Callback)
 {
     char                    *SubBuffer = Buffer;
-    char                    *NextBrace;
-    char                    *NextSemicolon;
-    UINT32                  TotalLines = 1;
-    char                    *EndBuffer;
+    char                    *StringStart;
+    UINT32                  TotalLines;
 
 
-    EndBuffer = SubBuffer + strlen (SubBuffer);
+    TotalLines = 1;
+    NonAnsiCommentCount = 0;
 
-    while (SubBuffer <= EndBuffer)
-    {
-        /* TBD: Update this function to work properly, as per code below */
-        /* SubBuffer = AsCheckAndSkipLiterals (SubBuffer, &TotalLines); */
+    /* Scan from current position up to the end if necessary */
 
+    while (*SubBuffer)
+    {
         /* Skip normal comments */
 
         if ((*SubBuffer == '/') &&
@@ -307,6 +233,7 @@ AsCheckForBraces (
                 }
                 SubBuffer++;
             }
+
             SubBuffer += 2;
             continue;
         }
@@ -316,6 +243,11 @@ AsCheckForBraces (
         if (*SubBuffer == '\'')
         {
             SubBuffer++;
+            if (!(*SubBuffer))
+            {
+                break;
+            }
+
             if (*SubBuffer == '\\')
             {
                 SubBuffer++;
@@ -328,9 +260,23 @@ AsCheckForBraces (
 
         if (*SubBuffer == '"')
         {
+            StringStart = SubBuffer;
             SubBuffer++;
+            if (!(*SubBuffer))
+            {
+                break;
+            }
+
             while (*SubBuffer != '"')
             {
+                if ((*SubBuffer == '\n') ||
+                    (!(*SubBuffer)))
+                {
+                    AsPrint ("Unbalanced quoted string", 1, Filename);
+                    printf ("    %.32s\n", StringStart);
+                    break;
+                }
+
                 /* Handle escapes within the string */
 
                 if (*SubBuffer == '\\')
@@ -344,66 +290,199 @@ AsCheckForBraces (
             continue;
         }
 
-        if (*SubBuffer == '\n')
-        {
-            TotalLines++;
-        }
-        else if (!(strncmp (" if", SubBuffer, 3)))
-        {
-            SubBuffer += 2;
+        /* Now we can check for a slash-slash comment */
+
+        if ((*SubBuffer == '/') &&
+            (*(SubBuffer + 1) == '/'))
+        {
+            NonAnsiCommentCount++;
+
+            /* Skip to end-of-line */
+
+            while ((*SubBuffer != '\n') &&
+                (*SubBuffer))
+            {
+                SubBuffer++;
+            }
+
+            if (!(*SubBuffer))
+            {
+                break;
+            }
+
+            if (*SubBuffer == '\n')
+            {
+                TotalLines++;
+            }
+
+            SubBuffer++;
+            continue;
+        }
+
+        /* Finally, check for a newline */
+
+        if (*SubBuffer == '\n')
+        {
+            TotalLines++;
+            SubBuffer++;
+            continue;
+        }
+
+        /* Normal character, do the user actions */
+
+        if (Callback)
+        {
+            SubBuffer = Callback (SubBuffer, Filename, TotalLines);
+        }
+
+        if (TargetChar && (*SubBuffer == TargetChar))
+        {
+            return (SubBuffer);
+        }
+
+        SubBuffer++;
+    }
+
+    return (NULL);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AsRemoveExtraLines
+ *
+ * DESCRIPTION: Remove all extra lines at the start and end of the file.
+ *
+ ******************************************************************************/
+
+void
+AsRemoveExtraLines (
+    char                    *FileBuffer,
+    char                    *Filename)
+{
+    char                    *FileEnd;
+    int                     Length;
+
+
+    /* Remove any extra lines at the start of the file */
+
+    while (*FileBuffer == '\n')
+    {
+        printf ("Removing extra line at start of file: %s\n", Filename);
+        AsRemoveData (FileBuffer, FileBuffer + 1);
+    }
+
+    /* Remove any extra lines at the end of the file */
+
+    Length = strlen (FileBuffer);
+    FileEnd = FileBuffer + (Length - 2);
+
+    while (*FileEnd == '\n')
+    {
+        printf ("Removing extra line at end of file: %s\n", Filename);
+        AsRemoveData (FileEnd, FileEnd + 1);
+        FileEnd--;
+    }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AsRemoveSpacesAfterPeriod
+ *
+ * DESCRIPTION: Remove an extra space after a period.
+ *
+ ******************************************************************************/
+
+void
+AsRemoveSpacesAfterPeriod (
+    char                    *FileBuffer,
+    char                    *Filename)
+{
+    int                     ReplaceCount = 0;
+    char                    *Possible;
+
+
+    Possible = FileBuffer;
+    while (Possible)
+    {
+        Possible = strstr (Possible, ".  ");
+        if (Possible)
+        {
+            if ((*(Possible -1) == '.')  ||
+                (*(Possible -1) == '\"') ||
+                (*(Possible -1) == '\n'))
+            {
+                Possible += 3;
+                continue;
+            }
+
+            Possible = AsReplaceData (Possible, 3, ". ", 2);
+            ReplaceCount++;
+        }
+    }
+
+    if (ReplaceCount)
+    {
+        printf ("Removed %d extra blanks after a period: %s\n",
+            ReplaceCount, Filename);
+    }
+}
+
 
-            NextBrace = strstr (SubBuffer, "{");
-            NextSemicolon = strstr (SubBuffer, ";");
+/******************************************************************************
+ *
+ * FUNCTION:    AsMatchExactWord
+ *
+ * DESCRIPTION: Check previous and next characters for whitespace
+ *
+ ******************************************************************************/
 
-            if ((!NextBrace) ||
-               (NextSemicolon && (NextBrace > NextSemicolon)))
-            {
-                Gbl_MissingBraces++;
+BOOLEAN
+AsMatchExactWord (
+    char                    *Word,
+    UINT32                  WordLength)
+{
+    char                    NextChar;
+    char                    PrevChar;
 
-                if (!Gbl_QuietMode)
-                {
-                    printf ("Missing braces for <if>, line %u: %s\n", TotalLines, Filename);
-                }
-            }
-        }
-        else if (!(strncmp (" else if", SubBuffer, 8)))
-        {
-            SubBuffer += 7;
 
-            NextBrace = strstr (SubBuffer, "{");
-            NextSemicolon = strstr (SubBuffer, ";");
+    NextChar = Word[WordLength];
+    PrevChar = * (Word -1);
 
-            if ((!NextBrace) ||
-               (NextSemicolon && (NextBrace > NextSemicolon)))
-            {
-                Gbl_MissingBraces++;
+    if (isalnum ((int) NextChar) ||
+        (NextChar == '_')  ||
+        isalnum ((int) PrevChar) ||
+        (PrevChar == '_'))
+    {
+        return (FALSE);
+    }
 
-                if (!Gbl_QuietMode)
-                {
-                    printf ("Missing braces for <else if>, line %u: %s\n", TotalLines, Filename);
-                }
-            }
-        }
-        else if (!(strncmp (" else", SubBuffer, 5)))
-        {
-            SubBuffer += 4;
-            NextBrace = strstr (SubBuffer, "{");
-            NextSemicolon = strstr (SubBuffer, ";");
+    return (TRUE);
+}
 
-            if ((!NextBrace) ||
-               (NextSemicolon && (NextBrace > NextSemicolon)))
-            {
-                Gbl_MissingBraces++;
 
-                if (!Gbl_QuietMode)
-                {
-                    printf ("Missing braces for <else>, line %u: %s\n", TotalLines, Filename);
-                }
-            }
-        }
+/******************************************************************************
+ *
+ * FUNCTION:    AsPrint
+ *
+ * DESCRIPTION: Common formatted print
+ *
+ ******************************************************************************/
 
-        SubBuffer++;
+void
+AsPrint (
+    char                    *Message,
+    UINT32                  Count,
+    char                    *Filename)
+{
+
+    if (Gbl_QuietMode)
+    {
+        return;
     }
+
+    printf ("-- %4u %28.28s : %s\n", Count, Message, Filename);
 }
 
 
@@ -486,12 +565,47 @@ void
 AsTrimWhitespace (
     char                    *Buffer)
 {
+    char                    *SubBuffer;
     int                     ReplaceCount = 1;
 
 
     while (ReplaceCount)
     {
-        ReplaceCount = AsReplaceString ("\n\n\n\n", "\n\n\n", REPLACE_SUBSTRINGS, Buffer);
+        ReplaceCount = AsReplaceString ("\n\n\n\n", "\n\n\n",
+            REPLACE_SUBSTRINGS, Buffer);
+    }
+
+    /*
+     * Check for exactly one blank line after the copyright header
+     */
+
+    /* Find the header */
+
+    SubBuffer = strstr (Buffer, HeaderBegin);
+    if (!SubBuffer)
+    {
+        return;
+    }
+
+    /* Find the end of the header */
+
+    SubBuffer = strstr (SubBuffer, "*/");
+    SubBuffer = AsSkipPastChar (SubBuffer, '\n');
+
+    /* Replace a double blank line with a single */
+
+    if (!strncmp (SubBuffer, "\n\n", 2))
+    {
+        SubBuffer = AsReplaceData (SubBuffer, 2, "\n", 1);
+        AcpiOsPrintf ("Found multiple blank lines after copyright\n");
+    }
+
+    /* If no blank line after header, insert one */
+
+    else if (*SubBuffer != '\n')
+    {
+        AsInsertData (SubBuffer, "\n", 1);
+        AcpiOsPrintf ("Inserted blank line after copyright\n");
     }
 }
 
@@ -528,7 +642,8 @@ AsReplaceHeader (
 
     /* Delete old header, insert new one */
 
-    AsReplaceData (SubBuffer, TokenEnd - SubBuffer, NewHeader, strlen (NewHeader));
+    AsReplaceData (SubBuffer, TokenEnd - SubBuffer,
+        NewHeader, strlen (NewHeader));
 }
 
 
@@ -616,7 +731,8 @@ AsReplaceString (
                 }
             }
 
-            SubBuffer = AsReplaceData (SubString1, TargetLength, Replacement, ReplacementLength);
+            SubBuffer = AsReplaceData (SubString1, TargetLength,
+                Replacement, ReplacementLength);
 
             if ((Type & EXTRA_INDENT_C) &&
                 (!Gbl_StructDefs))
@@ -636,7 +752,7 @@ AsReplaceString (
  *
  * FUNCTION:    AsConvertToLineFeeds
  *
- * DESCRIPTION:
+ * DESCRIPTION: Convert all CR/LF pairs to LF only.
  *
  ******************************************************************************/
 
@@ -663,7 +779,6 @@ AsConvertToLineFeeds (
 
         SubBuffer = AsReplaceData (SubString, 1, NULL, 0);
     }
-    return;
 }
 
 
@@ -671,7 +786,7 @@ AsConvertToLineFeeds (
  *
  * FUNCTION:    AsInsertCarriageReturns
  *
- * DESCRIPTION:
+ * DESCRIPTION: Convert lone LFs to CR/LF pairs.
  *
  ******************************************************************************/
 
@@ -699,7 +814,6 @@ AsInsertCarriageReturns (
         SubBuffer = AsInsertData (SubString, "\r", 1);
         SubBuffer += 1;
     }
-    return;
 }
 
 
@@ -1160,7 +1274,7 @@ AsTabify8 (
  *
  ******************************************************************************/
 
-UINT32
+static UINT32
 AsCountLines (
     char                    *Buffer,
     char                    *Filename)
@@ -1192,7 +1306,9 @@ AsCountLines (
 
     if (LongLineCount)
     {
-        VERBOSE_PRINT (("%u Lines longer than 80 found in %s\n", LongLineCount, Filename));
+        VERBOSE_PRINT (("%u Lines longer than 80 found in %s\n",
+            LongLineCount, Filename));
+
         Gbl_LongLines += LongLineCount;
     }
 
@@ -1238,105 +1354,6 @@ AsCountTabs (
 
 /******************************************************************************
  *
- * FUNCTION:    AsCountNonAnsiComments
- *
- * DESCRIPTION: Count the number of "//" comments. This type of comment is
- *              non-ANSI C.
- *
- * NOTE: July 2014: Allows // within quoted strings and within normal
- *       comments. Eliminates extraneous warnings from this utility.
- *
- ******************************************************************************/
-
-void
-AsCountNonAnsiComments (
-    char                    *Buffer,
-    char                    *Filename)
-{
-    char                    *SubBuffer = Buffer;
-    char                    *EndBuffer;
-    UINT32                  CommentCount = 0;
-    char                    *StartBuffer;
-
-
-    EndBuffer = SubBuffer + strlen (SubBuffer);
-
-    while (SubBuffer <= EndBuffer)
-    {
-        /* Skip normal comments */
-
-        if ((*SubBuffer == '/') &&
-            (*(SubBuffer + 1) == '*'))
-        {
-            SubBuffer = strstr (SubBuffer + 2, "*/");
-            if (!SubBuffer)
-            {
-                break;
-            }
-
-            SubBuffer += 2;
-            continue;
-        }
-
-        /* Skip single quoted chars */
-
-        if (*SubBuffer == '\'')
-        {
-            SubBuffer++;
-            if (*SubBuffer == '\\')
-            {
-                SubBuffer++;
-            }
-            SubBuffer++;
-            continue;
-        }
-
-        /* Skip quoted strings */
-
-        if (*SubBuffer == '"')
-        {
- StartBuffer = SubBuffer;
-AcpiOsPrintf ("START STRING: %.64s\n", StartBuffer);
-           SubBuffer++;
-            while (*SubBuffer != '"')
-            {
-                /* Handle escapes within the string */
-
-                if (*SubBuffer == '\\')
-                {
-                    SubBuffer++;
-                }
-                SubBuffer++;
-            }
-
-            SubBuffer++;
-            continue;
-        }
-
-        /* Finally: check for slash-slash comment */
-
-        if ((*SubBuffer == '/') &&
-            (*(SubBuffer + 1) == '/'))
-        {
-            CommentCount++;
-            SubBuffer++;
-        }
-
-        SubBuffer++;
-    }
-
-    /* Error if any slash-slash comments found */
-
-    if (CommentCount)
-    {
-        AsPrint ("Non-ANSI // Comments Found", CommentCount, Filename);
-        Gbl_NonAnsiComments += CommentCount;
-    }
-}
-
-
-/******************************************************************************
- *
  * FUNCTION:    AsCountSourceLines
  *
  * DESCRIPTION: Count the number of C source lines. Defined by 1) not a
@@ -1423,7 +1440,8 @@ AsCountSourceLines (
     Gbl_CommentLines += CommentCount;
 
     VERBOSE_PRINT (("%u Comment %u White %u Code %u Lines in %s\n",
-                CommentCount, WhiteCount, LineCount, LineCount+WhiteCount+CommentCount, Filename));
+        CommentCount, WhiteCount, LineCount,
+        LineCount + WhiteCount + CommentCount, Filename));
 }
 
 
@@ -1650,3 +1668,75 @@ Exit:
     }
 }
 #endif
+
+#ifdef ACPI_UNUSED_FUNCTIONS
+/******************************************************************************
+ *
+ * FUNCTION:    AsCheckAndSkipLiterals
+ *
+ * DESCRIPTION: Generic routine to skip comments and quoted string literals.
+ *              Keeps a line count.
+ *
+ ******************************************************************************/
+
+static char *
+AsCheckAndSkipLiterals (
+    char                    *Buffer,
+    UINT32                  *TotalLines);
+
+
+static char *
+AsCheckAndSkipLiterals (
+    char                    *Buffer,
+    UINT32                  *TotalLines)
+{
+    UINT32                  NewLines = 0;
+    char                    *SubBuffer = Buffer;
+    char                    *LiteralEnd;
+
+
+    /* Ignore comments */
+
+    if ((SubBuffer[0] == '/') &&
+        (SubBuffer[1] == '*'))
+    {
+        LiteralEnd = strstr (SubBuffer, "*/");
+        SubBuffer += 2;     /* Get past comment opening */
+
+        if (!LiteralEnd)
+        {
+            return (SubBuffer);
+        }
+
+        while (SubBuffer < LiteralEnd)
+        {
+            if (*SubBuffer == '\n')
+            {
+                NewLines++;
+            }
+
+            SubBuffer++;
+        }
+
+        SubBuffer += 2;     /* Get past comment close */
+    }
+
+    /* Ignore quoted strings */
+
+    else if (*SubBuffer == '\"')
+    {
+        SubBuffer++;
+        LiteralEnd = AsSkipPastChar (SubBuffer, '\"');
+        if (!LiteralEnd)
+        {
+            return (SubBuffer);
+        }
+    }
+
+    if (TotalLines)
+    {
+        (*TotalLines) += NewLines;
+    }
+    return (SubBuffer);
+}
+#endif
index 8b26ebc..7c893e6 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpisrc.h"
 #include "acapps.h"
 
@@ -242,8 +241,8 @@ AsDisplayStats (
     printf ("%8u Total bytes (%.1fK/file)\n",
         Gbl_TotalSize, ((double) Gbl_TotalSize/Gbl_Files)/1024);
     printf ("%8u Tabs found\n", Gbl_Tabs);
-    printf ("%8u Missing if/else braces\n", Gbl_MissingBraces);
-    printf ("%8u Non-ANSI comments found\n", Gbl_NonAnsiComments);
+    printf ("%8u Missing if/else/while braces\n", Gbl_MissingBraces);
+    printf ("%8u Non-ANSI // comments found\n", Gbl_NonAnsiComments);
     printf ("%8u Total Lines\n", Gbl_TotalLines);
     printf ("%8u Lines of code\n", Gbl_SourceLines);
     printf ("%8u Lines of non-comment whitespace\n", Gbl_WhiteLines);
index 1f6f09d..818bba6 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpisrc.h"
 #include "acapps.h"
 
@@ -467,6 +466,8 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
     {"AML_RESOURCE_UART_SERIALBUS",         SRC_TYPE_STRUCT},
     {"AML_RESOURCE_VENDOR_LARGE",           SRC_TYPE_STRUCT},
     {"AML_RESOURCE_VENDOR_SMALL",           SRC_TYPE_STRUCT},
+    {"AS_BRACE_INFO",                       SRC_TYPE_STRUCT},
+    {"AS_SCAN_CALLBACK",                    SRC_TYPE_SIMPLE},
 
     {"APIC_HEADER",                         SRC_TYPE_STRUCT},
     {"AE_DEBUG_REGIONS",                    SRC_TYPE_STRUCT},
@@ -474,6 +475,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
     {"AE_TABLE_DESC",                       SRC_TYPE_STRUCT},
     {"ASL_ANALYSIS_WALK_INFO",              SRC_TYPE_STRUCT},
     {"ASL_ERROR_MSG",                       SRC_TYPE_STRUCT},
+    {"ASL_ERROR_MSG",                       SRC_TYPE_STRUCT},
     {"ASL_EVENT_INFO",                      SRC_TYPE_STRUCT},
     {"ASL_FILE_INFO",                       SRC_TYPE_STRUCT},
     {"ASL_FILE_STATUS",                     SRC_TYPE_STRUCT},
@@ -633,6 +635,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
     {"ACPI_SRAT_HEADER",                    SRC_TYPE_STRUCT},
     {"ACPI_SRAT_MEM_AFFINITY",              SRC_TYPE_STRUCT},
     {"ACPI_SRAT_X2APIC_CPU_AFFINITY",       SRC_TYPE_STRUCT},
+    {"ACPI_SRAT_GICC_AFFINITY",             SRC_TYPE_STRUCT},
     {"ACPI_TPM2_CONTROL",                   SRC_TYPE_STRUCT},
     {"ACPI_WDAT_ENTRY",                     SRC_TYPE_STRUCT},
 
index 050d343..8dbf59f 100644 (file)
@@ -132,7 +132,6 @@ AsSkipPastChar (
     }
 
     Buffer++;
-
     return (Buffer);
 }
 
@@ -173,7 +172,8 @@ AsReplaceData (
         if (LengthToRemove > 0)
         {
             Gbl_MadeChanges = TRUE;
-            memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove), (BufferLength - LengthToRemove));
+            memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove),
+                (BufferLength - LengthToRemove));
         }
     }
 
index c5f6434..d8b201a 100644 (file)
@@ -8402,7 +8402,7 @@ DefinitionBlock (
                     Return (0x71)
                 }
 
-                Store (DerefOf (Index (DEST, 3)), Local0) // DEST = "Destination buffer that..."
+                Store (DerefOf (Index (DEST, 3)), Local0) // DEST = "Destination buffer that...
 
                 If (LNotEqual (Local0, 0x74))       //  't'
                 {
index c505260..b477289 100644 (file)
@@ -27,6 +27,7 @@ SRCS= \
        ahpredef.c \
        ahuuids.c \
        aslanalyze.c \
+       aslascii.c \
        aslbtypes.c \
        aslcodegen.c \
        aslcompile.c \
@@ -195,6 +196,9 @@ CFLAGS+= \
 LFLAGS=        -i -s
 YFLAGS=        -d
 
+aslcompiler.y: aslparser.y
+       m4 -P -I${UTILDIR} ${.ALLSRC} >${.TARGET}
+
 aslcompilerlex.c: aslcompiler.l
        ${LEX} ${LFLAGS} -PAslCompiler -o${.TARGET} ${.ALLSRC}
 
@@ -223,6 +227,7 @@ prparser.y.h: prparserparse.c
        mv -f prparserparse.h ${.TARGET}
 
 CLEANFILES+=   \
+               aslcompiler.y \
                aslcompilerlex.c \
                aslcompilerparse.c \
                aslcompiler.y.h \