From owner-svn-src-all@FreeBSD.ORG Tue Mar 20 18:17:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0485106566B; Tue, 20 Mar 2012 18:17:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96B3C8FC08; Tue, 20 Mar 2012 18:17:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KIHY0F031584; Tue, 20 Mar 2012 18:17:34 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KIHYQS031570; Tue, 20 Mar 2012 18:17:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203201817.q2KIHYQS031570@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 20 Mar 2012 18:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233237 - in vendor-sys/acpica/dist: . generate/unix/iasl source/common source/compiler source/components/debugger source/components/hardware source/components/namespace source/componen... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 18:17:34 -0000 Author: jkim Date: Tue Mar 20 18:17:33 2012 New Revision: 233237 URL: http://svn.freebsd.org/changeset/base/233237 Log: Import ACPICA 20120320. Added: vendor-sys/acpica/dist/source/compiler/preprocess.h (contents, props changed) vendor-sys/acpica/dist/source/compiler/prexpress.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prmacros.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prparser.l vendor-sys/acpica/dist/source/compiler/prparser.y vendor-sys/acpica/dist/source/compiler/prscan.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prutils.c (contents, props changed) Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/iasl/Makefile vendor-sys/acpica/dist/source/common/adisasm.c vendor-sys/acpica/dist/source/common/getopt.c vendor-sys/acpica/dist/source/compiler/Makefile vendor-sys/acpica/dist/source/compiler/aslcodegen.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/aslcompiler.y vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/dtcompiler.h vendor-sys/acpica/dist/source/compiler/dtexpress.c vendor-sys/acpica/dist/source/compiler/dtio.c vendor-sys/acpica/dist/source/compiler/dtparser.y vendor-sys/acpica/dist/source/compiler/readme.txt vendor-sys/acpica/dist/source/components/debugger/dbcmds.c vendor-sys/acpica/dist/source/components/hardware/hwesleep.c vendor-sys/acpica/dist/source/components/hardware/hwsleep.c vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c vendor-sys/acpica/dist/source/components/namespace/nsdump.c vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c vendor-sys/acpica/dist/source/components/namespace/nspredef.c vendor-sys/acpica/dist/source/components/namespace/nsrepair.c vendor-sys/acpica/dist/source/components/namespace/nsutils.c vendor-sys/acpica/dist/source/components/tables/tbfadt.c vendor-sys/acpica/dist/source/components/tables/tbinstal.c vendor-sys/acpica/dist/source/components/tables/tbutils.c vendor-sys/acpica/dist/source/include/achware.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acnames.h vendor-sys/acpica/dist/source/include/acnamesp.h vendor-sys/acpica/dist/source/include/acoutput.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actypes.h vendor-sys/acpica/dist/source/tools/acpisrc/astable.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/changes.txt Tue Mar 20 18:17:33 2012 (r233237) @@ -1,4 +1,96 @@ ---------------------------------------- +20 March 2012. Summary of changes for version 20120320: + +This release is available at www.acpica.org/downloads. +The ACPI 5.0 specification is available at www.acpi.info. + +1) ACPICA Core Subsystem: + +Enhanced the sleep/wake interfaces to optionally execute the _GTS method +(Going To Sleep) and the _BFS method (Back From Sleep). Windows apparently +does not execute these methods, and therefore these methods are often +untested. It has been seen on some systems where the execution of these +methods causes errors and also prevents the machine from entering S5. It is +therefore suggested that host operating systems do not execute these methods +by default. In the future, perhaps these methods can be optionally executed +based on the age of the system and/or what is the newest version of Windows +that the BIOS asks for via _OSI. Changed interfaces: AcpiEnterSleepState and +AcpileaveSleepStatePrep. See the ACPICA reference and Linux BZ 13041. Lin +Ming. + +Fixed a problem where the length of the local/common FADT was set too early. +The local FADT table length cannot be set to the common length until the +original length has been examined. There is code that checks the table length +and sets various fields appropriately. This can affect older machines with +early FADT versions. For example, this can cause inadvertent writes to the +CST_CNT register. Julian Anastasov. + +Fixed a mapping issue related to a physical table override. Use the deferred +mapping mechanism for tables loaded via the physical override OSL interface. +This allows for early mapping before the virtual memory manager is available. +Thomas Renninger, Bob Moore. + +Enhanced the automatic return-object repair code: Repair a common problem with +predefined methods that are defined to return a variable-length Package of +sub-objects. If there is only one sub-object, some BIOS ASL code mistakenly +simply returns the single object instead of a Package with one sub-object. +This new support will repair this error by wrapping a Package object around +the original object, creating the correct and expected Package with one sub- +object. Names that can be repaired in this manner include: _ALR, _CSD, _HPX, +_MLS, _PLD, _PRT, _PSS, _TRT, _TSS, _BCL, _DOD, _FIX, and _Sx. ACPICA BZ 939. + +Changed the exception code returned for invalid ACPI paths passed as +parameters to external interfaces such as AcpiEvaluateObject. Was +AE_BAD_PARAMETER, now is the more sensible AE_BAD_PATHNAME. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release: + Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the infrastructure and initial implementation of a integrated C- +like preprocessor. This will simplify BIOS development process by eliminating +the need for a separate preprocessing step during builds. On Windows, it also +eliminates the need to install a separate C compiler. ACPICA BZ 761. Some +features including full #define() macro support are still under development. +These preprocessor directives are supported: + #define + #elif + #else + #endif + #error + #if + #ifdef + #ifndef + #include + #pragma message + #undef + #warning +In addition, these new command line options are supported: + -D Define symbol for preprocessor use + -li Create preprocessed output file (*.i) + -P Preprocess only and create preprocessor output file (*.i) + +Table Compiler: Fixed a problem where the equals operator within an expression +did not work properly. + +Updated iASL to use the current versions of Bison/Flex. Updated the Windows +project file to invoke these tools from the standard location. ACPICA BZ 904. +Versions supported: + Flex for Windows: V2.5.4 + Bison for Windows: V2.4.1 + +---------------------------------------- 15 February 2012. Summary of changes for version 20120215: This release is available at www.acpica.org/downloads. Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Tue Mar 20 18:17:33 2012 (r233237) @@ -32,13 +32,16 @@ vpath %.c \ HEADERS = \ $(wildcard $(ASL_COMPILER)/*.h) \ $(OBJDIR)/aslcompiler.y.h \ - $(OBJDIR)/dtparser.y.h + $(OBJDIR)/dtparser.y.h \ + $(OBJDIR)/prparser.y.h OBJECTS = \ $(OBJDIR)/aslcompilerlex.o \ $(OBJDIR)/aslcompilerparse.o \ $(OBJDIR)/dtparserlex.o \ $(OBJDIR)/dtparserparse.o \ + $(OBJDIR)/prparserlex.o \ + $(OBJDIR)/prparserparse.o \ $(OBJDIR)/adfile.o \ $(OBJDIR)/adisasm.o \ $(OBJDIR)/adwalk.o \ @@ -142,6 +145,10 @@ OBJECTS = \ $(OBJDIR)/nswalk.o \ $(OBJDIR)/nsxfobj.o \ $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/prexpress.o \ + $(OBJDIR)/prmacros.o \ + $(OBJDIR)/prscan.o \ + $(OBJDIR)/prutils.o \ $(OBJDIR)/psargs.o \ $(OBJDIR)/psloop.o \ $(OBJDIR)/psopcode.o \ @@ -177,7 +184,9 @@ INTERMEDIATES = \ $(OBJDIR)/aslcompilerlex.c \ $(OBJDIR)/aslcompilerparse.c \ $(OBJDIR)/dtparserlex.c \ - $(OBJDIR)/dtparserparse.c + $(OBJDIR)/dtparserparse.c \ + $(OBJDIR)/prparserlex.c \ + $(OBJDIR)/prparserparse.c MISC = \ $(OBJDIR)/aslcompilerparse.h \ @@ -185,7 +194,10 @@ MISC = \ $(OBJDIR)/aslcompilerparse.output \ $(OBJDIR)/dtparserparse.h \ $(OBJDIR)/dtparser.y.h \ - $(OBJDIR)/dtparserparse.output + $(OBJDIR)/dtparserparse.output \ + $(OBJDIR)/prparserparse.h \ + $(OBJDIR)/prparser.y.h \ + $(OBJDIR)/prparserparse.output # # Flags specific to iASL compiler @@ -217,15 +229,26 @@ $(OBJDIR)/dtparserlex.c : $(ASL_COM $(OBJDIR)/dtparserparse.c $(OBJDIR)/dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? +$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l + ${LEX} ${LFLAGS} -PPrParser -o$@ $? + +$(OBJDIR)/prparserparse.c $(OBJDIR)/prparserparse.h : $(ASL_COMPILER)/prparser.y + ${YACC} ${YFLAGS} -pPrParser -o$@ $? + + # Rename headers produced by bison/yacc +$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h + $(OBJDIR)/dtparser.y.h: $(OBJDIR)/dtparserparse.h @echo Copy intermediate file: @cp -f -v $(OBJDIR)/dtparserparse.h $(OBJDIR)/dtparser.y.h -$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h +$(OBJDIR)/prparser.y.h: $(OBJDIR)/prparserparse.h @echo Copy intermediate file: - @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h + @cp -f -v $(OBJDIR)/prparserparse.h $(OBJDIR)/prparser.y.h # @@ -246,6 +269,12 @@ $(OBJDIR)/dtparserlex.o : $(OBJDIR) $(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? +$(OBJDIR)/prparserlex.o : $(OBJDIR)/prparserlex.c + $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? + +$(OBJDIR)/prparserparse.o : $(OBJDIR)/prparserparse.c + $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? + $(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/common/adisasm.c Tue Mar 20 18:17:33 2012 (r233237) @@ -75,6 +75,10 @@ LsSetupNsList ( /* Local prototypes */ +static UINT32 +AdGetFileSize ( + FILE *File); + static void AdCreateTableHeader ( char *Filename, @@ -160,6 +164,38 @@ static ACPI_PARSE_OBJECT *AcpiGbl_Par /******************************************************************************* * + * FUNCTION: AdGetFileSize + * + * PARAMETERS: File - Open file handle + * + * RETURN: File Size + * + * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * + ******************************************************************************/ + +static UINT32 +AdGetFileSize ( + FILE *File) +{ + UINT32 FileSize; + long Offset; + + + Offset = ftell (File); + + fseek (File, 0, SEEK_END); + FileSize = (UINT32) ftell (File); + + /* Restore file pointer */ + + fseek (File, Offset, SEEK_SET); + return (FileSize); +} + + +/******************************************************************************* + * * FUNCTION: AdInitialize * * PARAMETERS: None @@ -380,8 +416,10 @@ AdAmlDisassemble ( "FieldName : FieldValue\n */\n\n"); AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", - Table->Signature, DisasmFilename); + fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", + Table->Signature); + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } else { @@ -490,9 +528,9 @@ AdAmlDisassemble ( if (AcpiGbl_DbOpt_disasm) { AdDisplayTables (Filename, Table); - fprintf (stderr, - "Disassembly completed, written to \"%s\"\n", - DisasmFilename); + fprintf (stderr, "Disassembly completed\n"); + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } } Modified: vendor-sys/acpica/dist/source/common/getopt.c ============================================================================== --- vendor-sys/acpica/dist/source/common/getopt.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/common/getopt.c Tue Mar 20 18:17:33 2012 (r233237) @@ -49,7 +49,8 @@ #include "accommon.h" #include "acapps.h" -#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} +#define ACPI_OPTION_ERROR(msg, badchar) \ + if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} int AcpiGbl_Opterr = 1; @@ -87,12 +88,12 @@ AcpiGetopt( argv[AcpiGbl_Optind][0] != '-' || argv[AcpiGbl_Optind][1] == '\0') { - return(EOF); + return (EOF); } else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) { AcpiGbl_Optind++; - return(EOF); + return (EOF); } } @@ -105,7 +106,7 @@ AcpiGetopt( if (CurrentChar == ':' || (OptsPtr = strchr (opts, CurrentChar)) == NULL) { - ERR (": illegal option -- ", CurrentChar); + ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar); if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') { @@ -126,7 +127,7 @@ AcpiGetopt( } else if (++AcpiGbl_Optind >= argc) { - ERR (": option requires an argument -- ", CurrentChar); + ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar); CurrentCharPtr = 1; return ('?'); @@ -156,6 +157,26 @@ AcpiGetopt( CurrentCharPtr = 1; } + /* Option has a required single-char argument? */ + + else if (*OptsPtr == '|') + { + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') + { + AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; + } + else + { + ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar); + + CurrentCharPtr = 1; + return ('?'); + } + + AcpiGbl_Optind++; + CurrentCharPtr = 1; + } + /* Option with no arguments */ else Modified: vendor-sys/acpica/dist/source/compiler/Makefile ============================================================================== --- vendor-sys/acpica/dist/source/compiler/Makefile Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/Makefile Tue Mar 20 18:17:33 2012 (r233237) @@ -64,13 +64,16 @@ vpath %.c \ HEADERS = \ $(wildcard $(ASL_COMPILER)/*.h) \ aslcompiler.y.h \ - dtparser.y.h + dtparser.y.h \ + prparser.y.h OBJECTS = \ aslcompilerlex.o \ aslcompilerparse.o \ dtparserlex.o \ dtparserparse.o \ + prparserlex.o \ + prparserparse.o \ adfile.o \ adisasm.o \ adwalk.o \ @@ -174,6 +177,10 @@ OBJECTS = \ nswalk.o \ nsxfobj.o \ osunixxf.o \ + prexpress.o \ + prmacros.o \ + prscan.o \ + prutils.o \ psargs.o \ psloop.o \ psopcode.o \ @@ -209,7 +216,9 @@ INTERMEDIATES = \ aslcompilerlex.c \ aslcompilerparse.c \ dtparserlex.c \ - dtparserparse.c + dtparserparse.c \ + prparserlex.c \ + prparserparse.c MISC = \ aslcompilerparse.h \ @@ -217,7 +226,10 @@ MISC = \ aslcompilerparse.output \ dtparserparse.h \ dtparser.y.h \ - dtparserparse.output + dtparserparse.output \ + prparserparse.h \ + prparser.y.h \ + prparserparse.output CFLAGS+= \ -D$(HOST) \ @@ -289,15 +301,26 @@ dtparserlex.c : $(ASL_COMPILER)/dtp dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? +prparserlex.c : $(ASL_COMPILER)/prparser.l + ${LEX} ${LFLAGS} -PPrParser -o$@ $? + +prparserparse.c prparserparse.h : $(ASL_COMPILER)/prparser.y + ${YACC} ${YFLAGS} -pPrParser -o$@ $? + + # Rename headers produced by bison/yacc +aslcompiler.y.h : aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v aslcompilerparse.h aslcompiler.y.h + dtparser.y.h: dtparserparse.h @echo Copy intermediate file: @cp -f -v dtparserparse.h dtparser.y.h -aslcompiler.y.h : aslcompilerparse.h +prparser.y.h: prparserparse.h @echo Copy intermediate file: - @cp -f -v aslcompilerparse.h aslcompiler.y.h + @cp -f -v prparserparse.h prparser.y.h # @@ -318,6 +341,12 @@ dtparserlex.o : dtparserlex.c dtparserparse.o : dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? +prparserlex.o : prparserlex.c + $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? + +prparserparse.o : prparserparse.c + $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? + %.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) Modified: vendor-sys/acpica/dist/source/compiler/aslcodegen.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcodegen.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcodegen.c Tue Mar 20 18:17:33 2012 (r233237) @@ -264,7 +264,7 @@ CgWriteAmlOpcode ( /* These opcodes should not get here */ printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); + FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n"); return; case AML_INT_RESERVEDFIELD_OP: Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Tue Mar 20 18:17:33 2012 (r233237) @@ -457,6 +457,17 @@ CmDoCompile ( Event = UtBeginEvent ("Open input and output files"); UtEndEvent (Event); + /* Preprocessor */ + + Event = UtBeginEvent ("Preprocess input file"); + PrDoPreprocess (); + UtEndEvent (Event); + if (Gbl_PreprocessOnly) + { + CmCleanupAndExit (); + return 0; + } + /* Build the parse tree */ Event = UtBeginEvent ("Parse source code and build parse tree"); @@ -474,8 +485,7 @@ CmDoCompile ( { AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "- Could not resolve parse tree root node"); - CmCleanupAndExit (); - return -1; + goto ErrorExit; } /* Optional parse tree dump, compiler debug output only */ @@ -508,12 +518,12 @@ CmDoCompile ( */ Event = UtBeginEvent ("Open AML output file"); Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); + UtEndEvent (Event); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return -1; } - UtEndEvent (Event); /* Interpret and generate all compile-time constants */ @@ -552,6 +562,7 @@ CmDoCompile ( AePrintErrorLog (ASL_FILE_STDERR); UtDisplaySummary (ASL_FILE_STDERR); } + UtEndEvent (FullCompile); return 0; } @@ -566,7 +577,7 @@ CmDoCompile ( UtEndEvent (Event); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace cross-reference */ @@ -575,7 +586,7 @@ CmDoCompile ( Status = LkCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace - Check for non-referenced objects */ @@ -646,6 +657,11 @@ CmDoCompile ( UtEndEvent (FullCompile); CmCleanupAndExit (); return 0; + +ErrorExit: + UtEndEvent (FullCompile); + CmCleanupAndExit (); + return (-1); } @@ -799,7 +815,9 @@ CmCleanupAndExit ( /* Close all open files */ - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } @@ -817,6 +835,18 @@ CmCleanupAndExit ( } } + /* Delete the preprocessor output file (.i) unless -li flag is set */ + + if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + { + if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) + { + printf ("%s: ", + Gbl_Files[ASL_FILE_PREPROCESSOR].Filename); + perror ("Could not delete preprocessor .i file"); + } + } + /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Tue Mar 20 18:17:33 2012 (r233237) @@ -75,6 +75,7 @@ #include "asltypes.h" #include "aslmessages.h" #include "aslglobal.h" +#include "preprocess.h" /******************************************************************************* @@ -84,7 +85,7 @@ ******************************************************************************/ /* - * parser - generated from flex/bison, lex/yacc, etc. + * Main ASL parser - generated from flex/bison, lex/yacc, etc. */ int AslCompilerparse( @@ -303,6 +304,16 @@ AslCommonError ( char *ExtraMessage); void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage); + +void AePrintException ( UINT32 FileId, ASL_ERROR_MSG *Enode, Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.y Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.y Tue Mar 20 18:17:33 2012 (r233237) @@ -78,6 +78,11 @@ void * AslLocalAllo #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 Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Tue Mar 20 18:17:33 2012 (r233237) @@ -55,6 +55,18 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +/******************************************************************************* + * + * FUNCTION: AeClearErrorLog + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Empty the error list + * + ******************************************************************************/ + void AeClearErrorLog ( void) @@ -168,7 +180,7 @@ AePrintException ( UINT32 SourceColumn; UINT32 ErrorColumn; FILE *OutputFile; - FILE *SourceFile; + FILE *SourceFile = NULL; long FileSize; BOOLEAN PrematureEOF = FALSE; @@ -211,24 +223,28 @@ AePrintException ( OutputFile = Gbl_Files[FileId].Handle; - /* Use the merged header/source file if present, otherwise use input file */ - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - if (!SourceFile) + if (!Enode->SourceLine) { - SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; - } + /* Use the merged header/source file if present, otherwise use input file */ - if (SourceFile) - { - /* Determine if the error occurred at source file EOF */ - - fseek (SourceFile, 0, SEEK_END); - FileSize = ftell (SourceFile); + SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; + if (!SourceFile) + { + SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; + } - if ((long) Enode->LogicalByteOffset >= FileSize) + if (SourceFile) { - PrematureEOF = TRUE; + /* Determine if the error occurred at source file EOF */ + + fseek (SourceFile, 0, SEEK_END); + FileSize = ftell (SourceFile); + + if ((long) Enode->LogicalByteOffset >= FileSize) + { + PrematureEOF = TRUE; + } } } @@ -247,46 +263,59 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, " %6u: ", Enode->LineNumber); - - /* - * If not at EOF, get the corresponding source code line and - * display it. Don't attempt this if we have a premature EOF - * condition. - */ - if (!PrematureEOF) + if (Enode->SourceLine) + { + fprintf (OutputFile, " %6u: %s", + Enode->LineNumber, Enode->SourceLine); + } + else { + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + fprintf (OutputFile, " %6u: ", + PrGetLineNumber (Enode->LineNumber)); + else + fprintf (OutputFile, " %6u: ", + Enode->LineNumber); + /* - * Seek to the offset in the combined source file, read - * the source line, and write it to the output. + * If not at EOF, get the corresponding source code line and + * display it. Don't attempt this if we have a premature EOF + * condition. */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) + if (!PrematureEOF) { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) + /* + * Seek to the offset in the combined source file, read + * the source line, and write it to the output. + */ + Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, + (int) SEEK_SET); + if (Actual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", + "[*** iASL: Seek error on source code temp file %s ***]", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } - - else while (RActual && SourceByte && (SourceByte != '\n')) + else { - fwrite (&SourceByte, 1, 1, OutputFile); RActual = fread (&SourceByte, 1, 1, SourceFile); + if (!RActual) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + } + + else while (RActual && SourceByte && (SourceByte != '\n')) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + } } } - } - fprintf (OutputFile, "\n"); + fprintf (OutputFile, "\n"); + } } } else @@ -295,7 +324,16 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + { + fprintf (OutputFile, "(%u) i:%6u : ", + PrGetLineNumber (Enode->LineNumber), Enode->LineNumber); + } + else + { + fprintf (OutputFile, "(%u) i:%6u : ", + Enode->LineNumber, Enode->LineNumber); + } } } } @@ -421,6 +459,91 @@ AePrintErrorLog ( /******************************************************************************* * + * FUNCTION: AslCommonError2 + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * LineNumber - Actual file line number + * Column - Column in current line + * SourceLine - Actual source code line + * Filename - source filename + * ExtraMessage - additional error message + * + * RETURN: None + * + * DESCRIPTION: Create a new error node and add it to the error log + * + ******************************************************************************/ + +void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage) +{ + char *MessageBuffer = NULL; + char *LineBuffer; + ASL_ERROR_MSG *Enode; + + + Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); + + if (ExtraMessage) + { + /* Allocate a buffer for the message and a new error node */ + + MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1); + + /* Keep a copy of the extra message */ + + ACPI_STRCPY (MessageBuffer, ExtraMessage); + } + + LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1); + ACPI_STRCPY (LineBuffer, SourceLine); + + /* Initialize the error node */ + + if (Filename) + { + Enode->Filename = Filename; + Enode->FilenameLength = strlen (Filename); + if (Enode->FilenameLength < 6) + { + Enode->FilenameLength = 6; + } + } + + Enode->MessageId = MessageId; + Enode->Level = Level; + Enode->LineNumber = LineNumber; + Enode->LogicalLineNumber = LineNumber; + Enode->LogicalByteOffset = 0; + Enode->Column = Column; + Enode->Message = MessageBuffer; + Enode->SourceLine = LineBuffer; + + /* Add the new node to the error node list */ + + AeAddToErrorLog (Enode); + + if (Gbl_DebugFlag) + { + /* stderr is a file, send error to it immediately */ + + AePrintException (ASL_FILE_STDERR, Enode, NULL); + } + + Gbl_ExceptionCount[Level]++; +} + + +/******************************************************************************* + * * FUNCTION: AslCommonError * * PARAMETERS: Level - Seriousness (Warning/error, etc.) @@ -487,6 +610,7 @@ AslCommonError ( Enode->LogicalByteOffset = LogicalByteOffset; Enode->Column = Column; Enode->Message = MessageBuffer; + Enode->SourceLine = NULL; /* Add the new node to the error node list */ @@ -553,7 +677,6 @@ AslError ( break; } - if (Op) { AslCommonError (Level, MessageId, Op->Asl.LineNumber, @@ -643,5 +766,3 @@ AslCompilererror ( return 0; } - - Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Tue Mar 20 18:17:33 2012 (r233237) @@ -50,7 +50,7 @@ /* Local prototypes */ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename); @@ -363,14 +363,13 @@ FlCloseFile ( } Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - if (Error) { FlFileError (FileId, ASL_MSG_CLOSE); AslAbort (); } + Gbl_Files[FileId].Handle = NULL; return; } @@ -478,7 +477,7 @@ FlAddIncludeDirectory ( * ******************************************************************************/ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename) @@ -740,6 +739,13 @@ FlOpenMiscOutputFiles ( Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); + if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) + { + AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); } @@ -764,12 +770,26 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); } + /* Create the preprocessor output file */ + + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + + /* All done for data table compiler */ + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { return (AE_OK); } - /* Create/Open a combined source output file */ + /* Create/Open a combined source output file */ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); if (!Filename) @@ -786,6 +806,10 @@ FlOpenMiscOutputFiles ( */ FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); +/* +// TBD: TEMP +// AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; +*/ /* Create/Open a assembly code source output file if asked */ if (Gbl_AsmOutputFlag) Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Mar 20 18:17:33 2012 (r233237) @@ -70,10 +70,11 @@ extern int yyde extern FILE *AslCompilerin; extern int AslCompilerdebug; extern int DtParserdebug; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***