From owner-svn-src-all@freebsd.org Fri Apr 5 22:45:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FBBB1562933; Fri, 5 Apr 2019 22:45:09 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63C4E8183D; Fri, 5 Apr 2019 22:45:07 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 478731BB69; Fri, 5 Apr 2019 22:45:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x35Mj410097000; Fri, 5 Apr 2019 22:45:04 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x35Mj2VC096988; Fri, 5 Apr 2019 22:45:02 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201904052245.x35Mj2VC096988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 5 Apr 2019 22:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r345969 - in vendor-sys/acpica/dist: . source/common source/compiler source/components/events source/components/namespace source/include X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . source/common source/compiler source/components/events source/components/namespace source/include X-SVN-Commit-Revision: 345969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 63C4E8183D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Fri, 05 Apr 2019 22:45:09 -0000 Author: jkim Date: Fri Apr 5 22:45:01 2019 New Revision: 345969 URL: https://svnweb.freebsd.org/changeset/base/345969 Log: Import ACPICA 20190405. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/common/adisasm.c 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/asldefine.h vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslfileio.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/asllisting.c vendor-sys/acpica/dist/source/compiler/aslload.c vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/asloperands.c vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/compiler/asltree.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/aslxref.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/prutils.c vendor-sys/acpica/dist/source/components/events/evgpe.c vendor-sys/acpica/dist/source/components/namespace/nsalloc.c vendor-sys/acpica/dist/source/include/acpixf.h Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/changes.txt Fri Apr 5 22:45:01 2019 (r345969) @@ -1,4 +1,38 @@ ---------------------------------------- +05 April 2019. Summary of changes for version 20190405: + + +1) ACPICA kernel-resident subsystem: + +Event Manager: History: Commit 18996f2db918 ("ACPICA: Events: Stop +unconditionally clearing ACPI IRQs during suspend/resume") was added +earlier to stop clearing of event status bits unconditionally on suspend +and resume paths. Though this change fixed an issue on suspend path, it +introduced regressions on several resume paths. In the case of S0ix, +events are enabled as part of device suspend path. If status bits for the +events are set when they are enabled, it could result in premature wake +from S0ix. If status is cleared for any event that is being enabled so +that any stale events are cleared out. In case of S0ix, events are +enabled as part of device suspend path. If status bits for the events are +set when they are enabled, it could result in premature wake from S0ix. + +This change ensures that status is cleared for any event that is being +enabled so that any stale events are cleared out. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Implemented an enhanced multiple file compilation that combines +named objects from all input files to a single namespace. With this +feature, any unresolved external declarations as well as duplicate named +object declarations can be detected during compilation rather than +generating errors much later at runtime. The following commands are +examples that utilize this feature: + iasl dsdt.asl ssdt.asl + iasl dsdt.asl ssdt1.asl ssdt2.asl + iasl dsdt.asl ssdt*.asl + +---------------------------------------- 29 March 2019. Summary of changes for version 20190329: Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/common/adisasm.c Fri Apr 5 22:45:01 2019 (r345969) @@ -579,7 +579,7 @@ AdDisassembleOneTable ( if (AslGbl_MapfileFlag) { fprintf (stderr, "%14s %s - %u bytes\n", - AslGbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, + AslGbl_FileDescs[ASL_FILE_MAP_OUTPUT].ShortDescription, AslGbl_Files[ASL_FILE_MAP_OUTPUT].Filename, FlGetFileSize (ASL_FILE_MAP_OUTPUT)); } Modified: vendor-sys/acpica/dist/source/compiler/aslcodegen.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcodegen.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslcodegen.c Fri Apr 5 22:45:01 2019 (r345969) @@ -174,11 +174,11 @@ CgWriteTableHeader ( ACPI_PARSE_OBJECT *Op); static void -CgCloseTable ( - void); +CgWriteNode ( + ACPI_PARSE_OBJECT *Op); static void -CgWriteNode ( +CgUpdateHeader ( ACPI_PARSE_OBJECT *Op); @@ -202,15 +202,12 @@ CgGenerateAmlOutput ( /* Generate the AML output file */ - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - AslGbl_SourceLine = 0; - AslGbl_NextError = AslGbl_ErrorLog; - - TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, + TrWalkParseTree (AslGbl_CurrentDB, + ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_DB_SEPARATELY, CgAmlWriteWalk, NULL, NULL); DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2); - CgCloseTable (); + CgUpdateHeader (AslGbl_CurrentDB); } @@ -708,38 +705,13 @@ CgUpdateHeader ( ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1); -} - -/******************************************************************************* - * - * FUNCTION: CgCloseTable - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing each table header. This allows support for - * multiple definition blocks in a single source file. - * - ******************************************************************************/ - -static void -CgCloseTable ( - void) -{ - ACPI_PARSE_OBJECT *Op; - - - /* Process all definition blocks */ - - Op = AslGbl_ParseTreeRoot->Asl.Child; - while (Op) - { - CgUpdateHeader (Op); - Op = Op->Asl.Next; - } + /* + * Seek to the end of the file. This is done to support multiple file + * compilation. Doing this simplifies other parts of the codebase because + * it eliminates the need to seek for a different starting place. + */ + FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + Length); } Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Fri Apr 5 22:45:01 2019 (r345969) @@ -178,7 +178,11 @@ static void CmDumpAllEvents ( void); +static void +CmFinishFiles( + BOOLEAN DeleteAmlFile); + /******************************************************************************* * * FUNCTION: CmDoCompile @@ -191,13 +195,13 @@ CmDumpAllEvents ( * ******************************************************************************/ -int +ACPI_STATUS CmDoCompile ( void) { - ACPI_STATUS Status; UINT8 FullCompile; UINT8 Event; + ASL_GLOBAL_FILE_NODE *FileNode; FullCompile = UtBeginEvent ("*** Total Compile time ***"); @@ -221,7 +225,7 @@ CmDoCompile ( { UtEndEvent (Event); CmCleanupAndExit (); - return (0); + return (AE_OK); } } UtEndEvent (Event); @@ -239,6 +243,12 @@ CmDoCompile ( { fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n"); + + /* Flag this error in the FileNode for compilation summary */ + + FileNode = FlGetCurrentFileNode (); + FileNode->ParserErrorDetected = TRUE; + AslGbl_ParserErrorDetected = TRUE; LsDumpParseTree (); goto ErrorExit; } @@ -292,20 +302,36 @@ CmDoCompile ( OpcAmlOpcodeWalk, NULL); UtEndEvent (Event); - /* - * Now that the input is parsed, we can open the AML output file. - * Note: by default, the name of this file comes from the table - * descriptor within the input file. - */ - Event = UtBeginEvent ("Open AML output file"); - Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix); - UtEndEvent (Event); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return (-1); - } + UtEndEvent (FullCompile); + return (AE_OK); +ErrorExit: + UtEndEvent (FullCompile); + return (AE_ERROR); +} + + +/******************************************************************************* + * + * FUNCTION: CmDoAslMiddleAndBackEnd + * + * PARAMETERS: None + * + * RETURN: Status of middle-end and back-end + * + * DESCRIPTION: Perform compiler middle-end (type checking and semantic + * analysis) and back-end (code generation) + * + ******************************************************************************/ + +int +CmDoAslMiddleAndBackEnd ( + void) +{ + UINT8 Event; + ACPI_STATUS Status; + + /* Interpret and generate all compile-time constants */ Event = UtBeginEvent ("Constant folding via AML interpreter"); @@ -351,7 +377,6 @@ CmDoCompile ( AePrintErrorLog (ASL_FILE_STDOUT); UtDisplaySummary (ASL_FILE_STDOUT); } - UtEndEvent (FullCompile); return (0); } @@ -367,7 +392,7 @@ CmDoCompile ( UtEndEvent (Event); if (ACPI_FAILURE (Status)) { - goto ErrorExit; + return (-1); } /* Namespace cross-reference */ @@ -378,7 +403,7 @@ CmDoCompile ( Status = XfCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { - goto ErrorExit; + return (-1); } /* Namespace - Check for non-referenced objects */ @@ -486,22 +511,47 @@ CmDoCompile ( Event = UtBeginEvent ("Generate AML code and write output files"); DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n"); - CgGenerateAmlOutput (); + + AslGbl_CurrentDB = AslGbl_ParseTreeRoot->Asl.Child; + + while (AslGbl_CurrentDB) + { + switch (FlSwitchFileSet(AslGbl_CurrentDB->Asl.Filename)) + { + case SWITCH_TO_DIFFERENT_FILE: + /* + * Reset these parameters when definition blocks belong in + * different files. If they belong in the same file, there is + * no need to reset these parameters + */ + FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); + AslGbl_SourceLine = 0; + AslGbl_NextError = AslGbl_ErrorLog; + + /* fall-through */ + + case SWITCH_TO_SAME_FILE: + + CgGenerateAmlOutput (); + CmDoOutputFiles (); + AslGbl_CurrentDB = AslGbl_CurrentDB->Asl.Next; + + break; + + default: /* FILE_NOT_FOUND */ + + /* The requested file could not be found. Get out of here */ + + AslGbl_CurrentDB = NULL; + break; + } + } UtEndEvent (Event); Event = UtBeginEvent ("Write optional output files"); - CmDoOutputFiles (); UtEndEvent (Event); - UtEndEvent (FullCompile); - AslCheckExpectedExceptions (); - CmCleanupAndExit (); return (0); - -ErrorExit: - UtEndEvent (FullCompile); - CmCleanupAndExit (); - return (-1); } @@ -808,10 +858,14 @@ void CmCleanupAndExit ( void) { - UINT32 i; BOOLEAN DeleteAmlFile = FALSE; + ASL_GLOBAL_FILE_NODE *CurrentFileNode = AslGbl_FilesList; + /* Check if any errors occurred during compile */ + + (void) AslCheckForErrorExit (); + AePrintErrorLog (ASL_FILE_STDERR); if (AslGbl_DebugFlag) { @@ -865,15 +919,63 @@ CmCleanupAndExit ( * We will delete the AML file if there are errors and the * force AML output option has not been used. */ - if ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && + if (AslGbl_ParserErrorDetected || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && (!AslGbl_IgnoreErrors) && - AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle) + AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)) { DeleteAmlFile = TRUE; } /* Close all open files */ + while (CurrentFileNode) + { + switch (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename)) + { + case SWITCH_TO_SAME_FILE: + case SWITCH_TO_DIFFERENT_FILE: + + CmFinishFiles (DeleteAmlFile); + CurrentFileNode = CurrentFileNode->Next; + break; + + case FILE_NOT_FOUND: + default: + + CurrentFileNode = NULL; + break; + } + } + + /* Final cleanup after compiling one file */ + + if (!AslGbl_DoAslConversion) + { + UtDeleteLocalCaches (); + } +} + + +/******************************************************************************* + * + * FUNCTION: CmFinishFiles + * + * PARAMETERS: DeleteAmlFile + * + * RETURN: None. + * + * DESCRIPTION: Close all open files, delete AML files depending on the + * function parameter is true. + * + ******************************************************************************/ + +static void +CmFinishFiles( + BOOLEAN DeleteAmlFile) +{ + UINT32 i; + + /* * Take care with the preprocessor file (.pre), it might be the same * as the "input" file, depending on where the compiler has terminated @@ -890,7 +992,15 @@ CmCleanupAndExit ( for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { - FlCloseFile (i); + /* + * Some files such as debug output files could be pointing to + * stderr or stdout. Leave these alone. + */ + if (AslGbl_Files[i].Handle != stderr && + AslGbl_Files[i].Handle != stdout) + { + FlCloseFile (i); + } } /* Delete AML file if there are errors */ @@ -922,12 +1032,5 @@ CmCleanupAndExit ( if (!AslGbl_SourceOutputFlag) { FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); - } - - /* Final cleanup after compiling one file */ - - if (!AslGbl_DoAslConversion) - { - UtDeleteLocalCaches (); } } Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Apr 5 22:45:01 2019 (r345969) @@ -254,10 +254,14 @@ void AslCompilerFileHeader ( UINT32 FileId); -int +ACPI_STATUS CmDoCompile ( void); +int +CmDoAslMiddleAndBackEnd ( + void); + void CmDoOutputFiles ( void); @@ -266,7 +270,11 @@ void CmCleanupAndExit ( void); +ACPI_STATUS +AslDoDisassembly ( + void); + /* * aslallocate - memory allocation */ @@ -875,9 +883,10 @@ ExDoExternal ( /* Values for "Visitation" parameter above */ -#define ASL_WALK_VISIT_DOWNWARD 0x01 -#define ASL_WALK_VISIT_UPWARD 0x02 -#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) +#define ASL_WALK_VISIT_DOWNWARD 0x01 +#define ASL_WALK_VISIT_UPWARD 0x02 +#define ASL_WALK_VISIT_DB_SEPARATELY 0x04 +#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) /* @@ -1035,6 +1044,11 @@ FlSeekFile ( long Offset); void +FlSeekFileSet ( + UINT32 FileId, + long Offset); + +void FlCloseFile ( UINT32 FileId); @@ -1068,6 +1082,34 @@ ACPI_STATUS FlOpenMiscOutputFiles ( char *InputFilename); +ACPI_STATUS +FlInitOneFile ( + char *InputFilename); + +ASL_FILE_SWITCH_STATUS +FlSwitchFileSet ( + char *InputFilename); + +FILE * +FlGetFileHandle ( + UINT32 OutFileId, + UINT32 InFileId, + char *Filename); + +ASL_GLOBAL_FILE_NODE * +FlGetFileNode ( + UINT32 FileId, + char *Filename); + +ASL_GLOBAL_FILE_NODE * +FlGetCurrentFileNode ( + void); + +BOOLEAN +FlInputFileExists ( + char *InputFilename); + + /* * aslhwmap - hardware map summary */ @@ -1083,7 +1125,6 @@ ACPI_STATUS LdLoadNamespace ( ACPI_PARSE_OBJECT *RootOp); - /* * asllookup - namespace lookup functions */ @@ -1091,6 +1132,7 @@ void LkFindUnreferencedObjects ( void); + /* * aslhelp - help screens */ @@ -1118,6 +1160,7 @@ void NsSetupNamespaceListing ( void *Handle); + /* * asloptions - command line processing */ @@ -1126,6 +1169,7 @@ AslCommandLine ( int argc, char **argv); + /* * aslxref - namespace cross reference */ @@ -1221,6 +1265,11 @@ UtDisplaySummary ( UINT32 FileId); void +UtDisplayOneSummary ( + UINT32 FileId, + BOOLEAN DisplayErrorSummary); + +void UtConvertByteToHex ( UINT8 RawByte, UINT8 *Buffer); @@ -1271,6 +1320,7 @@ AuConvertUuidToString ( char *UuIdBuffer, char *OutString); + /* * aslresource - Resource template generation utilities */ @@ -1477,6 +1527,7 @@ RsDoPinGroupFunctionDescriptor ( ASL_RESOURCE_NODE * RsDoPinGroupConfigDescriptor ( ASL_RESOURCE_INFO *Info); + /* * aslrestype2d - DWord address descriptors Modified: vendor-sys/acpica/dist/source/compiler/asldefine.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asldefine.h Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/asldefine.h Fri Apr 5 22:45:01 2019 (r345969) @@ -298,5 +298,4 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; - #endif /* ASLDEFINE.H */ Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Fri Apr 5 22:45:01 2019 (r345969) @@ -474,10 +474,12 @@ AePrintErrorSourceLine ( * Use the merged header/source file if present, otherwise * use input file */ - SourceFile = AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; + SourceFile = FlGetFileHandle (ASL_FILE_SOURCE_OUTPUT, + ASL_FILE_SOURCE_OUTPUT, Enode->SourceFilename); if (!SourceFile) { - SourceFile = AslGbl_Files[ASL_FILE_INPUT].Handle; + SourceFile = FlGetFileHandle (ASL_FILE_INPUT, + ASL_FILE_INPUT, Enode->Filename); } if (SourceFile) @@ -818,6 +820,7 @@ static void AslInitEnode ( ASL_ERROR_MSG *SubError) { ASL_ERROR_MSG *Enode; + ASL_GLOBAL_FILE_NODE *FileNode; *InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); @@ -859,6 +862,23 @@ static void AslInitEnode ( { Enode->FilenameLength = 6; } + + FileNode = FlGetCurrentFileNode (); + if (!FileNode) + { + return; + } + + if (!FlInputFileExists (Filename)) + { + /* + * This means that this file is an include file. Record the .src + * file as the error message source because this file is not in + * the global file list. + */ + Enode->SourceFilename = + FileNode->Files[ASL_FILE_SOURCE_OUTPUT].Filename; + } } } @@ -992,7 +1012,7 @@ AslLogNewError ( } AslGbl_ExceptionCount[ModifiedLevel]++; - if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) + if (!AslGbl_IgnoreErrors && AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); Modified: vendor-sys/acpica/dist/source/compiler/aslfileio.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfileio.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslfileio.c Fri Apr 5 22:45:01 2019 (r345969) @@ -177,7 +177,7 @@ FlFileError ( { sprintf (AslGbl_MsgBuffer, "\"%s\" (%s) - %s", AslGbl_Files[FileId].Filename, - AslGbl_Files[FileId].Description, strerror (errno)); + AslGbl_FileDescs[FileId].Description, strerror (errno)); AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, AslGbl_MsgBuffer); } @@ -500,7 +500,7 @@ FlDeleteFile ( if (remove (Info->Filename)) { printf ("%s (%s file) ", - Info->Filename, Info->Description); + Info->Filename, AslGbl_FileDescs[FileId].Description); perror ("Could not delete"); } Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Apr 5 22:45:01 2019 (r345969) @@ -172,6 +172,257 @@ FlParseInputPathname ( /******************************************************************************* * + * FUNCTION: FlInitOneFile + * + * PARAMETERS: InputFilename - The user-specified ASL source file to be + * compiled + * + * RETURN: Status + * + * DESCRIPTION: Initialize global file structure for one input file. This file + * structure contains references to input, output, debugging, and + * other miscellaneous files that are associated for a single + * input ASL file. + * + ******************************************************************************/ + +ACPI_STATUS +FlInitOneFile ( + char *InputFilename) +{ + UINT32 i; + ASL_GLOBAL_FILE_NODE *NewFileNode; + + + if (FlInputFileExists (InputFilename)) + { + AslError (ASL_ERROR, ASL_MSG_DUPLICATE_INPUT_FILE, NULL, InputFilename); + return (AE_ALREADY_EXISTS); + } + + NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE, + UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE))); + + if (!NewFileNode) + { + AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL); + return (AE_NO_MEMORY); + } + + NewFileNode->ParserErrorDetected = FALSE; + NewFileNode->Next = AslGbl_FilesList; + + AslGbl_FilesList = NewFileNode; + AslGbl_Files = NewFileNode->Files; + + for (i = 0; i < ASL_NUM_FILES; i++) + { + AslGbl_Files[i].Handle = NULL; + AslGbl_Files[i].Filename = NULL; + } + + AslGbl_Files[ASL_FILE_STDOUT].Handle = stdout; + AslGbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; + + if (AslGbl_VerboseErrors) + { + AslGbl_Files[ASL_FILE_STDERR].Handle = stderr; + } + else + { + AslGbl_Files[ASL_FILE_STDERR].Handle = stdout; + } + + AslGbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: FlInputFileExists + * + * PARAMETERS: Filename - File name to be searched + * + * RETURN: Status + * + * DESCRIPTION: Returns true if the file name already exists. + * + ******************************************************************************/ + +BOOLEAN +FlInputFileExists ( + char *Filename) +{ + ASL_GLOBAL_FILE_NODE *Current = AslGbl_FilesList; + + + while (Current) + { + if (!strcmp (Filename, Current->Files[ASL_FILE_INPUT].Filename)) + { + return (TRUE); + } + + Current = Current->Next; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: FlSwitchFileSet + * + * PARAMETERS: Op - Parse node for the LINE asl statement + * + * RETURN: None. + * + * DESCRIPTION: Set the current line number + * + ******************************************************************************/ + +ASL_FILE_SWITCH_STATUS +FlSwitchFileSet ( + char *InputFilename) +{ + ASL_GLOBAL_FILE_NODE *Current = AslGbl_FilesList; + char *PrevFilename = Current->Files[ASL_FILE_INPUT].Filename; + + + while (Current) + { + if (!strcmp(Current->Files[ASL_FILE_INPUT].Filename, InputFilename)) + { + AslGbl_Files = Current->Files; + AslGbl_TableSignature = Current->TableSignature; + AslGbl_TableId = Current->TableId; + + if (!strcmp (InputFilename, PrevFilename)) + { + return (SWITCH_TO_SAME_FILE); + } + else + { + return (SWITCH_TO_DIFFERENT_FILE); + } + } + + Current = Current->Next; + } + + return (FILE_NOT_FOUND); +} + + +/******************************************************************************* + * + * FUNCTION: FlGetFileHandle + * + * PARAMETERS: OutFileId - denotes file type of output handle + * InFileId - denotes file type of the input Filename + * Filename + * + * RETURN: File handle + * + * DESCRIPTION: Get the file handle for a particular filename/FileId. This + * function also allows the caller to specify the file Id of the + * desired type. + * + ******************************************************************************/ + +FILE * +FlGetFileHandle ( + UINT32 OutFileId, + UINT32 InFileId, + char *Filename) +{ + ASL_GLOBAL_FILE_NODE *Current = AslGbl_FilesList; + + + if (!Filename) + { + return (NULL); + } + + while (Current) + { + if (!strcmp (Current->Files[InFileId].Filename, Filename)) + { + return (Current->Files[OutFileId].Handle); + } + + Current = Current->Next; + } + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: FlGetFileNode + * + * PARAMETERS: FileId - File type (ID) of the input Filename + * Filename - File to search for + * + * RETURN: A global file node + * + * DESCRIPTION: Get the file node for a particular filename/FileId. + * + ******************************************************************************/ + +ASL_GLOBAL_FILE_NODE * +FlGetFileNode ( + UINT32 FileId, + char *Filename) +{ + ASL_GLOBAL_FILE_NODE *Current = AslGbl_FilesList; + + + if (!Filename) + { + return (NULL); + } + + while (Current) + { + if (!strcmp (Current->Files[FileId].Filename, Filename)) + { + return (Current); + } + + Current = Current->Next; + } + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: FlGetCurrentFileNode + * + * PARAMETERS: None + * + * RETURN: Global file node + * + * DESCRIPTION: Get the current input file node + * + ******************************************************************************/ + +ASL_GLOBAL_FILE_NODE * +FlGetCurrentFileNode ( + void) +{ + return (FlGetFileNode ( + ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename)); +} + + +/******************************************************************************* + * * FUNCTION: FlSetLineNumber * * PARAMETERS: Op - Parse node for the LINE asl statement @@ -426,8 +677,6 @@ FlOpenIncludeWithPrefix ( IncludeFile = fopen (Pathname, "r"); if (!IncludeFile) { - fprintf (stderr, "Could not open include file %s\n", Pathname); - ACPI_FREE (Pathname); return (NULL); } Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Apr 5 20:12:19 2019 (r345968) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Apr 5 22:45:01 2019 (r345969) @@ -172,28 +172,27 @@ UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; /* Table below must match ASL_FILE_TYPES in asltypes.h */ - -ASL_FILE_INFO AslGbl_Files [ASL_NUM_FILES] = +ASL_FILE_DESC AslGbl_FileDescs [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, "Preprocessor: ", "Preprocessor Temp File"}, - {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"}, - {NULL, NULL, "Offset Table: ", "C Offset Table Output"}, - {NULL, NULL, "Device Map: ", "Device Map Output"}, - {NULL, NULL, "Cross Ref: ", "Cross-reference Output"}, - {NULL, NULL, "Converter db :", "Converter debug Output"} + {"stdout: ", "Standard Output"}, + {"stderr: ", "Standard Error"}, + {"Table Input: ", "Source Input"}, + {"Binary Output:", "AML Output"}, + {"Source Output:", "Source Output"}, + {"Preprocessor: ", "Preprocessor Output"}, + {"Preprocessor: ", "Preprocessor Temp File"}, + {"Listing File: ", "Listing Output"}, + {"Hex Dump: ", "Hex Table Output"}, + {"Namespace: ", "Namespace Output"}, + {"Debug File: ", "Debug Output"}, + {"ASM Source: ", "Assembly Code Output"}, + {"C Source: ", "C Code Output"}, + {"ASM Include: ", "Assembly Header Output"}, + {"C Include: ", "C Header Output"}, + {"Offset Table: ", "C Offset Table Output"}, + {"Device Map: ", "Device Map Output"}, + {"Cross Ref: ", "Cross-reference Output"}, + {"Converter dbg:", "Converter debug Output"} }; /* Table below must match the defines with the same names in actypes.h */ @@ -225,8 +224,8 @@ const char *AslGbl_OpFlagName }; #else +extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -extern ASL_FILE_INFO AslGbl_Files [ASL_NUM_FILES]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; #endif @@ -269,7 +268,6 @@ ASL_EXTERN UINT32 ASL_INIT_GLOBAL (A ASL_EXTERN UINT32 ASL_INIT_GLOBAL (AslGbl_CurrentLineNumber, 1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***