Message ID | 20171216104758.24099-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | ACPICA: Update to version 20171215 | expand |
On 2017-12-16 06:47 PM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > Changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2017-December/001610.html > ..for 20171214 with the following additional changes for the subsequent > 20171215 ACPICA release: > > acpiexec: Restore terminal mode after -v and -vd options > acpixtract: Fix a regression with table signatures > > Signed-off-by: Colin Ian King<colin.king@canonical.com> Acked-by: Alex Hung <alex.hung@canonical.com>
On 12/16/2017 06:47 PM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2017-December/001610.html > ..for 20171214 with the following additional changes for the subsequent > 20171215 ACPICA release: > > acpiexec: Restore terminal mode after -v and -vd options > acpixtract: Fix a regression with table signatures > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpica/source/common/adisasm.c | 4 +- > src/acpica/source/common/dmswitch.c | 4 + > src/acpica/source/common/dmtable.c | 1 - > src/acpica/source/common/dmtables.c | 4 +- > src/acpica/source/common/dmtbdump.c | 1 - > src/acpica/source/compiler/aslcodegen.c | 19 ++-- > src/acpica/source/compiler/aslcompile.c | 2 +- > src/acpica/source/compiler/asldebug.c | 2 +- > src/acpica/source/compiler/aslfiles.c | 2 +- > src/acpica/source/compiler/aslparseop.c | 6 +- > src/acpica/source/compiler/aslstartup.c | 4 +- > src/acpica/source/compiler/aslsupport.l | 18 +-- > src/acpica/source/compiler/asltree.c | 8 +- > src/acpica/source/compiler/aslutils.c | 2 +- > src/acpica/source/compiler/cvcompiler.c | 10 +- > src/acpica/source/compiler/cvdisasm.c | 4 +- > src/acpica/source/compiler/cvparser.c | 6 +- > src/acpica/source/compiler/dtcompile.c | 10 +- > src/acpica/source/compiler/dttable1.c | 10 +- > src/acpica/source/compiler/prscan.c | 2 +- > src/acpica/source/components/debugger/dbfileio.c | 2 +- > src/acpica/source/components/disassembler/dmwalk.c | 6 +- > .../source/components/dispatcher/dspkginit.c | 22 ++-- > src/acpica/source/components/executer/exdump.c | 6 +- > src/acpica/source/components/hardware/hwvalid.c | 17 +-- > src/acpica/source/components/namespace/nsxfeval.c | 18 ++- > src/acpica/source/components/parser/psutils.c | 4 +- > src/acpica/source/components/utilities/utdebug.c | 19 +++- > src/acpica/source/components/utilities/utnonansi.c | 13 +++ > src/acpica/source/components/utilities/utosi.c | 2 + > src/acpica/source/components/utilities/uttrack.c | 3 +- > src/acpica/source/include/acexcep.h | 6 +- > src/acpica/source/include/acglobal.h | 121 ++++++++------------- > src/acpica/source/include/acpixf.h | 2 +- > src/acpica/source/include/actypes.h | 2 + > src/acpica/source/include/acutils.h | 6 + > .../source/os_specific/service_layers/osgendbg.c | 5 +- > src/acpica/source/tools/acpiexec/aehandlers.c | 16 ++- > 38 files changed, 216 insertions(+), 173 deletions(-) > > diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c > index bfc815d4..53fba0f9 100644 > --- a/src/acpica/source/common/adisasm.c > +++ b/src/acpica/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/src/acpica/source/common/dmswitch.c b/src/acpica/source/common/dmswitch.c > index 1641cbf9..5c2ac3a6 100644 > --- a/src/acpica/source/common/dmswitch.c > +++ b/src/acpica/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/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c > index 60951732..3d931485 100644 > --- a/src/acpica/source/common/dmtable.c > +++ b/src/acpica/source/common/dmtable.c > @@ -1654,7 +1654,6 @@ AcpiDmDumpTable ( > break; > > > - > case ACPI_DMT_FADTPM: > > /* FADT Preferred PM Profile names */ > diff --git a/src/acpica/source/common/dmtables.c b/src/acpica/source/common/dmtables.c > index 0ec69aba..b87ddd46 100644 > --- a/src/acpica/source/common/dmtables.c > +++ b/src/acpica/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/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c > index 1ef91c2d..fae7c040 100644 > --- a/src/acpica/source/common/dmtbdump.c > +++ b/src/acpica/source/common/dmtbdump.c > @@ -3734,7 +3734,6 @@ NextSubtable: > } > > > - > /******************************************************************************* > * > * FUNCTION: AcpiDmDumpSdev > diff --git a/src/acpica/source/compiler/aslcodegen.c b/src/acpica/source/compiler/aslcodegen.c > index a527ddda..ea879b8c 100644 > --- a/src/acpica/source/compiler/aslcodegen.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c > index 1ddb8864..ae78cec4 100644 > --- a/src/acpica/source/compiler/aslcompile.c > +++ b/src/acpica/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/src/acpica/source/compiler/asldebug.c b/src/acpica/source/compiler/asldebug.c > index ba252251..0dab6d57 100644 > --- a/src/acpica/source/compiler/asldebug.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c > index 53df683e..177a3295 100644 > --- a/src/acpica/source/compiler/aslfiles.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslparseop.c b/src/acpica/source/compiler/aslparseop.c > index 438e5a28..ac80a0a2 100644 > --- a/src/acpica/source/compiler/aslparseop.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c > index fa1ac25b..3cc26005 100644 > --- a/src/acpica/source/compiler/aslstartup.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l > index 40cead33..db243e4a 100644 > --- a/src/acpica/source/compiler/aslsupport.l > +++ b/src/acpica/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/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c > index 084bc4d5..06bf7599 100644 > --- a/src/acpica/source/compiler/asltree.c > +++ b/src/acpica/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/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c > index 82d11b4b..0696b84d 100644 > --- a/src/acpica/source/compiler/aslutils.c > +++ b/src/acpica/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/src/acpica/source/compiler/cvcompiler.c b/src/acpica/source/compiler/cvcompiler.c > index d2a6c8f0..8da66782 100644 > --- a/src/acpica/source/compiler/cvcompiler.c > +++ b/src/acpica/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/src/acpica/source/compiler/cvdisasm.c b/src/acpica/source/compiler/cvdisasm.c > index 8682f04e..d382aaa5 100644 > --- a/src/acpica/source/compiler/cvdisasm.c > +++ b/src/acpica/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/src/acpica/source/compiler/cvparser.c b/src/acpica/source/compiler/cvparser.c > index b2e3e767..a3ef2806 100644 > --- a/src/acpica/source/compiler/cvparser.c > +++ b/src/acpica/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/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c > index 0823196f..47f72eb3 100644 > --- a/src/acpica/source/compiler/dtcompile.c > +++ b/src/acpica/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/src/acpica/source/compiler/dttable1.c b/src/acpica/source/compiler/dttable1.c > index 138f4f3a..9b755509 100644 > --- a/src/acpica/source/compiler/dttable1.c > +++ b/src/acpica/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/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c > index a012e111..a46b41f4 100644 > --- a/src/acpica/source/compiler/prscan.c > +++ b/src/acpica/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/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c > index 501d3587..00bb777a 100644 > --- a/src/acpica/source/components/debugger/dbfileio.c > +++ b/src/acpica/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/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c > index 750e6398..ce8eb207 100644 > --- a/src/acpica/source/components/disassembler/dmwalk.c > +++ b/src/acpica/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/src/acpica/source/components/dispatcher/dspkginit.c b/src/acpica/source/components/dispatcher/dspkginit.c > index 14e34b09..d7a4c178 100644 > --- a/src/acpica/source/components/dispatcher/dspkginit.c > +++ b/src/acpica/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/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c > index c1069b2c..8730a0eb 100644 > --- a/src/acpica/source/components/executer/exdump.c > +++ b/src/acpica/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/src/acpica/source/components/hardware/hwvalid.c b/src/acpica/source/components/hardware/hwvalid.c > index 0d41dd13..e2b187e7 100644 > --- a/src/acpica/source/components/hardware/hwvalid.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nsxfeval.c b/src/acpica/source/components/namespace/nsxfeval.c > index ab3ad598..cb31e131 100644 > --- a/src/acpica/source/components/namespace/nsxfeval.c > +++ b/src/acpica/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/src/acpica/source/components/parser/psutils.c b/src/acpica/source/components/parser/psutils.c > index a04b2e50..1b01c4b0 100644 > --- a/src/acpica/source/components/parser/psutils.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/utdebug.c b/src/acpica/source/components/utilities/utdebug.c > index dd80f241..177b141b 100644 > --- a/src/acpica/source/components/utilities/utdebug.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/utnonansi.c b/src/acpica/source/components/utilities/utnonansi.c > index f9551d05..f1404e59 100644 > --- a/src/acpica/source/components/utilities/utnonansi.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/utosi.c b/src/acpica/source/components/utilities/utosi.c > index d8f299ed..ee2890fb 100644 > --- a/src/acpica/source/components/utilities/utosi.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/uttrack.c b/src/acpica/source/components/utilities/uttrack.c > index e74ff066..a9b5e058 100644 > --- a/src/acpica/source/components/utilities/uttrack.c > +++ b/src/acpica/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/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h > index 21db48dc..16d3698b 100644 > --- a/src/acpica/source/include/acexcep.h > +++ b/src/acpica/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/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h > index 686dcd81..d2958698 100644 > --- a/src/acpica/source/include/acglobal.h > +++ b/src/acpica/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 > + * > + ****************************************************************************/ > + > +/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ > > -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); > +#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/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h > index 3af2a137..347b4f00 100644 > --- a/src/acpica/source/include/acpixf.h > +++ b/src/acpica/source/include/acpixf.h > @@ -154,7 +154,7 @@ > > /* Current ACPICA subsystem version in YYYYMMDD format */ > > -#define ACPI_CA_VERSION 0x20171110 > +#define ACPI_CA_VERSION 0x20171215 > > #include "acconfig.h" > #include "actypes.h" > diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h > index 4cc6d4fd..2d71de51 100644 > --- a/src/acpica/source/include/actypes.h > +++ b/src/acpica/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/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h > index ff9f72db..708c0896 100644 > --- a/src/acpica/source/include/acutils.h > +++ b/src/acpica/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/src/acpica/source/os_specific/service_layers/osgendbg.c b/src/acpica/source/os_specific/service_layers/osgendbg.c > index 504874bf..581cee33 100644 > --- a/src/acpica/source/os_specific/service_layers/osgendbg.c > +++ b/src/acpica/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/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c > index b2854195..1ed341d9 100644 > --- a/src/acpica/source/tools/acpiexec/aehandlers.c > +++ b/src/acpica/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)); > } > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c index bfc815d4..53fba0f9 100644 --- a/src/acpica/source/common/adisasm.c +++ b/src/acpica/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/src/acpica/source/common/dmswitch.c b/src/acpica/source/common/dmswitch.c index 1641cbf9..5c2ac3a6 100644 --- a/src/acpica/source/common/dmswitch.c +++ b/src/acpica/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/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c index 60951732..3d931485 100644 --- a/src/acpica/source/common/dmtable.c +++ b/src/acpica/source/common/dmtable.c @@ -1654,7 +1654,6 @@ AcpiDmDumpTable ( break; - case ACPI_DMT_FADTPM: /* FADT Preferred PM Profile names */ diff --git a/src/acpica/source/common/dmtables.c b/src/acpica/source/common/dmtables.c index 0ec69aba..b87ddd46 100644 --- a/src/acpica/source/common/dmtables.c +++ b/src/acpica/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/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c index 1ef91c2d..fae7c040 100644 --- a/src/acpica/source/common/dmtbdump.c +++ b/src/acpica/source/common/dmtbdump.c @@ -3734,7 +3734,6 @@ NextSubtable: } - /******************************************************************************* * * FUNCTION: AcpiDmDumpSdev diff --git a/src/acpica/source/compiler/aslcodegen.c b/src/acpica/source/compiler/aslcodegen.c index a527ddda..ea879b8c 100644 --- a/src/acpica/source/compiler/aslcodegen.c +++ b/src/acpica/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/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c index 1ddb8864..ae78cec4 100644 --- a/src/acpica/source/compiler/aslcompile.c +++ b/src/acpica/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/src/acpica/source/compiler/asldebug.c b/src/acpica/source/compiler/asldebug.c index ba252251..0dab6d57 100644 --- a/src/acpica/source/compiler/asldebug.c +++ b/src/acpica/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/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c index 53df683e..177a3295 100644 --- a/src/acpica/source/compiler/aslfiles.c +++ b/src/acpica/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/src/acpica/source/compiler/aslparseop.c b/src/acpica/source/compiler/aslparseop.c index 438e5a28..ac80a0a2 100644 --- a/src/acpica/source/compiler/aslparseop.c +++ b/src/acpica/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/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c index fa1ac25b..3cc26005 100644 --- a/src/acpica/source/compiler/aslstartup.c +++ b/src/acpica/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/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l index 40cead33..db243e4a 100644 --- a/src/acpica/source/compiler/aslsupport.l +++ b/src/acpica/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/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c index 084bc4d5..06bf7599 100644 --- a/src/acpica/source/compiler/asltree.c +++ b/src/acpica/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/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c index 82d11b4b..0696b84d 100644 --- a/src/acpica/source/compiler/aslutils.c +++ b/src/acpica/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/src/acpica/source/compiler/cvcompiler.c b/src/acpica/source/compiler/cvcompiler.c index d2a6c8f0..8da66782 100644 --- a/src/acpica/source/compiler/cvcompiler.c +++ b/src/acpica/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/src/acpica/source/compiler/cvdisasm.c b/src/acpica/source/compiler/cvdisasm.c index 8682f04e..d382aaa5 100644 --- a/src/acpica/source/compiler/cvdisasm.c +++ b/src/acpica/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/src/acpica/source/compiler/cvparser.c b/src/acpica/source/compiler/cvparser.c index b2e3e767..a3ef2806 100644 --- a/src/acpica/source/compiler/cvparser.c +++ b/src/acpica/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/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c index 0823196f..47f72eb3 100644 --- a/src/acpica/source/compiler/dtcompile.c +++ b/src/acpica/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/src/acpica/source/compiler/dttable1.c b/src/acpica/source/compiler/dttable1.c index 138f4f3a..9b755509 100644 --- a/src/acpica/source/compiler/dttable1.c +++ b/src/acpica/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/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c index a012e111..a46b41f4 100644 --- a/src/acpica/source/compiler/prscan.c +++ b/src/acpica/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/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c index 501d3587..00bb777a 100644 --- a/src/acpica/source/components/debugger/dbfileio.c +++ b/src/acpica/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/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c index 750e6398..ce8eb207 100644 --- a/src/acpica/source/components/disassembler/dmwalk.c +++ b/src/acpica/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/src/acpica/source/components/dispatcher/dspkginit.c b/src/acpica/source/components/dispatcher/dspkginit.c index 14e34b09..d7a4c178 100644 --- a/src/acpica/source/components/dispatcher/dspkginit.c +++ b/src/acpica/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/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c index c1069b2c..8730a0eb 100644 --- a/src/acpica/source/components/executer/exdump.c +++ b/src/acpica/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/src/acpica/source/components/hardware/hwvalid.c b/src/acpica/source/components/hardware/hwvalid.c index 0d41dd13..e2b187e7 100644 --- a/src/acpica/source/components/hardware/hwvalid.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nsxfeval.c b/src/acpica/source/components/namespace/nsxfeval.c index ab3ad598..cb31e131 100644 --- a/src/acpica/source/components/namespace/nsxfeval.c +++ b/src/acpica/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/src/acpica/source/components/parser/psutils.c b/src/acpica/source/components/parser/psutils.c index a04b2e50..1b01c4b0 100644 --- a/src/acpica/source/components/parser/psutils.c +++ b/src/acpica/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/src/acpica/source/components/utilities/utdebug.c b/src/acpica/source/components/utilities/utdebug.c index dd80f241..177b141b 100644 --- a/src/acpica/source/components/utilities/utdebug.c +++ b/src/acpica/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/src/acpica/source/components/utilities/utnonansi.c b/src/acpica/source/components/utilities/utnonansi.c index f9551d05..f1404e59 100644 --- a/src/acpica/source/components/utilities/utnonansi.c +++ b/src/acpica/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/src/acpica/source/components/utilities/utosi.c b/src/acpica/source/components/utilities/utosi.c index d8f299ed..ee2890fb 100644 --- a/src/acpica/source/components/utilities/utosi.c +++ b/src/acpica/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/src/acpica/source/components/utilities/uttrack.c b/src/acpica/source/components/utilities/uttrack.c index e74ff066..a9b5e058 100644 --- a/src/acpica/source/components/utilities/uttrack.c +++ b/src/acpica/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/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h index 21db48dc..16d3698b 100644 --- a/src/acpica/source/include/acexcep.h +++ b/src/acpica/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/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h index 686dcd81..d2958698 100644 --- a/src/acpica/source/include/acglobal.h +++ b/src/acpica/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 + * + ****************************************************************************/ + +/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); +#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/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h index 3af2a137..347b4f00 100644 --- a/src/acpica/source/include/acpixf.h +++ b/src/acpica/source/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20171110 +#define ACPI_CA_VERSION 0x20171215 #include "acconfig.h" #include "actypes.h" diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h index 4cc6d4fd..2d71de51 100644 --- a/src/acpica/source/include/actypes.h +++ b/src/acpica/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/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h index ff9f72db..708c0896 100644 --- a/src/acpica/source/include/acutils.h +++ b/src/acpica/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/src/acpica/source/os_specific/service_layers/osgendbg.c b/src/acpica/source/os_specific/service_layers/osgendbg.c index 504874bf..581cee33 100644 --- a/src/acpica/source/os_specific/service_layers/osgendbg.c +++ b/src/acpica/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/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c index b2854195..1ed341d9 100644 --- a/src/acpica/source/tools/acpiexec/aehandlers.c +++ b/src/acpica/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)); }