From owner-svn-src-vendor@freebsd.org Fri Sep 30 19:46:17 2016 Return-Path: Delivered-To: svn-src-vendor@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 63C59C03A62; Fri, 30 Sep 2016 19:46:17 +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 2D22B184; Fri, 30 Sep 2016 19:46:17 +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 u8UJkGjO007763; Fri, 30 Sep 2016 19:46:16 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8UJkDNc007734; Fri, 30 Sep 2016 19:46:13 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201609301946.u8UJkDNc007734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 30 Sep 2016 19:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r306523 - in vendor-sys/acpica/dist: . source/common source/compiler source/components/disassembler source/components/executer source/components/parser source/components/tables source/c... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 19:46:17 -0000 Author: jkim Date: Fri Sep 30 19:46:13 2016 New Revision: 306523 URL: https://svnweb.freebsd.org/changeset/base/306523 Log: Import ACPICA 20160930. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/common/acfileio.c vendor-sys/acpica/dist/source/compiler/aslmaputils.c vendor-sys/acpica/dist/source/compiler/asloperands.c vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslrules.y vendor-sys/acpica/dist/source/compiler/aslxref.c vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c vendor-sys/acpica/dist/source/components/disassembler/dmresrcl.c vendor-sys/acpica/dist/source/components/executer/exconfig.c vendor-sys/acpica/dist/source/components/parser/psxface.c vendor-sys/acpica/dist/source/components/tables/tbdata.c vendor-sys/acpica/dist/source/components/tables/tbfind.c vendor-sys/acpica/dist/source/components/tables/tbxfload.c vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c vendor-sys/acpica/dist/source/include/acconfig.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/platform/acmacosx.h vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c vendor-sys/acpica/dist/source/tools/acpibin/abcompare.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpinames/anmain.c vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/changes.txt Fri Sep 30 19:46:13 2016 (r306523) @@ -1,4 +1,83 @@ ---------------------------------------- +30 September 2016. Summary of changes for version 20160930: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression in the internal AcpiTbFindTable function where a non +AE_OK exception could inadvertently be returned even if the function did +not fail. This problem affects the following operators: + DataTableRegion + LoadTable + +Fixed a regression in the LoadTable operator where a load to any +namespace location other than the root no longer worked properly. + +Increased the maximum loop count value that will result in the +AE_AML_INFINITE_LOOP exception. This is a mechanism that is intended to +prevent infinite loops within the AML interpreter and thus the host OS +kernel. The value is increased from 0xFFFF to 0xFFFFF loops (65,535 to +1,048,575). + +Moved the AcpiGbl_MaxLoopIterations configuration variable to the public +acpixf.h file. This allows hosts to easily configure the maximum loop +count at runtime. + +Removed an illegal character in the strtoul64.c file. This character +caused errors with some C compilers. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 140.4K Code, 58.1K Data, 198.5K Total + Debug Version: 200.7K Code, 82.1K Data, 282.8K Total + Previous Release: + Non-Debug Version: 140.0K Code, 58.1K Data, 198.1K Total + Debug Version: 200.3K Code, 82.1K Data, 282.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with the conversion of Else{If{ blocks into +the simpler ASL ElseIf keyword. During the conversion, a trailing If +block could be lost and missing from the disassembled output. + +iASL: Fixed a missing parser rule for the ObjectType operator. For ASL+, +the missing rule caused a parse error when using the Index operator as an +operand to ObjectType. This construct now compiles properly. Example: + ObjectType(PKG1[4]). + +iASL: Correctly handle unresolved symbols in the hardware map file (-lm +option). Previously, unresolved symbols could cause a protection fault. +Such symbols are now marked as unresolved in the map file. + +iASL: Implemented support to allow control method invocations as an +operand to the ASL DeRefOf operator. Example: + DeRefOf(MTH1(Local0)) + +Disassembler: Improved support for the ToPLD ASL macro. Detection of a +possible _PLD buffer now includes examination of both the normal buffer +length (16 or 20) as well as the surrounding AML package length. + +Disassembler: Fixed a problem with the decoding of complex expressions +within the Divide operator for ASL+. For the case where both the quotient +and remainder targets are specified, the entire statement cannot be +disassembled. Previously, the output incorrectly contained a mix of ASL- +and ASL+ operators. This mixed statement causes a syntax error when +compiled. Example: + Divide (Add (INT1, 6), 128, RSLT, QUOT) // was incorrectly +disassembled to: + Divide (INT1 + 6, 128, RSLT, QUOT) + +iASL/Tools: Added support to process AML and non-AML ACPI tables +consistently. For the disassembler and AcpiExec, allow all types of ACPI +tables (AML and data tables). For the iASL -e option, allow only AML +tables (DSDT/SSDT). + +---------------------------------------- 31 August 2016. Summary of changes for version 20160831: Modified: vendor-sys/acpica/dist/source/common/acfileio.c ============================================================================== --- vendor-sys/acpica/dist/source/common/acfileio.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/common/acfileio.c Fri Sep 30 19:46:13 2016 (r306523) @@ -262,12 +262,14 @@ AcGetOneTableFromFile ( return (Status); } + if (GetOnlyAmlTables) { - /* Table must be an AML table (DSDT/SSDT) or FADT */ - - if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) && - !AcpiUtIsAmlTable (&TableHeader)) + /* + * Table must be an AML table (DSDT/SSDT). + * Used for iASL -e option only. + */ + if (!AcpiUtIsAmlTable (&TableHeader)) { fprintf (stderr, " %s: Table [%4.4s] is not an AML table - ignoring\n", Modified: vendor-sys/acpica/dist/source/compiler/aslmaputils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmaputils.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/compiler/aslmaputils.c Fri Sep 30 19:46:13 2016 (r306523) @@ -80,6 +80,12 @@ MpGetHidFromParseTree ( Op = HidNode->Op; + if (!Op) + { + /* Object is not resolved, probably an External */ + + return ("Unresolved Symbol - referenced but not defined in this table"); + } switch (Op->Asl.ParseOpcode) { Modified: vendor-sys/acpica/dist/source/compiler/asloperands.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/compiler/asloperands.c Fri Sep 30 19:46:13 2016 (r306523) @@ -351,6 +351,20 @@ OpnDoFieldCommon ( NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer; CurrentBitOffset += NewBitOffset; + if ((NewBitOffset == 0) && + (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES)) + { + /* + * Unnamed field with a bit length of zero. We can + * safely just ignore this. However, we will not ignore + * a named field of zero length, we don't want to just + * toss out a name. + */ + Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + break; + } + /* Save the current AccessAs value for error checking later */ switch (AccessType) Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Sep 30 19:46:13 2016 (r306523) @@ -561,6 +561,13 @@ AslDoOptions ( Gbl_CompileTimesFlag = TRUE; break; + case 'd': + + /* Disable disassembler code optimizations */ + + AcpiGbl_DoDisassemblerOptimizations = FALSE; + break; + case 'e': /* iASL: Disable External opcode generation */ Modified: vendor-sys/acpica/dist/source/compiler/aslrules.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Sep 30 19:46:13 2016 (r306523) @@ -530,7 +530,7 @@ ObjectTypeName | RefOfTerm {} | DerefOfTerm {} | IndexTerm {} - + | IndexExpTerm {} /* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ ; Modified: vendor-sys/acpica/dist/source/compiler/aslxref.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslxref.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/compiler/aslxref.c Fri Sep 30 19:46:13 2016 (r306523) @@ -826,16 +826,18 @@ XfNamespaceLocateBegin ( /* * A reference to a method within one of these opcodes is not an * invocation of the method, it is simply a reference to the method. + * + * September 2016: Removed DeRefOf from this list */ if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || + ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)|| (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) { return_ACPI_STATUS (AE_OK); } + /* * There are two types of method invocation: * 1) Invocation with arguments -- the parser recognizes this Modified: vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c Fri Sep 30 19:46:13 2016 (r306523) @@ -529,7 +529,8 @@ AcpiDmIsStringBuffer ( * * PARAMETERS: Op - Buffer Object to be examined * - * RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise + * RETURN: TRUE if buffer appears to contain data produced via the + * ToPLD macro, FALSE otherwise * * DESCRIPTION: Determine if a buffer Op contains a _PLD structure * @@ -541,12 +542,60 @@ AcpiDmIsPldBuffer ( { ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *SizeOp; + ACPI_PARSE_OBJECT *ByteListOp; ACPI_PARSE_OBJECT *ParentOp; + UINT64 BufferSize; + UINT64 InitializerSize; - /* Buffer size is the buffer argument */ - + /* + * Get the BufferSize argument - Buffer(BufferSize) + * If the buffer was generated by the ToPld macro, it must + * be a BYTE constant. + */ SizeOp = Op->Common.Value.Arg; + if (SizeOp->Common.AmlOpcode != AML_BYTE_OP) + { + return (FALSE); + } + + /* Check the declared BufferSize, two possibilities */ + + BufferSize = SizeOp->Common.Value.Integer; + if ((BufferSize != ACPI_PLD_REV1_BUFFER_SIZE) && + (BufferSize != ACPI_PLD_REV2_BUFFER_SIZE)) + { + return (FALSE); + } + + /* + * Check the initializer list length. This is the actual + * number of bytes in the buffer as counted by the AML parser. + * The declared BufferSize can be larger than the actual length. + * However, for the ToPLD macro, the BufferSize will be the same + * as the initializer list length. + */ + ByteListOp = SizeOp->Common.Next; + if (!ByteListOp) + { + return (FALSE); /* Zero-length buffer case */ + } + + InitializerSize = ByteListOp->Common.Value.Integer; + if ((InitializerSize != ACPI_PLD_REV1_BUFFER_SIZE) && + (InitializerSize != ACPI_PLD_REV2_BUFFER_SIZE)) + { + return (FALSE); + } + + /* Final size check */ + + if (BufferSize != InitializerSize) + { + return (FALSE); + } + + /* Now examine the buffer parent */ ParentOp = Op->Common.Parent; if (!ParentOp) @@ -571,8 +620,17 @@ AcpiDmIsPldBuffer ( return (FALSE); } - /* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */ - + /* + * Check for proper form: Name(_PLD, Package() {ToPLD()}) + * + * Note: All other forms such as + * Return (Package() {ToPLD()}) + * Local0 = ToPLD() + * etc. are not converted back to the ToPLD macro, because + * there is really no deterministic way to disassemble the buffer + * back to the ToPLD macro, other than trying to find the "_PLD" + * name + */ if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP) { ParentOp = ParentOp->Common.Parent; Modified: vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/disassembler/dmcstyle.c Fri Sep 30 19:46:13 2016 (r306523) @@ -98,6 +98,9 @@ AcpiDmCheckForSymbolicOpcode ( ACPI_PARSE_OBJECT *Child1; ACPI_PARSE_OBJECT *Child2; ACPI_PARSE_OBJECT *Target; + ACPI_PARSE_OBJECT *GrandChild1; + ACPI_PARSE_OBJECT *GrandChild2; + ACPI_PARSE_OBJECT *GrandTarget = NULL; /* Exit immediately if ASL+ not enabled */ @@ -107,6 +110,14 @@ AcpiDmCheckForSymbolicOpcode ( return (FALSE); } + /* Check for a non-ASL+ statement, propagate the flag */ + + if (Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + /* Get the first operand */ Child1 = AcpiPsGetArg (Op, 0); @@ -323,6 +334,7 @@ AcpiDmCheckForSymbolicOpcode ( if (AcpiDmIsValidTarget (Target)) { Child1->Common.OperatorSymbol = NULL; + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; return (FALSE); } @@ -339,6 +351,13 @@ AcpiDmCheckForSymbolicOpcode ( if (!AcpiDmIsValidTarget (Target)) { + if (Op->Common.Parent->Common.AmlOpcode == AML_STORE_OP) + { + Op->Common.DisasmFlags = 0; + Child1->Common.OperatorSymbol = NULL; + return (FALSE); + } + /* Not a valid target (placeholder only, from parser) */ break; } @@ -478,6 +497,69 @@ AcpiDmCheckForSymbolicOpcode ( /* * Target is the 2nd operand. * We know the target is valid, it is not optional. + * + * The following block implements "Ignore conversion if a store + * is followed by a math/bit operator that has no target". Used + * only for the ASL test suite. + */ + if (!AcpiGbl_DoDisassemblerOptimizations) + { + switch (Child1->Common.AmlOpcode) + { + /* This operator has two operands and two targets */ + + case AML_DIVIDE_OP: + + GrandChild1 = Child1->Common.Value.Arg; + GrandChild2 = GrandChild1->Common.Next; + GrandTarget = GrandChild2->Common.Next; + + if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + GrandTarget = GrandTarget->Common.Next; + break; + + case AML_ADD_OP: + case AML_SUBTRACT_OP: + case AML_MULTIPLY_OP: + case AML_MOD_OP: + case AML_SHIFT_LEFT_OP: + case AML_SHIFT_RIGHT_OP: + case AML_BIT_AND_OP: + case AML_BIT_OR_OP: + case AML_BIT_XOR_OP: + case AML_INDEX_OP: + + /* These operators have two operands and a target */ + + GrandChild1 = Child1->Common.Value.Arg; + GrandChild2 = GrandChild1->Common.Next; + GrandTarget = GrandChild2->Common.Next; + break; + + case AML_BIT_NOT_OP: + + /* This operator has one operand and a target */ + + GrandChild1 = Child1->Common.Value.Arg; + GrandTarget = GrandChild1->Common.Next; + break; + + default: + break; + } + + if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY; + return (FALSE); + } + } + + /* * In the parse tree, simply swap the target with the * source so that the target is processed first. */ @@ -563,6 +645,7 @@ AcpiDmCloseOperator ( { BOOLEAN IsCStyleOp = FALSE; + /* Always emit paren if ASL+ disassembly disabled */ if (!AcpiGbl_CstyleDisassembly) @@ -571,6 +654,14 @@ AcpiDmCloseOperator ( return; } + /* Check for a non-ASL+ statement */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY) + { + AcpiOsPrintf (")"); + return; + } + /* Check if we need to add an additional closing paren */ switch (Op->Common.AmlOpcode) Modified: vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c Fri Sep 30 19:46:13 2016 (r306523) @@ -64,6 +64,10 @@ static void AcpiDmConvertToElseIf ( ACPI_PARSE_OBJECT *Op); +static void +AcpiDmPromoteSubtree ( + ACPI_PARSE_OBJECT *StartOp); + /******************************************************************************* * @@ -1067,12 +1071,22 @@ AcpiDmConvertToElseIf ( * be the only blocks under the original Else. */ IfOp = OriginalElseOp->Common.Value.Arg; + if (!IfOp || (IfOp->Common.AmlOpcode != AML_IF_OP) || (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP))) { - /* Not an Else..If sequence, cannot convert to ElseIf */ + /* Not a proper Else..If sequence, cannot convert to ElseIf */ + + AcpiOsPrintf ("%s", "Else"); + return; + } + + /* Cannot have anything following the If...Else block */ + ElseOp = IfOp->Common.Next; + if (ElseOp && ElseOp->Common.Next) + { AcpiOsPrintf ("%s", "Else"); return; } @@ -1100,7 +1114,10 @@ AcpiDmConvertToElseIf ( /* If an ELSE matches the IF, promote it also */ ElseOp->Common.Parent = OriginalElseOp->Common.Parent; - ElseOp->Common.Next = OriginalElseOp->Common.Next; + + /* Promote the entire block under the ElseIf (All Next OPs) */ + + AcpiDmPromoteSubtree (OriginalElseOp); } else { @@ -1122,3 +1139,48 @@ AcpiDmConvertToElseIf ( OriginalElseOp->Common.Next = IfOp; } + + +/******************************************************************************* + * + * FUNCTION: AcpiDmPromoteSubtree + * + * PARAMETERS: StartOpOp - Original parent of the entire subtree + * + * RETURN: None + * + * DESCRIPTION: Promote an entire parse subtree up one level. + * + ******************************************************************************/ + +static void +AcpiDmPromoteSubtree ( + ACPI_PARSE_OBJECT *StartOp) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_PARSE_OBJECT *ParentOp; + + + /* New parent for subtree elements */ + + ParentOp = StartOp->Common.Parent; + + /* First child starts the subtree */ + + Op = StartOp->Common.Value.Arg; + + /* Walk the top-level elements of the subtree */ + + while (Op) + { + Op->Common.Parent = ParentOp; + if (!Op->Common.Next) + { + /* Last Op in list, update its next field */ + + Op->Common.Next = StartOp->Common.Next; + break; + } + Op = Op->Common.Next; + } +} Modified: vendor-sys/acpica/dist/source/components/disassembler/dmresrcl.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmresrcl.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/disassembler/dmresrcl.c Fri Sep 30 19:46:13 2016 (r306523) @@ -443,16 +443,17 @@ AcpiDmIoFlags2 ( UINT8 SpecificFlags) { + /* _TTP */ + AcpiOsPrintf (", %s", AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]); - /* TRS is only used if TTP is TypeTranslation */ - - if (SpecificFlags & 0x10) - { - AcpiOsPrintf (", %s", - AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); - } + /* + * TRS is only used if TTP is TypeTranslation. However, the disassembler + * always emits exactly what is in the AML. + */ + AcpiOsPrintf (", %s", + AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]); } Modified: vendor-sys/acpica/dist/source/components/executer/exconfig.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exconfig.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/executer/exconfig.c Fri Sep 30 19:46:13 2016 (r306523) @@ -581,11 +581,18 @@ AcpiExUnloadTable ( TableIndex = TableDesc->Reference.Value; + /* + * Release the interpreter lock so that the table lock won't have + * strict order requirement against it. + */ + AcpiExExitInterpreter (); + /* Ensure the table is still loaded */ if (!AcpiTbIsTableLoaded (TableIndex)) { - return_ACPI_STATUS (AE_NOT_EXIST); + Status = AE_NOT_EXIST; + goto LockAndExit; } /* Invoke table handler if present */ @@ -605,16 +612,25 @@ AcpiExUnloadTable ( Status = AcpiTbDeleteNamespaceByOwner (TableIndex); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto LockAndExit; } (void) AcpiTbReleaseOwnerId (TableIndex); AcpiTbSetTableLoadedFlag (TableIndex, FALSE); +LockAndExit: + + /* Re-acquire the interpreter lock */ + + AcpiExEnterInterpreter (); + /* * Invalidate the handle. We do this because the handle may be stored * in a named object and may not be actually deleted until much later. */ - DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; - return_ACPI_STATUS (AE_OK); + if (ACPI_SUCCESS (Status)) + { + DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; + } + return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/parser/psxface.c ============================================================================== --- vendor-sys/acpica/dist/source/components/parser/psxface.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/parser/psxface.c Fri Sep 30 19:46:13 2016 (r306523) @@ -334,6 +334,18 @@ AcpiPsExecuteTable ( WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; } + /* Info->Node is the default location to load the table */ + + if (Info->Node && Info->Node != AcpiGbl_RootNode) + { + Status = AcpiDsScopeStackPush ( + Info->Node, ACPI_TYPE_METHOD, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } + /* * Parse the AML, WalkState will be deleted by ParseAml */ Modified: vendor-sys/acpica/dist/source/components/tables/tbdata.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbdata.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/tables/tbdata.c Fri Sep 30 19:46:13 2016 (r306523) @@ -681,18 +681,13 @@ AcpiTbDeleteNamespaceByOwner ( * lock may block, and also since the execution of a namespace walk * must be allowed to use the interpreter. */ - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); - - AcpiNsDeleteNamespaceByOwner (OwnerId); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - + AcpiNsDeleteNamespaceByOwner (OwnerId); AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); - - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/tables/tbfind.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbfind.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/tables/tbfind.c Fri Sep 30 19:46:13 2016 (r306523) @@ -156,5 +156,5 @@ AcpiTbFindTable ( UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (AE_NOT_FOUND); + return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/tables/tbxfload.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbxfload.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/tables/tbxfload.c Fri Sep 30 19:46:13 2016 (r306523) @@ -262,7 +262,7 @@ AcpiTbLoadNamespace ( if (!TablesFailed) { ACPI_INFO (( - "%u ACPI AML tables successfully acquired and loaded\n", + "%u ACPI AML tables successfully acquired and loaded", TablesLoaded)); } else @@ -276,6 +276,11 @@ AcpiTbLoadNamespace ( Status = AE_CTRL_TERMINATE; } +#ifdef ACPI_APPLICATION + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\n")); +#endif + + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); @@ -423,9 +428,9 @@ AcpiUnloadParentTable ( return_ACPI_STATUS (AE_TYPE); } - /* Must acquire the interpreter lock during this operation */ + /* Must acquire the table lock during this operation */ - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); + Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -456,9 +461,11 @@ AcpiUnloadParentTable ( /* Ensure the table is actually loaded */ + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (!AcpiTbIsTableLoaded (i)) { Status = AE_NOT_EXIST; + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); break; } @@ -485,10 +492,11 @@ AcpiUnloadParentTable ( Status = AcpiTbReleaseOwnerId (i); AcpiTbSetTableLoadedFlag (i, FALSE); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); break; } - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/components/utilities/utstrtoul64.c Fri Sep 30 19:46:13 2016 (r306523) @@ -85,7 +85,7 @@ AcpiUtStrtoulBase16 ( * The integer is initialized to the value zero. * The ASCII string is interpreted as a hexadecimal constant. * - * 1) A “0x” prefix is not allowed. However, ACPICA allows this for + * 1) A "0x" prefix is not allowed. However, ACPICA allows this for * compatibility with previous ACPICA. (NO ERROR) * * 2) Terminates when the size of an integer is reached (32 or 64 bits). Modified: vendor-sys/acpica/dist/source/include/acconfig.h ============================================================================== --- vendor-sys/acpica/dist/source/include/acconfig.h Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/include/acconfig.h Fri Sep 30 19:46:13 2016 (r306523) @@ -148,7 +148,7 @@ /* Maximum number of While() loops before abort */ -#define ACPI_MAX_LOOP_COUNT 0xFFFF +#define ACPI_MAX_LOOP_COUNT 0x000FFFFF /****************************************************************************** Modified: vendor-sys/acpica/dist/source/include/acglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/include/acglobal.h Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/include/acglobal.h Fri Sep 30 19:46:13 2016 (r306523) @@ -245,10 +245,6 @@ ACPI_INIT_GLOBAL (UINT32, ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); -/* Maximum number of While() loop iterations before forced abort */ - -ACPI_GLOBAL (UINT16, AcpiGbl_MaxLoopIterations); - /* Control method single step flag */ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); @@ -322,6 +318,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, 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_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); Modified: vendor-sys/acpica/dist/source/include/aclocal.h ============================================================================== --- vendor-sys/acpica/dist/source/include/aclocal.h Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/include/aclocal.h Fri Sep 30 19:46:13 2016 (r306523) @@ -917,7 +917,7 @@ typedef union acpi_parse_value ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ UINT8 ArgListLength; /* Number of elements in the arg list */\ ACPI_DISASM_ONLY_MEMBERS (\ - UINT8 DisasmFlags; /* Used during AML disassembly */\ + UINT16 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ char *OperatorSymbol;/* Used for C-style operator name strings */\ char AmlOpName[16]) /* Op name (debug only) */ @@ -1037,14 +1037,15 @@ typedef struct acpi_parse_state /* Parse object DisasmFlags */ -#define ACPI_PARSEOP_IGNORE 0x01 -#define ACPI_PARSEOP_PARAMETER_LIST 0x02 -#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 -#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08 -#define ACPI_PARSEOP_CLOSING_PAREN 0x10 -#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20 -#define ACPI_PARSEOP_ASSIGNMENT 0x40 -#define ACPI_PARSEOP_ELSEIF 0x80 +#define ACPI_PARSEOP_IGNORE 0x0001 +#define ACPI_PARSEOP_PARAMETER_LIST 0x0002 +#define ACPI_PARSEOP_EMPTY_TERMLIST 0x0004 +#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x0008 +#define ACPI_PARSEOP_CLOSING_PAREN 0x0010 +#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x0020 +#define ACPI_PARSEOP_ASSIGNMENT 0x0040 +#define ACPI_PARSEOP_ELSEIF 0x0080 +#define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100 /***************************************************************************** Modified: vendor-sys/acpica/dist/source/include/acpixf.h ============================================================================== --- vendor-sys/acpica/dist/source/include/acpixf.h Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/include/acpixf.h Fri Sep 30 19:46:13 2016 (r306523) @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20160831 +#define ACPI_CA_VERSION 0x20160930 #include "acconfig.h" #include "actypes.h" @@ -261,6 +261,13 @@ ACPI_INIT_GLOBAL (UINT8, Acpi ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); /* + * Maximum number of While() loop iterations before forced method abort. + * This mechanism is intended to prevent infinite loops during interpreter + * execution within a host kernel. + */ +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_COUNT); + +/* * This mechanism is used to trace a specified AML method. The method is * traced each time it is executed. */ Modified: vendor-sys/acpica/dist/source/include/platform/acmacosx.h ============================================================================== --- vendor-sys/acpica/dist/source/include/platform/acmacosx.h Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/include/platform/acmacosx.h Fri Sep 30 19:46:13 2016 (r306523) @@ -47,7 +47,6 @@ #include "aclinux.h" #ifdef __APPLE__ -#define sem_destroy sem_close #define ACPI_USE_ALTERNATE_TIMEOUT #endif /* __APPLE__ */ Modified: vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c ============================================================================== --- vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c Fri Sep 30 19:46:13 2016 (r306523) @@ -754,8 +754,12 @@ AcpiOsCreateSemaphore ( #ifdef __APPLE__ { - char *SemaphoreName = tmpnam (NULL); + static int SemaphoreCount = 0; + char SemaphoreName[32]; + snprintf (SemaphoreName, sizeof (SemaphoreName), "acpi_sem_%d", + SemaphoreCount++); + printf ("%s\n", SemaphoreName); Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits); if (!Sem) { @@ -807,10 +811,17 @@ AcpiOsDeleteSemaphore ( return (AE_BAD_PARAMETER); } +#ifdef __APPLE__ + if (sem_close (Sem) == -1) + { + return (AE_BAD_PARAMETER); + } +#else if (sem_destroy (Sem) == -1) { return (AE_BAD_PARAMETER); } +#endif return (AE_OK); } Modified: vendor-sys/acpica/dist/source/tools/acpibin/abcompare.c ============================================================================== --- vendor-sys/acpica/dist/source/tools/acpibin/abcompare.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/tools/acpibin/abcompare.c Fri Sep 30 19:46:13 2016 (r306523) @@ -433,7 +433,7 @@ AbCompareAmlFiles ( { if (Char1 != Char2) { - printf ("Error - Byte mismatch at offset %8.8X: 0x%2.2X 0x%2.2X\n", + printf ("Error - Byte mismatch at offset %8.4X: 0x%2.2X 0x%2.2X\n", Offset, Char1, Char2); Mismatches++; if (Mismatches > 100) @@ -471,7 +471,10 @@ AbCompareAmlFiles ( } printf ("%u Mismatches found\n", Mismatches); - Status = 0; + if (Mismatches == 0) + { + Status = 0; + } Exit2: fclose (File2); Modified: vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c ============================================================================== --- vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c Fri Sep 30 19:46:13 2016 (r306523) @@ -542,7 +542,7 @@ main ( /* Get all ACPI AML tables in this file */ Status = AcGetAllTablesFromFile (argv[AcpiGbl_Optind], - ACPI_GET_ONLY_AML_TABLES, &ListHead); + ACPI_GET_ALL_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { ExitCode = -1; Modified: vendor-sys/acpica/dist/source/tools/acpinames/anmain.c ============================================================================== --- vendor-sys/acpica/dist/source/tools/acpinames/anmain.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/tools/acpinames/anmain.c Fri Sep 30 19:46:13 2016 (r306523) @@ -176,7 +176,7 @@ main ( /* Get all ACPI AML tables in this file */ Status = AcGetAllTablesFromFile (argv[AcpiGbl_Optind], - ACPI_GET_ONLY_AML_TABLES, &ListHead); + ACPI_GET_ALL_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { return (-1); Modified: vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c ============================================================================== --- vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c Fri Sep 30 19:21:02 2016 (r306522) +++ vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c Fri Sep 30 19:46:13 2016 (r306523) @@ -321,7 +321,7 @@ AsConvertFile ( ConditionalTable = ConversionTable->SourceConditionalTable; StructTable = ConversionTable->SourceStructTable; SpecialMacroTable = ConversionTable->SourceSpecialMacroTable; - break; + break; case FILE_TYPE_HEADER: