Date: Fri, 14 Sep 2012 22:53:12 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r240525 - in vendor-sys/acpica/dist: . generate/unix source/common source/compiler source/components/debugger source/components/disassembler source/components/tables source/include sour... Message-ID: <201209142253.q8EMrChT026263@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Fri Sep 14 22:53:11 2012 New Revision: 240525 URL: http://svn.freebsd.org/changeset/base/240525 Log: Import ACPICA 20120913. Deleted: vendor-sys/acpica/dist/source/compiler/new_table.txt Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/Makefile.config vendor-sys/acpica/dist/generate/unix/Makefile.rules vendor-sys/acpica/dist/source/common/dmrestag.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/aslfold.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/asloperands.c vendor-sys/acpica/dist/source/compiler/aslopt.c vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/dtio.c vendor-sys/acpica/dist/source/compiler/preprocess.h vendor-sys/acpica/dist/source/components/debugger/dbexec.c vendor-sys/acpica/dist/source/components/debugger/dbinput.c vendor-sys/acpica/dist/source/components/debugger/dbmethod.c vendor-sys/acpica/dist/source/components/debugger/dbnames.c vendor-sys/acpica/dist/source/components/debugger/dbstats.c vendor-sys/acpica/dist/source/components/debugger/dbutils.c vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c vendor-sys/acpica/dist/source/components/tables/tbinstal.c vendor-sys/acpica/dist/source/components/tables/tbxface.c vendor-sys/acpica/dist/source/include/acdebug.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actbl1.h vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpisrc/astable.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/changes.txt Fri Sep 14 22:53:11 2012 (r240525) @@ -1,4 +1,75 @@ ---------------------------------------- +13 September 2012. Summary of changes for version 20120913: + +This release is available at https://www.acpica.org/downloads The ACPI 5.0 +specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +ACPI 5.0: Added two new notify types for the Hardware Error Notification +Structure within the Hardware Error Source Table (HEST) table -- CMCI(5) and +MCE(6). + +Table Manager: Merged/removed duplicate code in the root table resize +functions. One function is external, the other is internal. Lv Zheng, ACPICA +BZ 846. + +Makefiles: Completely removed the obsolete "Linux" makefiles under +acpica/generate/linux. These makefiles are obsolete and have been replaced by +the generic unix makefiles under acpica/generate/unix. + +Makefiles: Ensure that binary files always copied properly. Minor rule change +to ensure that the final binary output files are always copied up to the +appropriate binary directory (bin32 or bin64.) + +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.8K Code, 25.3K Data, 119.1K Total + Debug Version: 175.7K Code, 74.8K Data, 250.5K Total + Current Release: + Non-Debug Version: 93.7K Code, 25.3K Data, 119.0K Total + Debug Version: 175.0K Code, 74.4K Data, 249.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a possible fault during the disassembly of resource +descriptors when a second parse is required because of the invocation of +external control methods within the table. With assistance from +adq@lidskialf.net. ACPICA BZ 976. + +iASL: Fixed a namepath optimization problem. An error can occur if the parse +node that contains the namepath to be optimized does not have a parent node +that is a named object. This change fixes the problem. + +iASL: Fixed a regression where the AML file is not deleted on errors. The AML +output file should be deleted if there are any errors during the compiler. The +only exception is if the -f (force output) option is used. ACPICA BZ 974. + +iASL: Added a feature to automatically increase internal line buffer sizes. +Via realloc(), automatically increase the internal line buffer sizes as +necessary to support very long source code lines. The current version of the +preprocessor requires a buffer long enough to contain full source code lines. +This change increases the line buffer(s) if the input lines go beyond the +current buffer size. This eliminates errors that occurred when a source code +line was longer than the buffer. + +iASL: Fixed a problem with constant folding in method declarations. The +SyncLevel term is a ByteConstExpr, and incorrect code would be generated if a +Type3 opcode was used. + +Debugger: Improved command help support. For incorrect argument count, display +full help for the command. For help command itself, allow an argument to +specify a command. + +Test Suites: Several bug fixes for the ASLTS suite reduces the number of +errors during execution of the suite. Guan Chao. + +---------------------------------------- 16 August 2012. Summary of changes for version 20120816: This release is available at https://www.acpica.org/downloads Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config ============================================================================== --- vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Sep 14 22:53:11 2012 (r240525) @@ -40,18 +40,25 @@ BINDIR = bin$(BITS) BITSFLAG = -m$(BITS) COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) +INSTALLDIR = /usr/bin +INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) -COPYPROG = \ - @mkdir -p ../$(BINDIR); \ - if [ -e "$(PROG).exe" ] ; then \ +# +# Rename a .exe file if necessary +# +RENAMEPROG = \ + @if [ -e "$(PROG).exe" ] ; then \ mv $(PROG).exe $(PROG); \ echo "Renamed $(PROG).exe to $(PROG)"; \ - fi; \ - cp --remove-destination $(PROG) ../$(BINDIR); \ - echo "Copied $(PROG) to ../$(BINDIR)"; + fi; -INSTALLDIR = /usr/bin -INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) +# +# Copy the final file to the local bin[32|64] directory +# +COPYPROG = \ + @mkdir -p ../$(BINDIR); \ + cp --remove-destination $(PROG) ../$(BINDIR); \ + echo "Copied $(PROG) to $(FINAL_PROG)"; # # Main ACPICA source directories Modified: vendor-sys/acpica/dist/generate/unix/Makefile.rules ============================================================================== --- vendor-sys/acpica/dist/generate/unix/Makefile.rules Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/generate/unix/Makefile.rules Fri Sep 14 22:53:11 2012 (r240525) @@ -12,6 +12,7 @@ $(FINAL_PROG) : $(PROG) $(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS) $(LINKPROG) + $(RENAMEPROG) $(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILEOBJ) Modified: vendor-sys/acpica/dist/source/common/dmrestag.c ============================================================================== --- vendor-sys/acpica/dist/source/common/dmrestag.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/common/dmrestag.c Fri Sep 14 22:53:11 2012 (r240525) @@ -469,6 +469,11 @@ AcpiDmCheckResourceReference ( /* Get the Index term, must be an integer constant to convert */ IndexOp = BufferNameOp->Common.Next; + + /* Major cheat: The Node field is also used for the Tag ptr. Clear it now */ + + IndexOp->Common.Node = NULL; + OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode); if (OpInfo->ObjectType != ACPI_TYPE_INTEGER) { Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Sep 14 22:53:11 2012 (r240525) @@ -800,6 +800,7 @@ CmCleanupAndExit ( void) { UINT32 i; + BOOLEAN DeleteAmlFile = FALSE; AePrintErrorLog (ASL_FILE_STDERR); @@ -851,6 +852,16 @@ CmCleanupAndExit ( UtDisplaySummary (ASL_FILE_STDOUT); + /* + * 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) && + Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + { + DeleteAmlFile = TRUE; + } + /* Close all open files */ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ @@ -862,29 +873,17 @@ CmCleanupAndExit ( /* Delete AML file if there are errors */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + if (DeleteAmlFile) { - if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); - perror ("Could not delete AML file"); - } + FlDeleteFile (ASL_FILE_AML_OUTPUT); } /* Delete the preprocessor output file (.i) unless -li flag is set */ if (!Gbl_PreprocessorOutputFlag && - Gbl_PreprocessFlag && - Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + Gbl_PreprocessFlag) { - if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_PREPROCESSOR].Filename); - perror ("Could not delete preprocessor .i file"); - } + FlDeleteFile (ASL_FILE_PREPROCESSOR); } /* @@ -901,14 +900,9 @@ CmCleanupAndExit ( * * TBD: SourceOutput should be .TMP, then rename if we want to keep it? */ - if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename) + if (!Gbl_SourceOutputFlag) { - if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - perror ("Could not delete SRC file"); - } + FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } } Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Sep 14 22:53:11 2012 (r240525) @@ -661,6 +661,10 @@ FlPrintFile ( ...); void +FlDeleteFile ( + UINT32 FileId); + +void FlSetLineNumber ( UINT32 LineNumber); @@ -779,6 +783,10 @@ char * UtGetStringBuffer ( UINT32 Length); +void +UtExpandLineBuffers ( + void); + ACPI_STATUS UtInternalizeName ( char *ExternalName, Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Sep 14 22:53:11 2012 (r240525) @@ -183,6 +183,7 @@ AePrintException ( FILE *SourceFile = NULL; long FileSize; BOOLEAN PrematureEOF = FALSE; + UINT32 Total = 0; if (Gbl_NoErrors) @@ -300,11 +301,21 @@ AePrintException ( "[*** iASL: Read 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); + while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256)) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + Total++; + } + + if (Total >= 256) + { + fprintf (OutputFile, + "\n[*** iASL: Long input line, an error occurred at column %u ***]", + Enode->Column); + } } } } @@ -381,20 +392,28 @@ AePrintException ( if (Gbl_VerboseErrors && !PrematureEOF) { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) + if (Total >= 256) { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); + fprintf (OutputFile, " %s", + MainMessage); } else { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); + SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; + ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; + + if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) + { + fprintf (OutputFile, "%*s%s", + (int) ((SourceColumn - 1) - ErrorColumn), + MainMessage, " ^ "); + } + else + { + fprintf (OutputFile, "%*s %s", + (int) ((SourceColumn - ErrorColumn) + 1), "^", + MainMessage); + } } } else Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Sep 14 22:53:11 2012 (r240525) @@ -63,6 +63,7 @@ FlParseInputPathname ( #endif + /******************************************************************************* * * FUNCTION: AslAbort @@ -376,6 +377,42 @@ FlCloseFile ( /******************************************************************************* * + * FUNCTION: FlDeleteFile + * + * PARAMETERS: FileId - Index into file info array + * + * RETURN: None + * + * DESCRIPTION: Delete a file. + * + ******************************************************************************/ + +void +FlDeleteFile ( + UINT32 FileId) +{ + ASL_FILE_INFO *Info = &Gbl_Files[FileId]; + + + if (!Info->Filename) + { + return; + } + + if (remove (Info->Filename)) + { + printf ("%s (%s file) ", + Info->Filename, Info->Description); + perror ("Could not delete"); + } + + Info->Filename = NULL; + return; +} + + +/******************************************************************************* + * * FUNCTION: FlSetLineNumber * * PARAMETERS: Op - Parse node for the LINE asl statement Modified: vendor-sys/acpica/dist/source/compiler/aslfold.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfold.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslfold.c Fri Sep 14 22:53:11 2012 (r240525) @@ -200,6 +200,19 @@ OpcAmlCheckForConstant ( DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); + /* + * These opcodes do not appear in the OpcodeInfo table, but + * they represent constants, so abort the constant walk now. + */ + if ((WalkState->Opcode == AML_RAW_DATA_BYTE) || + (WalkState->Opcode == AML_RAW_DATA_WORD) || + (WalkState->Opcode == AML_RAW_DATA_DWORD) || + (WalkState->Opcode == AML_RAW_DATA_QWORD)) + { + WalkState->WalkType = ACPI_WALK_CONST_OPTIONAL; + return (AE_TYPE); + } + if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) { /* The opcode is not a Type 3/4/5 opcode */ @@ -254,8 +267,8 @@ OpcAmlCheckForConstant ( { DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); } - DbgPrint (ASL_PARSE_OUTPUT, "\n"); + DbgPrint (ASL_PARSE_OUTPUT, "\n"); return (AE_OK); } Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Sep 14 22:53:11 2012 (r240525) @@ -63,6 +63,41 @@ #endif +#ifdef _DECLARE_GLOBALS +UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; +char AslHexLookup[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + +/* Table below must match ASL_FILE_TYPES in asltypes.h */ + +ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = +{ + {NULL, NULL, "stdout: ", "Standard Output"}, + {NULL, NULL, "stderr: ", "Standard Error"}, + {NULL, NULL, "Table Input: ", "Source Input"}, + {NULL, NULL, "Binary Output:", "AML Output"}, + {NULL, NULL, "Source Output:", "Source Output"}, + {NULL, NULL, "Preprocessor: ", "Preprocessor Output"}, + {NULL, NULL, "Listing File: ", "Listing Output"}, + {NULL, NULL, "Hex Dump: ", "Hex Table Output"}, + {NULL, NULL, "Namespace: ", "Namespace Output"}, + {NULL, NULL, "Debug File: ", "Debug Output"}, + {NULL, NULL, "ASM Source: ", "Assembly Code Output"}, + {NULL, NULL, "C Source: ", "C Code Output"}, + {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, + {NULL, NULL, "C Include: ", "C Header Output"} +}; + +#else +extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; +extern char AslHexLookup[]; +extern ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; +#endif + + /* * Parser and other externals */ @@ -74,21 +109,22 @@ extern int PrPa extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; -#define ASL_LINE_BUFFER_SIZE (4096 * 4) /* 16K */ -#define ASL_MSG_BUFFER_SIZE 4096 -#define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 8 +#define ASL_DEFAULT_LINE_BUFFER_SIZE (1024 * 32) /* 32K */ +#define ASL_MSG_BUFFER_SIZE 4096 +#define HEX_TABLE_LINE_SIZE 8 +#define HEX_LISTING_LINE_SIZE 8 /* Source code buffers and pointers for error reporting */ -ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); /* Exception reporting */ @@ -135,18 +171,16 @@ ASL_EXTERN BOOLEAN ASL_ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); -#define HEX_OUTPUT_NONE 0 -#define HEX_OUTPUT_C 1 -#define HEX_OUTPUT_ASM 2 -#define HEX_OUTPUT_ASL 3 +#define HEX_OUTPUT_NONE 0 +#define HEX_OUTPUT_C 1 +#define HEX_OUTPUT_ASM 2 +#define HEX_OUTPUT_ASL 3 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); /* Files */ -ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; - ASL_EXTERN char *Gbl_DirectoryPath; ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); @@ -203,7 +237,6 @@ ASL_EXTERN FILE *Acp ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; ASL_EXTERN ACPI_TABLE_HEADER TableHeader; -extern char AslHexLookup[]; /* Event timing */ @@ -220,11 +253,5 @@ ASL_EXTERN char Stri ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; -#ifdef _DECLARE_GLOBALS -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; -#else -extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -#endif - #endif /* __ASLGLOBAL_H */ Modified: vendor-sys/acpica/dist/source/compiler/aslmain.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmain.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslmain.c Fri Sep 14 22:53:11 2012 (r240525) @@ -48,6 +48,7 @@ #include "aslcompiler.h" #include "acapps.h" #include "acdisasm.h" +#include <signal.h> #ifdef _DEBUG #include <crtdbg.h> @@ -70,6 +71,10 @@ static void Usage ( void); +static void ACPI_SYSTEM_XFACE +AslSignalHandler ( + int Sig); + static void AslInitialize ( void); @@ -96,7 +101,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z" /******************************************************************************* @@ -163,10 +168,10 @@ Options ( printf ("\nAML Disassembler:\n"); ACPI_OPTION ("-d [file]", "Disassemble or decode binary ACPI table to file (*.dsl)"); ACPI_OPTION ("-da [f1,f2]", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution"); - ACPI_OPTION ("-m", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); @@ -238,6 +243,49 @@ Usage ( } +/****************************************************************************** + * + * FUNCTION: AslSignalHandler + * + * PARAMETERS: Sig - Signal that invoked this handler + * + * RETURN: None + * + * DESCRIPTION: Control-C handler. Delete any intermediate files and any + * output files that may be left in an indeterminate state. + * + *****************************************************************************/ + +static void ACPI_SYSTEM_XFACE +AslSignalHandler ( + int Sig) +{ + UINT32 i; + + + signal (Sig, SIG_IGN); + printf ("Aborting\n\n"); + + /* Close all open files */ + + 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); + } + + /* Delete any output files */ + + for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlDeleteFile (i); + } + + exit (0); +} + + /******************************************************************************* * * FUNCTION: AslInitialize @@ -261,7 +309,6 @@ AslInitialize ( _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); #endif - AcpiDbgLevel = 0; for (i = 0; i < ASL_NUM_FILES; i++) { @@ -274,6 +321,11 @@ AslInitialize ( Gbl_Files[ASL_FILE_STDERR].Handle = stderr; Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; + + /* Allocate the line buffer(s) */ + + Gbl_LineBufferSize /= 2; + UtExpandLineBuffers (); } @@ -475,6 +527,10 @@ AslDoOptions ( Gbl_DisassembleAll = TRUE; break; + case 'b': /* Do not convert buffers to resource descriptors */ + AcpiGbl_NoResourceDisassembly = TRUE; + break; + case 'c': break; @@ -613,8 +669,13 @@ AslDoOptions ( break; - case 'm': /* Do not convert buffers to resource descriptors */ - AcpiGbl_NoResourceDisassembly = TRUE; + case 'm': /* Set line buffer size */ + Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; + if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) + { + Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; + } + printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize); break; @@ -946,7 +1007,10 @@ main ( int Index2; + signal (SIGINT, AslSignalHandler); + AcpiGbl_ExternalFileList = NULL; + AcpiDbgLevel = 0; #ifdef _DEBUG _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | @@ -955,9 +1019,10 @@ main ( /* Init and command line */ + Index1 = Index2 = AslCommandLine (argc, argv); + AslInitialize (); PrInitializePreprocessor (); - Index1 = Index2 = AslCommandLine (argc, argv); /* Options that have no additional parameters or pathnames */ Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Fri Sep 14 22:53:11 2012 (r240525) @@ -198,6 +198,7 @@ typedef enum ASL_MSG_VENDOR_LIST, ASL_MSG_WRITE, ASL_MSG_RANGE, + ASL_MSG_BUFFER_ALLOCATION, /* These messages are used by the Preprocessor only */ @@ -373,6 +374,7 @@ char *AslMessages /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", /* ASL_MSG_WRITE */ "Could not write file", /* ASL_MSG_RANGE */ "Constant out of range", +/* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", /* Preprocessor */ Modified: vendor-sys/acpica/dist/source/compiler/asloperands.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Sep 14 22:53:11 2012 (r240525) @@ -182,6 +182,10 @@ OpnDoMethod ( Next = Next->Asl.Next; if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { + /* This is a ByteConstExpr, so eval the constant now */ + + OpcAmlConstantWalk (Next, 0, NULL); + if (Next->Asl.Value.Integer > 15) { AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); Modified: vendor-sys/acpica/dist/source/compiler/aslopt.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslopt.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslopt.c Fri Sep 14 22:53:11 2012 (r240525) @@ -441,7 +441,6 @@ OptOptimizeNameDeclaration ( { ACPI_STATUS Status; char *NewPathExternal; - ACPI_GENERIC_STATE ScopeInfo; ACPI_NAMESPACE_NODE *Node; @@ -473,9 +472,10 @@ OptOptimizeNameDeclaration ( * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. + * + * We know that we are at the root, so NULL is used for the scope. */ - ScopeInfo.Scope.Node = CurrentNode; - Status = AcpiNsLookup (&ScopeInfo, *NewPath, + Status = AcpiNsLookup (NULL, *NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) @@ -624,11 +624,21 @@ OptOptimizeNamePath ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); /* - * The node of interest is the parent of this node - * (the containing scope) + * The node of interest is the parent of this node (the containing + * scope). The actual namespace node may be up more than one level + * of parse op or it may not exist at all (if we traverse back + * up to the root.) */ - CurrentNode = Op->Asl.Parent->Asl.Node; - if (!CurrentNode) + NextOp = Op->Asl.Parent; + while (NextOp && (!NextOp->Asl.Node)) + { + NextOp = NextOp->Asl.Parent; + } + if (NextOp && NextOp->Asl.Node) + { + CurrentNode = NextOp->Asl.Node; + } + else { CurrentNode = AcpiGbl_RootNode; } Modified: vendor-sys/acpica/dist/source/compiler/aslstartup.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslstartup.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslstartup.c Fri Sep 14 22:53:11 2012 (r240525) @@ -239,7 +239,7 @@ AslDetectSourceFileType ( * File is ASCII. Determine if this is an ASL file or an ACPI data * table file. */ - while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle)) + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) { /* Uppercase the buffer for caseless compare */ Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslsupport.l Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslsupport.l Fri Sep 14 22:53:11 2012 (r240525) @@ -343,14 +343,14 @@ AslInsertLineBuffer ( *Gbl_LineBufPtr = (UINT8) SourceChar; Gbl_LineBufPtr++; - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1))) + if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) { #if 0 /* * Warning if we have split a long source line. * <Probably overkill> */ - sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE); + sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize); AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, Gbl_CurrentColumn, Modified: vendor-sys/acpica/dist/source/compiler/asltypes.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/asltypes.h Fri Sep 14 22:53:11 2012 (r240525) @@ -133,6 +133,8 @@ typedef struct asl_file_info { FILE *Handle; char *Filename; + const char *ShortDescription; + const char *Description; } ASL_FILE_INFO; @@ -146,14 +148,14 @@ typedef struct asl_file_status /* * File types. Note: Any changes to this table must also be reflected - * in the AslFileTypeNames array. + * in the Gbl_Files array. */ typedef enum { ASL_FILE_STDOUT = 0, ASL_FILE_STDERR, - ASL_FILE_INPUT, /* Don't move these first 3 file types */ - ASL_FILE_AML_OUTPUT, + ASL_FILE_INPUT, + ASL_FILE_AML_OUTPUT, /* Don't move these first 4 file types */ ASL_FILE_SOURCE_OUTPUT, ASL_FILE_PREPROCESSOR, ASL_FILE_LISTING_OUTPUT, Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Sep 14 22:53:11 2012 (r240525) @@ -54,31 +54,6 @@ ACPI_MODULE_NAME ("aslutils") -char AslHexLookup[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - -/* Table below must match ASL_FILE_TYPES in asltypes.h */ - -static const char *AslFileTypeNames [ASL_NUM_FILES] = -{ - "stdout: ", - "stderr: ", - "Table Input: ", - "Binary Output:", - "Source Output:", - "Preprocessor: ", - "Listing File: ", - "Hex Dump: ", - "Namespace: ", - "Debug File: ", - "ASM Source: ", - "C Source: ", - "ASM Include: ", - "C Include: " -}; - /* Local prototypes */ @@ -547,7 +522,7 @@ UtDisplaySummary ( } FlPrintFile (FileId, "%14s %s - %u bytes\n", - AslFileTypeNames [i], + Gbl_Files[i].ShortDescription, Gbl_Files[i].Filename, FlGetFileSize (i)); } @@ -646,6 +621,79 @@ UtGetStringBuffer ( } +/****************************************************************************** + * + * FUNCTION: UtExpandLineBuffers + * + * PARAMETERS: None. Updates global line buffer pointers. + * + * RETURN: None. Reallocates the global line buffers + * + * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates + * all global line buffers and updates Gbl_LineBufferSize. NOTE: + * Also used for the initial allocation of the buffers, when + * all of the buffer pointers are NULL. Initial allocations are + * of size ASL_DEFAULT_LINE_BUFFER_SIZE + * + *****************************************************************************/ + +void +UtExpandLineBuffers ( + void) +{ + UINT32 NewSize; + + + /* Attempt to double the size of all line buffers */ + + NewSize = Gbl_LineBufferSize * 2; + if (Gbl_CurrentLineBuffer) + { + DbgPrint (ASL_DEBUG_OUTPUT,"Increasing line buffer size from %u to %u\n", + Gbl_LineBufferSize, NewSize); + } + + Gbl_CurrentLineBuffer = realloc (Gbl_CurrentLineBuffer, NewSize); + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + if (!Gbl_CurrentLineBuffer) + { + goto ErrorExit; + } + + Gbl_MainTokenBuffer = realloc (Gbl_MainTokenBuffer, NewSize); + if (!Gbl_MainTokenBuffer) + { + goto ErrorExit; + } + + Gbl_MacroTokenBuffer = realloc (Gbl_MacroTokenBuffer, NewSize); + if (!Gbl_MacroTokenBuffer) + { + goto ErrorExit; + } + + Gbl_ExpressionTokenBuffer = realloc (Gbl_ExpressionTokenBuffer, NewSize); + if (!Gbl_ExpressionTokenBuffer) + { + goto ErrorExit; + } + + Gbl_LineBufferSize = NewSize; + return; + + + /* On error above, simply issue error messages and abort, cannot continue */ + +ErrorExit: + printf ("Could not increase line buffer size from %u to %u\n", + Gbl_LineBufferSize, Gbl_LineBufferSize * 2); + + AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, + NULL, NULL); + AslAbort (); +} + + /******************************************************************************* * * FUNCTION: UtInternalizeName Modified: vendor-sys/acpica/dist/source/compiler/dtio.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/dtio.c Fri Sep 14 22:12:04 2012 (r240524) +++ vendor-sys/acpica/dist/source/compiler/dtio.c Fri Sep 14 22:53:11 2012 (r240525) @@ -413,13 +413,21 @@ DtGetNextLine ( BOOLEAN LineNotAllBlanks = FALSE; UINT32 State = DT_NORMAL_TEXT; UINT32 CurrentLineOffset; - UINT32 BeyondBufferCount; UINT32 i; char c; - for (i = 0; i < ASL_LINE_BUFFER_SIZE;) + for (i = 0; ;) { + /* + * If line is too long, expand the line buffers. Also increases + * Gbl_LineBufferSize. + */ + if (i >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + c = (char) getc (Handle); if (c == EOF) { @@ -491,6 +499,11 @@ DtGetNextLine ( */ if ((i != 0) && LineNotAllBlanks) { + if ((i + 1) >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */ return (CurrentLineOffset); } @@ -565,6 +578,11 @@ DtGetNextLine ( default: /* Not a comment */ i++; /* Save the preceeding slash */ + if (i >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + Gbl_CurrentLineBuffer[i] = c; i++; State = DT_NORMAL_TEXT; @@ -668,21 +686,6 @@ DtGetNextLine ( return (ASL_EOF); } } - - /* Line is too long for internal buffer. Determine actual length */ - - BeyondBufferCount = 1; - c = (char) getc (Handle); - while (c != '\n') *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209142253.q8EMrChT026263>