From owner-svn-src-head@freebsd.org Thu Dec 14 23:21:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D3E1E934EA; Thu, 14 Dec 2017 23:21:36 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E53837E424; Thu, 14 Dec 2017 23:21:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBENLZ33044407; Thu, 14 Dec 2017 23:21:35 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBENLVGb044369; Thu, 14 Dec 2017 23:21:31 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201712142321.vBENLVGb044369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 14 Dec 2017 23:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326866 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer components/hardware components/namespac... X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer components/hardware components/namespace components/parser compo... X-SVN-Commit-Revision: 326866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 23:21:36 -0000 Author: jkim Date: Thu Dec 14 23:21:31 2017 New Revision: 326866 URL: https://svnweb.freebsd.org/changeset/base/326866 Log: MFC: r326864 Merge ACPICA 20171214. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/dmswitch.c head/sys/contrib/dev/acpica/common/dmtable.c head/sys/contrib/dev/acpica/common/dmtables.c head/sys/contrib/dev/acpica/common/dmtbdump.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/asldebug.c head/sys/contrib/dev/acpica/compiler/aslfiles.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/compiler/asltree.c head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/cvcompiler.c head/sys/contrib/dev/acpica/compiler/cvdisasm.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dttable1.c head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/components/debugger/dbfileio.c head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/hardware/hwvalid.c head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/components/parser/psutils.c head/sys/contrib/dev/acpica/components/utilities/utdebug.c head/sys/contrib/dev/acpica/components/utilities/utnonansi.c head/sys/contrib/dev/acpica/components/utilities/utosi.c head/sys/contrib/dev/acpica/components/utilities/uttrack.c head/sys/contrib/dev/acpica/include/acexcep.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acutils.h head/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/changes.txt Thu Dec 14 23:21:31 2017 (r326866) @@ -1,4 +1,44 @@ ---------------------------------------- +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: Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/common/adisasm.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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 Modified: head/sys/contrib/dev/acpica/common/dmswitch.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmswitch.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/common/dmswitch.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; Modified: head/sys/contrib/dev/acpica/common/dmtable.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtable.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/common/dmtable.c Thu Dec 14 23:21:31 2017 (r326866) @@ -1654,7 +1654,6 @@ AcpiDmDumpTable ( break; - case ACPI_DMT_FADTPM: /* FADT Preferred PM Profile names */ Modified: head/sys/contrib/dev/acpica/common/dmtables.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtables.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/common/dmtables.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/common/dmtbdump.c Thu Dec 14 23:21:31 2017 (r326866) @@ -3734,7 +3734,6 @@ NextSubtable: } - /******************************************************************************* * * FUNCTION: AcpiDmDumpSdev Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); } Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; Modified: head/sys/contrib/dev/acpica/compiler/asldebug.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldebug.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/asldebug.c Thu Dec 14 23:21:31 2017 (r326866) @@ -192,7 +192,7 @@ CvDbgPrint ( va_list Args; - if (!Gbl_CaptureComments || !AcpiGbl_DebugAslConversion) + if (!AcpiGbl_CaptureComments || !AcpiGbl_DebugAslConversion) { return; } Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslfiles.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslfiles.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); } Modified: head/sys/contrib/dev/acpica/compiler/asloptions.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asloptions.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/asloptions.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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 */ Modified: head/sys/contrib/dev/acpica/compiler/aslparseop.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslparseop.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslparseop.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; Modified: head/sys/contrib/dev/acpica/compiler/aslstartup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslstartup.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslstartup.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslsupport.l Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l Thu Dec 14 23:21:31 2017 (r326866) @@ -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; Modified: head/sys/contrib/dev/acpica/compiler/asltree.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asltree.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/asltree.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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) { Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); } Modified: head/sys/contrib/dev/acpica/compiler/cvcompiler.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/cvcompiler.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/cvcompiler.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/compiler/cvdisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/cvdisasm.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/cvdisasm.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; Modified: head/sys/contrib/dev/acpica/compiler/cvparser.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/cvparser.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/cvparser.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/compiler/dtcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtcompile.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/dtcompile.c Thu Dec 14 23:21:31 2017 (r326866) @@ -559,9 +559,17 @@ 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 */ Modified: head/sys/contrib/dev/acpica/compiler/dttable1.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dttable1.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/dttable1.c Thu Dec 14 23:21:31 2017 (r326866) @@ -596,8 +596,14 @@ 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 */ } Modified: head/sys/contrib/dev/acpica/compiler/prscan.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/prscan.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/compiler/prscan.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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", Modified: head/sys/contrib/dev/acpica/components/debugger/dbfileio.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbfileio.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/debugger/dbfileio.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); Modified: head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/components/executer/exdump.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exdump.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/executer/exdump.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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; } Modified: head/sys/contrib/dev/acpica/components/hardware/hwvalid.c ============================================================================== --- head/sys/contrib/dev/acpica/components/hardware/hwvalid.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/hardware/hwvalid.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); } Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); Modified: head/sys/contrib/dev/acpica/components/parser/psutils.c ============================================================================== --- head/sys/contrib/dev/acpica/components/parser/psutils.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/parser/psutils.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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); } Modified: head/sys/contrib/dev/acpica/components/utilities/utdebug.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utdebug.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/utilities/utdebug.c Thu Dec 14 23:21:31 2017 (r326866) @@ -290,8 +290,10 @@ AcpiDebugPrint ( { ACPI_THREAD_ID ThreadId; va_list args; +#ifdef ACPI_APPLICATION + int FillCount; +#endif - /* Check if debug output enabled */ if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) @@ -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); Modified: head/sys/contrib/dev/acpica/components/utilities/utnonansi.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utnonansi.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/utilities/utnonansi.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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 Modified: head/sys/contrib/dev/acpica/components/utilities/utosi.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utosi.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/utilities/utosi.c Thu Dec 14 23:21:31 2017 (r326866) @@ -214,6 +214,8 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInte {"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 */ Modified: head/sys/contrib/dev/acpica/components/utilities/uttrack.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/uttrack.c Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/components/utilities/uttrack.c Thu Dec 14 23:21:31 2017 (r326866) @@ -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) { Modified: head/sys/contrib/dev/acpica/include/acexcep.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acexcep.h Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/include/acexcep.h Thu Dec 14 23:21:31 2017 (r326866) @@ -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_ExceptionN 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[] = Modified: head/sys/contrib/dev/acpica/include/acglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acglobal.h Thu Dec 14 22:57:22 2017 (r326865) +++ head/sys/contrib/dev/acpica/include/acglobal.h Thu Dec 14 23:21:31 2017 (r326866) @@ -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_Intege /***************************************************************************** * - * Mutual exclusion within ACPICA subsystem + * Mutual exclusion within the ACPICA subsystem * ****************************************************************************/ @@ -278,7 +278,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_NextOw ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE); -/* Misc */ +/* Miscellaneous */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***