diff --git a/changes.txt b/changes.txt index 85cd9c9ae611..2a72a514401a 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,43 @@ +---------------------------------------- +14 December 2017. Summary of changes for version 20171214: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression in the external (public) AcpiEvaluateObjectTyped +interface where the optional "pathname" argument had inadvertently become +a required argument returning an error if omitted (NULL pointer +argument). + +Fixed two possible memory leaks related to the recently developed "late +resolution" of reference objects within ASL Package Object definitions. + +Added two recently defined _OSI strings: "Windows 2016" and "Windows +2017". Mario Limonciello. + +Implemented and deployed a safer version of the C library function +strncpy: AcpiUtSafeStrncpy. The intent is to at least prevent the +creation of unterminated strings as a possible result of a standard +strncpy. + +Cleaned up and restructured the global variable file (acglobal.h). There +are many changes, but no functional changes. + + +2) iASL Compiler/Disassembler and Tools: + +iASL Table Compiler: Fixed a problem with the DBG2 ACPI table where the +optional OemData field at the end of the table was incorrectly required +for proper compilation. It is now correctly an optional field. + +ASLTS: The entire suite was converted from standard ASL to the ASL+ +language, using the ASL-to-ASL+ converter which is integrated into the +iASL compiler. A binary compare of all output files has verified the +correctness of the conversion. + +iASL: Fixed the source code build for platforms where "char" is unsigned. +This affected the iASL lexer only. Jung-uk Kim. + ---------------------------------------- 10 November 2017. Summary of changes for version 20171110: diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile index 7bc69e86e52e..db87d8840e29 100644 --- a/generate/unix/acpinames/Makefile +++ b/generate/unix/acpinames/Makefile @@ -113,6 +113,7 @@ OBJECTS = \ $(OBJDIR)/utmath.o\ $(OBJDIR)/utmisc.o\ $(OBJDIR)/utmutex.o\ + $(OBJDIR)/utnonansi.o\ $(OBJDIR)/utobject.o\ $(OBJDIR)/utosi.o\ $(OBJDIR)/utownerid.o\ diff --git a/source/common/adisasm.c b/source/common/adisasm.c index e6f0e0f91e7c..30fee223297c 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -457,9 +457,9 @@ AdDisassembleOneTable ( * (.xxx) file produced from the converter in case if * it fails to get deleted. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy (Table->Signature, AcpiGbl_TableSig, 4); + strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAME_SIZE); } #endif diff --git a/source/common/dmswitch.c b/source/common/dmswitch.c index 1641cbf9adea..5c2ac3a6371a 100644 --- a/source/common/dmswitch.c +++ b/source/common/dmswitch.c @@ -543,6 +543,10 @@ AcpiDmIsSwitchBlock ( * statement, so check for it. */ CurrentOp = StoreOp->Common.Next->Common.Next; + if (!CurrentOp) + { + return (FALSE); + } if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) { CurrentOp = CurrentOp->Common.Next; diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 60951732bece..3d93148510d9 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -1654,7 +1654,6 @@ AcpiDmDumpTable ( break; - case ACPI_DMT_FADTPM: /* FADT Preferred PM Profile names */ diff --git a/source/common/dmtables.c b/source/common/dmtables.c index 0ec69aba7371..b87ddd46bd30 100644 --- a/source/common/dmtables.c +++ b/source/common/dmtables.c @@ -314,7 +314,7 @@ AdCreateTableHeader ( /* * Print comments that come before this definition block. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_PRINT_ONE_COMMENT(AcpiGbl_ParseOpRoot,AML_COMMENT_STANDARD, NULL, 0); } @@ -517,7 +517,7 @@ AdParseTable ( } #ifdef ACPI_ASL_COMPILER - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_ParseOpRoot->Common.CvFilename = AcpiGbl_FileTreeRoot->Filename; } diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index 1ef91c2df1d9..fae7c04017a3 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -3734,7 +3734,6 @@ AcpiDmDumpS3pt ( } - /******************************************************************************* * * FUNCTION: AcpiDmDumpSdev diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index a527ddda832a..ea879b8c9461 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -370,7 +370,7 @@ CgWriteAmlOpcode ( * Before printing the bytecode, generate comment byte codes * associated with this node. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -550,13 +550,13 @@ CgWriteTableHeader ( * "XXXX" table signature prevents this AML file from running on the AML * interpreter. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, 4); + strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE); Child->Asl.Value.String = ACPI_SIG_XXXX; } - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); + strncpy (TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE); /* Revision */ @@ -573,12 +573,12 @@ CgWriteTableHeader ( /* OEMID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); + strncpy (TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE); /* OEM TableID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); + strncpy (TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE); /* OEM Revision */ @@ -600,7 +600,7 @@ CgWriteTableHeader ( /* Calculate the comment lengths for this definition block parseOp */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvDbgPrint ("Calculating comment lengths for %s in write header\n", Op->Asl.ParseOpName); @@ -756,7 +756,8 @@ CgWriteNode ( /* Write all comments here. */ - if (Gbl_CaptureComments) + + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -822,7 +823,7 @@ CgWriteNode ( case PARSEOP_DEFINITION_BLOCK: CgWriteTableHeader (Op); - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlDefBlockComment (Op); } diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 1ddb8864c465..ae78cec4da33 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -469,7 +469,7 @@ CmDoCompile ( * node during compilation. We take the very last comment and save it in a * global for it to be used by the disassembler. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList; Gbl_ParseTreeRoot->Asl.CommentList = NULL; diff --git a/source/compiler/asldebug.c b/source/compiler/asldebug.c index ba252251f72e..0dab6d57063c 100644 --- a/source/compiler/asldebug.c +++ b/source/compiler/asldebug.c @@ -192,7 +192,7 @@ CvDbgPrint ( va_list Args; - if (!Gbl_CaptureComments || !AcpiGbl_DebugAslConversion) + if (!AcpiGbl_CaptureComments || !AcpiGbl_DebugAslConversion) { return; } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 53df683e553f..177a329531ea 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -618,7 +618,7 @@ FlOpenAmlOutputFile ( if (!Filename) { /* Create the output AML filename */ - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); } diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 683aaa2f4ff6..29a5c762d609 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -323,7 +323,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DebugAslConversion = TRUE; AcpiGbl_DmEmitExternalOpcodes = TRUE; @@ -391,7 +391,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DmEmitExternalOpcodes = TRUE; Gbl_DoExternalsInPlace = TRUE; @@ -416,25 +416,11 @@ AslDoOptions ( { case '^': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; break; case 'a': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; Gbl_DisassembleAll = TRUE; break; @@ -796,8 +782,8 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; Gbl_DoExternalsInPlace = TRUE; + AcpiGbl_CaptureComments = TRUE; return (0); case 'r': /* Override revision found in table header */ diff --git a/source/compiler/aslparseop.c b/source/compiler/aslparseop.c index 438e5a281a40..ac80a0a24b8c 100644 --- a/source/compiler/aslparseop.c +++ b/source/compiler/aslparseop.c @@ -269,7 +269,7 @@ TrCreateOp ( * FirstChild place it in the parent. This also means that * legitimate comments for the child gets put to the parent. */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && ((ParseOpcode == PARSEOP_CONNECTION) || (ParseOpcode == PARSEOP_EXTERNAL) || (ParseOpcode == PARSEOP_OFFSET) || @@ -308,7 +308,7 @@ TrCreateOp ( /* Get the comment from last child in the resource template call */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (Op->Asl.ParseOpcode == PARSEOP_RESOURCETEMPLATE)) { CvDbgPrint ("Transferred current comment list to this op.\n"); @@ -794,7 +794,7 @@ TrAllocateOp ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { LatestOp = Gbl_CommentState.LatestParseOp; Op->Asl.InlineComment = NULL; diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index fa1ac25bd9ed..3cc260056bcb 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -233,11 +233,11 @@ AslInitializeGlobals ( Gbl_Files[i].Filename = NULL; } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.SpacesBefore = 0; Gbl_CommentState.CommentType = 1; - Gbl_CommentState.LatestParseOp = NULL; + Gbl_CommentState.LatestParseOp = NULL; Gbl_CommentState.ParsingParenBraceNode = NULL; Gbl_CommentState.CaptureComments = TRUE; } diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 40cead33c3c5..db243e4a87ce 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -496,7 +496,7 @@ AslInsertLineBuffer ( AslResetCurrentLineBuffer (); } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvProcessCommentState (SourceChar); } @@ -525,7 +525,7 @@ static void count ( int Type) { - int i; + char *p; switch (Type) @@ -547,9 +547,9 @@ count ( break; } - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) + for (p = yytext; *p != '\0'; p++) { - AslInsertLineBuffer (yytext[i]); + AslInsertLineBuffer (*p); *Gbl_LineBufPtr = 0; } } @@ -580,7 +580,7 @@ AslDoComment ( AslInsertLineBuffer ('/'); AslInsertLineBuffer ('*'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = '/'; ++StringBuffer; @@ -595,7 +595,7 @@ loop: while (((c = input ()) != '*') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -623,7 +623,7 @@ loop: /* Comment is closed only if the NEXT character is a slash */ AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -698,7 +698,7 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { AslInsertLineBuffer ('*'); *StringBuffer = '/'; @@ -714,7 +714,7 @@ AslDoCommentType2 ( while (((c = input ()) != '\n') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 084bc4d59ac9..06bf75995322 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -253,7 +253,7 @@ TrSetOpIntegerValue ( /* Converter: if this is a method invocation, turn off capture comments */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (ParseOpcode == PARSEOP_METHODCALL)) { Gbl_CommentState.CaptureComments = FALSE; @@ -509,7 +509,7 @@ TrLinkOpChildren ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { /* * If there are "regular comments" detected at this point, @@ -590,7 +590,7 @@ TrLinkOpChildren ( va_end(ap); DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.LatestParseOp = Op; CvDbgPrint ("TrLinkOpChildren=====Set latest parse op to this op.\n"); @@ -768,7 +768,7 @@ TrLinkChildOp ( * turn on capture comments as it signifies that we are done parsing * a method call. */ - if (Gbl_CaptureComments && Op1) + if (AcpiGbl_CaptureComments && Op1) { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 82d11b4b967e..0696b84d7939 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -422,7 +422,7 @@ UtSetParseOpName ( ACPI_PARSE_OBJECT *Op) { - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), + AcpiUtSafeStrncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), ACPI_MAX_PARSEOP_NAME); } diff --git a/source/compiler/cvcompiler.c b/source/compiler/cvcompiler.c index d2a6c8f06fc6..8da66782fc19 100644 --- a/source/compiler/cvcompiler.c +++ b/source/compiler/cvcompiler.c @@ -186,7 +186,7 @@ CvProcessComment ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = (char) c1; ++StringBuffer; @@ -309,7 +309,7 @@ CvProcessCommentType2 ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = 0; /* null terminate */ CvDbgPrint ("Single-line comment\n"); @@ -395,7 +395,7 @@ CvCalculateCommentLengths( ACPI_COMMENT_NODE *Current = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return (0); } @@ -497,7 +497,7 @@ CgWriteAmlDefBlockComment( char *DirectoryPosition; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || (Op->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK)) { return; @@ -615,7 +615,7 @@ CgWriteAmlComment( if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) || - !Gbl_CaptureComments) + !AcpiGbl_CaptureComments) { return; } diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c index 8682f04e5178..d382aaa550ce 100644 --- a/source/compiler/cvdisasm.c +++ b/source/compiler/cvdisasm.c @@ -352,7 +352,7 @@ CvCloseBraceWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf ("}"); return; @@ -385,7 +385,7 @@ CvCloseParenWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf (")"); return; diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c index b2e3e7674295..a3ef2806cc3b 100644 --- a/source/compiler/cvparser.c +++ b/source/compiler/cvparser.c @@ -254,7 +254,7 @@ CvInitFileTree ( char *ChildFilename = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } @@ -720,7 +720,7 @@ CvCaptureCommentsOnly ( ACPI_FILE_NODE *FileNode; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || Opcode != AML_COMMENT_OP) { return; @@ -973,7 +973,7 @@ CvCaptureComments ( const ACPI_OPCODE_INFO *OpInfo; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 0823196feb1c..47f72eb31e67 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -559,10 +559,18 @@ DtCompileTable ( ACPI_STATUS Status = AE_OK; - if (!Field || !*Field) + if (!Field) { return (AE_BAD_PARAMETER); } + if (!*Field) + { + /* + * The field list is empty, this means that we are out of fields to + * parse. In other words, we are at the end of the table. + */ + return (AE_END_OF_TABLE); + } /* Ignore optional subtable if name does not match */ diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index 138f4f3a1731..9b755509ff09 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -596,7 +596,13 @@ DtCompileDbg2 ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) + if (Status == AE_END_OF_TABLE) + { + /* optional field was not found and we're at the end of the file */ + + goto subtableDone; + } + else if (ACPI_FAILURE (Status)) { return (Status); } @@ -615,7 +621,7 @@ DtCompileDbg2 ( DtInsertSubtable (ParentTable, Subtable); } - +subtableDone: SubtableCount--; DtPopSubtable (); /* Get next Device Information subtable */ } diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index a012e111b06c..a46b41f48bc6 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -1196,7 +1196,7 @@ PrPushDirective ( Info->Next = Gbl_DirectiveStack; Info->Directive = Directive; Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; - strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); + AcpiUtSafeStrncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index 501d35878614..00bb777aeee1 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -218,7 +218,7 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - strncpy (AcpiGbl_DbDebugFilename, Name, + AcpiUtSafeStrncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; } diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 750e639898aa..ce8eb2079691 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -527,7 +527,7 @@ AcpiDmDescendingOp ( /* Determine which file this parse node is contained in. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1046,7 +1046,7 @@ AcpiDmAscendingOp ( /* Point the Op's filename pointer to the proper file */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1074,7 +1074,7 @@ AcpiDmAscendingOp ( /* Print any comments that are at the end of the file here */ - if (Gbl_CaptureComments && AcpiGbl_LastListHead) + if (AcpiGbl_CaptureComments && AcpiGbl_LastListHead) { AcpiOsPrintf ("\n"); ASL_CV_PRINT_ONE_COMMENT_LIST (AcpiGbl_LastListHead, 0); diff --git a/source/components/dispatcher/dspkginit.c b/source/components/dispatcher/dspkginit.c index 14e34b092368..d7a4c178a69c 100644 --- a/source/components/dispatcher/dspkginit.c +++ b/source/components/dispatcher/dspkginit.c @@ -419,9 +419,12 @@ AcpiDsInitPackageElement ( ACPI_OPERAND_OBJECT **ElementPtr; + ACPI_FUNCTION_TRACE (DsInitPackageElement); + + if (!SourceObject) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -456,7 +459,7 @@ AcpiDsInitPackageElement ( SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -481,6 +484,7 @@ AcpiDsResolvePackageElement ( ACPI_GENERIC_STATE ScopeInfo; ACPI_OPERAND_OBJECT *Element = *ElementPtr; ACPI_NAMESPACE_NODE *ResolvedNode; + ACPI_NAMESPACE_NODE *OriginalNode; char *ExternalPath = NULL; ACPI_OBJECT_TYPE Type; @@ -576,6 +580,7 @@ AcpiDsResolvePackageElement ( * will remain as named references. This behavior is not described * in the ACPI spec, but it appears to be an oversight. */ + OriginalNode = ResolvedNode; Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); if (ACPI_FAILURE (Status)) { @@ -607,26 +612,27 @@ AcpiDsResolvePackageElement ( */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: - - /* TBD: This may not be necesssary */ - - AcpiUtAddReference (ResolvedNode->Object); + case ACPI_TYPE_METHOD: break; case ACPI_TYPE_MUTEX: - case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: case ACPI_TYPE_REGION: + /* AcpiExResolveNodeToValue gave these an extra reference */ + + AcpiUtRemoveReference (OriginalNode->Object); break; default: /* * For all other types - the node was resolved to an actual - * operand object with a value, return the object + * operand object with a value, return the object. Remove + * a reference on the existing object. */ + AcpiUtRemoveReference (Element); *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; break; } diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index c1069b2c9f5d..8730a0ebd686 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -747,7 +747,7 @@ AcpiExDumpOperand ( UINT32 Index; - ACPI_FUNCTION_NAME (ExDumpOperand) + ACPI_FUNCTION_NAME (ExDumpOperand); /* Check if debug output enabled */ @@ -1042,7 +1042,7 @@ AcpiExDumpOperands ( const char *OpcodeName, UINT32 NumOperands) { - ACPI_FUNCTION_NAME (ExDumpOperands); + ACPI_FUNCTION_TRACE (ExDumpOperands); if (!OpcodeName) @@ -1070,7 +1070,7 @@ AcpiExDumpOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** End operand dump for [%s]\n", OpcodeName)); - return; + return_VOID; } diff --git a/source/components/hardware/hwvalid.c b/source/components/hardware/hwvalid.c index 0d41dd13cb75..e2b187e7039b 100644 --- a/source/components/hardware/hwvalid.c +++ b/source/components/hardware/hwvalid.c @@ -245,7 +245,7 @@ AcpiHwValidateIoRequest ( const ACPI_PORT_INFO *PortInfo; - ACPI_FUNCTION_NAME (HwValidateIoRequest); + ACPI_FUNCTION_TRACE (HwValidateIoRequest); /* Supported widths are 8/16/32 */ @@ -256,14 +256,15 @@ AcpiHwValidateIoRequest ( { ACPI_ERROR ((AE_INFO, "Bad BitWidth parameter: %8.8X", BitWidth)); - return (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); } PortInfo = AcpiProtectedPorts; ByteWidth = ACPI_DIV_8 (BitWidth); LastAddress = Address + ByteWidth - 1; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (LastAddress), ByteWidth)); @@ -274,14 +275,14 @@ AcpiHwValidateIoRequest ( ACPI_ERROR ((AE_INFO, "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", ACPI_FORMAT_UINT64 (Address), ByteWidth)); - return (AE_LIMIT); + return_ACPI_STATUS (AE_LIMIT); } /* Exit if requested address is not within the protected port table */ if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Check request against the list of protected I/O ports */ @@ -303,8 +304,8 @@ AcpiHwValidateIoRequest ( if (AcpiGbl_OsiData >= PortInfo->OsiDependency) { - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", + ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, + "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", ACPI_FORMAT_UINT64 (Address), ByteWidth, PortInfo->Name, PortInfo->Start, PortInfo->End)); @@ -320,7 +321,7 @@ AcpiHwValidateIoRequest ( } } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index ab3ad5988549..cb31e1312327 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -174,11 +174,11 @@ AcpiNsResolveReferences ( * * PARAMETERS: Handle - Object handle (optional) * Pathname - Object pathname (optional) - * ExternalParams - List of parameters to pass to method, + * ExternalParams - List of parameters to pass to a method, * terminated by NULL. May be NULL * if no parameters are being passed. - * ReturnBuffer - Where to put method's return value (if - * any). If NULL, no value is returned. + * ReturnBuffer - Where to put the object return value (if + * any). Required. * ReturnType - Expected type of return object * * RETURN: Status @@ -218,10 +218,16 @@ AcpiEvaluateObjectTyped ( FreeBufferOnError = TRUE; } - Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); - if (ACPI_FAILURE (Status)) + /* Get a handle here, in order to build an error message if needed */ + + TargetHandle = Handle; + if (Pathname) { - return_ACPI_STATUS (Status); + Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } FullPathname = AcpiNsGetExternalPathname (TargetHandle); diff --git a/source/components/parser/psutils.c b/source/components/parser/psutils.c index a04b2e50aabc..1b01c4b073a2 100644 --- a/source/components/parser/psutils.c +++ b/source/components/parser/psutils.c @@ -213,7 +213,7 @@ AcpiPsInitOp ( Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; Op->Common.AmlOpcode = Opcode; - ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, + ACPI_DISASM_ONLY_MEMBERS (AcpiUtSafeStrncpy (Op->Common.AmlOpName, (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } @@ -293,7 +293,7 @@ AcpiPsAllocOp ( AcpiGbl_CurrentScope = Op; } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_TRANSFER_COMMENTS (Op); } diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index dd80f241053a..177b141bc88a 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -290,7 +290,9 @@ AcpiDebugPrint ( { ACPI_THREAD_ID ThreadId; va_list args; - +#ifdef ACPI_APPLICATION + int FillCount; +#endif /* Check if debug output enabled */ @@ -334,10 +336,21 @@ AcpiDebugPrint ( AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } - AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); -#endif + FillCount = 48 - AcpiGbl_NestingLevel - + strlen (AcpiUtTrimFunctionName (FunctionName)); + if (FillCount < 0) + { + FillCount = 0; + } + AcpiOsPrintf ("[%02ld] %*s", + AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " "); + AcpiOsPrintf ("%s%*s: ", + AcpiUtTrimFunctionName (FunctionName), FillCount, " "); + +#else AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); +#endif va_start (args, Format); AcpiOsVprintf (Format, args); diff --git a/source/components/utilities/utnonansi.c b/source/components/utilities/utnonansi.c index f9551d05af2e..f1404e591dd8 100644 --- a/source/components/utilities/utnonansi.c +++ b/source/components/utilities/utnonansi.c @@ -344,4 +344,17 @@ AcpiUtSafeStrncat ( strncat (Dest, Source, MaxTransferLength); return (FALSE); } + +void +AcpiUtSafeStrncpy ( + char *Dest, + char *Source, + ACPI_SIZE DestSize) +{ + /* Always terminate destination string */ + + strncpy (Dest, Source, DestSize); + Dest[DestSize - 1] = 0; +} + #endif diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index d8f299edc6ee..ee2890fbd02b 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -214,6 +214,8 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ + {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */ + {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */ /* Feature Group Strings */ diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index e74ff066a400..a9b5e058c663 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -557,8 +557,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); - Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; + AcpiUtSafeStrncpy (Allocation->Module, (char *) Module, ACPI_MAX_MODULE_NAME); if (!Element) { diff --git a/source/include/acexcep.h b/source/include/acexcep.h index 21db48dcb082..16d3698b6257 100644 --- a/source/include/acexcep.h +++ b/source/include/acexcep.h @@ -241,8 +241,9 @@ typedef struct acpi_exception_info #define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) #define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) #define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) +#define AE_END_OF_TABLE EXCEP_ENV (0x0023) -#define AE_CODE_ENV_MAX 0x0022 +#define AE_CODE_ENV_MAX 0x0023 /* @@ -379,7 +380,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] = EXCEP_TXT ("AE_NUMERIC_OVERFLOW", "Overflow during string-to-integer conversion"), EXCEP_TXT ("AE_HEX_OVERFLOW", "Overflow during ASCII hex-to-binary conversion"), EXCEP_TXT ("AE_DECIMAL_OVERFLOW", "Overflow during ASCII decimal-to-binary conversion"), - EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion") + EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion"), + EXCEP_TXT ("AE_END_OF_TABLE", "Reached the end of table") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] = diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 686dcd819eb3..d29586988a45 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -155,7 +155,7 @@ /***************************************************************************** * - * Globals related to the ACPI tables + * Globals related to the incoming ACPI tables * ****************************************************************************/ @@ -197,7 +197,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); /***************************************************************************** * - * Mutual exclusion within ACPICA subsystem + * Mutual exclusion within the ACPICA subsystem * ****************************************************************************/ @@ -278,7 +278,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE); -/* Misc */ +/* Miscellaneous */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); @@ -301,11 +301,9 @@ extern const char AcpiGbl_LowerHexDigits[]; extern const char AcpiGbl_UpperHexDigits[]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - /* Lists for tracking memory allocations (debug only) */ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList); ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats); @@ -315,7 +313,7 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking); /***************************************************************************** * - * Namespace globals + * ACPI Namespace * ****************************************************************************/ @@ -330,7 +328,6 @@ ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice); ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_ModuleCodeList); - extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; @@ -347,15 +344,20 @@ ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); /***************************************************************************** * - * Interpreter globals + * Interpreter/Parser globals * ****************************************************************************/ -ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); - /* Control method single step flag */ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); +ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL); + +/* ASL/ASL+ converter */ + +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CaptureComments, FALSE); +ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); /***************************************************************************** @@ -365,7 +367,6 @@ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); ****************************************************************************/ extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; - ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA); ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); @@ -377,18 +378,16 @@ ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); ****************************************************************************/ #if (!ACPI_REDUCED_HARDWARE) - ACPI_GLOBAL (UINT8, AcpiGbl_AllGpesInitialized); ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *, AcpiGbl_GpeXruptListHead); ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *, AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]); ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER, AcpiGbl_GlobalEventHandler); ACPI_GLOBAL (void *, AcpiGbl_GlobalEventHandlerContext); ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER, AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]); - extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; - #endif /* !ACPI_REDUCED_HARDWARE */ + /***************************************************************************** * * Debug support @@ -402,7 +401,7 @@ ACPI_GLOBAL (UINT32, AcpiGpeCount); ACPI_GLOBAL (UINT32, AcpiSciCount); ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]); -/* Support for dynamic control method tracing mechanism */ +/* Dynamic control method tracing mechanism */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); @@ -410,12 +409,13 @@ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); /***************************************************************************** * - * Debugger and Disassembler globals + * Debugger and Disassembler * ****************************************************************************/ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); + #ifdef ACPI_DISASSEMBLER /* Do not disassemble buffers to resource descriptors */ @@ -427,7 +427,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmEmitExternalOpcodes, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DoDisassemblerOptimizations, TRUE); -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT_LIST, *AcpiGbl_TempListHead, NULL); +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT_LIST, *AcpiGbl_TempListHead, NULL); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); @@ -438,7 +438,6 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); #endif #ifdef ACPI_DEBUGGER - ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); @@ -452,7 +451,6 @@ ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateLoop); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbThreadsTerminated); - ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); @@ -462,81 +460,66 @@ ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_ ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]); ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]); -/* - * Statistic globals - */ +/* Statistics globals */ + ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]); ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]); ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); - #endif /* ACPI_DEBUGGER */ #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) - -ACPI_GLOBAL (const char, *AcpiGbl_PldPanelList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldVerticalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldHorizontalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); - +ACPI_GLOBAL (const char, *AcpiGbl_PldPanelList[]); +ACPI_GLOBAL (const char, *AcpiGbl_PldVerticalPositionList[]); +ACPI_GLOBAL (const char, *AcpiGbl_PldHorizontalPositionList[]); +ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DisasmFlag, FALSE); - #endif -/* - * Meant for the -ca option. - */ -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentInlineComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentEndNodeComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentOpenBraceComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentCloseBraceComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_RootFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentParentFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentIncludeFilename, NULL); +/***************************************************************************** + * + * ACPICA application-specific globals + * + ****************************************************************************/ -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); +/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ + +#ifdef ACPI_ASL_COMPILER +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentInlineComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentEndNodeComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentOpenBraceComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentCloseBraceComment, NULL); + +ACPI_INIT_GLOBAL (char *, AcpiGbl_RootFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentParentFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentIncludeFilename, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListTail, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL); - -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL); - +ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL); ACPI_INIT_GLOBAL (ACPI_FILE_NODE, *AcpiGbl_FileTreeRoot, NULL); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_RegCommentCache); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_CommentAddrCache); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_FileCache); -ACPI_INIT_GLOBAL (BOOLEAN, Gbl_CaptureComments, FALSE); - -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE); -ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL); - -ACPI_GLOBAL (char, AcpiGbl_TableSig[4]); - -/***************************************************************************** - * - * Application globals - * - ****************************************************************************/ +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL); +ACPI_GLOBAL (char, AcpiGbl_TableSig[4]); +#endif #ifdef ACPI_APPLICATION - ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); @@ -545,18 +528,6 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); - #endif /* ACPI_APPLICATION */ - -/***************************************************************************** - * - * Info/help support - * - ****************************************************************************/ - -extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; -extern const AH_DEVICE_ID AslDeviceIds[]; - - #endif /* __ACGLOBAL_H__ */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 3af2a13749d2..ee85719162d0 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20171110 +#define ACPI_CA_VERSION 0x20171214 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actypes.h b/source/include/actypes.h index 4cc6d4fd071e..2d71de51ede4 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -1509,6 +1509,8 @@ typedef enum #define ACPI_OSI_WIN_7 0x0B #define ACPI_OSI_WIN_8 0x0C #define ACPI_OSI_WIN_10 0x0D +#define ACPI_OSI_WIN_10_RS1 0x0E +#define ACPI_OSI_WIN_10_RS2 0x0F /* Definitions of getopt */ diff --git a/source/include/acutils.h b/source/include/acutils.h index ff9f72db70be..708c0896904e 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -1059,6 +1059,12 @@ AcpiUtSafeStrcpy ( ACPI_SIZE DestSize, char *Source); +void +AcpiUtSafeStrncpy ( + char *Dest, + char *Source, + ACPI_SIZE DestSize); + BOOLEAN AcpiUtSafeStrcat ( char *Dest, diff --git a/source/os_specific/service_layers/osgendbg.c b/source/os_specific/service_layers/osgendbg.c index 504874bfc207..581cee33ff44 100644 --- a/source/os_specific/service_layers/osgendbg.c +++ b/source/os_specific/service_layers/osgendbg.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: osgendbg - Generic debugger command singalling + * Module Name: osgendbg - Generic debugger command signalling * *****************************************************************************/ @@ -169,6 +169,7 @@ static ACPI_MUTEX AcpiGbl_DbCommandReady; static ACPI_MUTEX AcpiGbl_DbCommandComplete; static BOOLEAN AcpiGbl_DbCommandSignalsInitialized = FALSE; + /****************************************************************************** * * FUNCTION: AcpiDbRunRemoteDebugger @@ -213,7 +214,7 @@ AcpiDbRunRemoteDebugger ( Ptr++; } - strncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE); + AcpiUtSafeStrncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE); Ptr++; Cmd = Ptr; } diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index b28541955a19..1ed341d93134 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -526,10 +526,12 @@ AeAttachedDataHandler ( { ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); + ACPI_FUNCTION_NAME (AeAttachedDataHandler1); - AcpiOsPrintf (AE_PREFIX - "Received an attached data deletion (1) on %4.4s\n", - Node->Name.Ascii); + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Received an attached data deletion at handler 1 on %4.4s\n", + Node->Name.Ascii)); } @@ -549,10 +551,12 @@ AeAttachedDataHandler2 ( { ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); + ACPI_FUNCTION_NAME (AeAttachedDataHandler2); - AcpiOsPrintf (AE_PREFIX - "Received an attached data deletion (2) on %4.4s\n", - Node->Name.Ascii); + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Received an attached data deletion at handler 2 on %4.4s\n", + Node->Name.Ascii)); } diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index b3df425614a3..63f2c44e7ca3 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -533,13 +533,12 @@ AeDoOptions ( { case '^': /* -v: (Version): signon already emitted, just exit */ - (void) AcpiOsTerminate (); - return (1); + exit (0); case 'd': printf (ACPI_COMMON_BUILD_TIME); - return (1); + exit (0); case 'i': diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index d5b13c059c83..8ee626ee5f8e 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -198,6 +198,8 @@ ACPI_GLOBAL (char, Gbl_Buffer[AH_BUFFER_LENGTH]); ACPI_GLOBAL (char, Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]); +extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; +extern const AH_DEVICE_ID AslDeviceIds[]; #define AH_DISPLAY_EXCEPTION(Status, Name) \ diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index ffaede804ff4..30ea9741b8df 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -311,7 +311,7 @@ AhFindPredefinedNames ( } Name[0] = '_'; - strncpy (&Name[1], NamePrefix, 7); + AcpiUtSafeStrncpy (&Name[1], NamePrefix, 7); Length = strlen (Name); if (Length > ACPI_NAME_SIZE) diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c index ea78846da1ac..fe1ace9d90a5 100644 --- a/source/tools/acpixtract/acpixtract.c +++ b/source/tools/acpixtract/acpixtract.c @@ -204,8 +204,7 @@ AxExtractTables ( if (Signature) { - strncpy (UpperSignature, Signature, 4); - UpperSignature[4] = 0; + AcpiUtSafeStrncpy (UpperSignature, Signature, ACPI_NAME_SIZE); AcpiUtStrupr (UpperSignature); /* Are there enough instances of the table to continue? */