From owner-svn-src-all@freebsd.org Fri Oct 9 05:27:08 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF7B24391D1; Fri, 9 Oct 2020 05:27:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C6xQh67sqz3dtb; Fri, 9 Oct 2020 05:27:08 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B599614561; Fri, 9 Oct 2020 05:27:08 +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 0995R8Kq075040; Fri, 9 Oct 2020 05:27:08 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0995R27I075009; Fri, 9 Oct 2020 05:27:02 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202010090527.0995R27I075009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 9 Oct 2020 05:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366562 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/events components/executer components/namespace components/parser comp... 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/events components/executer components/namespace components/parser components/utilities include X-SVN-Commit-Revision: 366562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2020 05:27:09 -0000 Author: jkim Date: Fri Oct 9 05:27:02 2020 New Revision: 366562 URL: https://svnweb.freebsd.org/changeset/base/366562 Log: MFV: r366539 Merge ACPICA 20200925. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/ahpredef.c head/sys/contrib/dev/acpica/common/ahuuids.c head/sys/contrib/dev/acpica/common/dmtbinfo1.c head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslprepkg.c head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/aslxref.c head/sys/contrib/dev/acpica/components/debugger/dbexec.c head/sys/contrib/dev/acpica/components/debugger/dbinput.c head/sys/contrib/dev/acpica/components/debugger/dbmethod.c head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c head/sys/contrib/dev/acpica/components/events/evrgnini.c head/sys/contrib/dev/acpica/components/executer/exregion.c head/sys/contrib/dev/acpica/components/namespace/nsalloc.c head/sys/contrib/dev/acpica/components/namespace/nsarguments.c head/sys/contrib/dev/acpica/components/namespace/nsxfobj.c head/sys/contrib/dev/acpica/components/parser/psparse.c head/sys/contrib/dev/acpica/components/utilities/utpredef.c head/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/acexcep.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/include/actbl1.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acuuid.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/changes.txt Fri Oct 9 05:27:02 2020 (r366562) @@ -1,6 +1,80 @@ ---------------------------------------- +25 September 2020. Summary of changes for version 20200925: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Preserve memory opregion mappings. The ACPICA's strategy with respect to +the handling of memory mappings associated with memory operation regions +is to avoid mapping the entire region at once which may be problematic at +least in principle (for example, it may lead to conflicts with +overlapping mappings having different attributes created by drivers). It +may also be wasteful, because memory opregions on some systems take up +vastchunks of address space while the fields in those regions actually +accessed by AML are sparsely distributed. + +For this reason, a one-page "window" is mapped for a given opregion on +the first memory access through it and if that "window" does not cover an +address range accessed through that opregion subsequently, it is unmapped +and a new "window" is mapped to replace it. Next, if the new "window" is +not sufficient to access memory through the opregion in question in the +future, it will be replaced with yet another "window" and so on. That +may lead to a suboptimal sequence of memory mapping and unmapping +operations, for example if two fields in one opregion separated from each +other by a sufficiently wide chunk of unused address space are accessed +in an alternating pattern. + +Added support for 64 bit risc-v compilation. Useful for acpica tools and +incorporating ACPICA into the Firmware Test Suite. Colin Ian King +. + +Added support for SMBus predefined names (from SMBus Control Method +Interface Specification, Version 1.0, December 10, 1999. New predefined +names: + _SBA + _SBI + _SBR + _SBT + _SBW + +AML Disassembler: Added a new command, "All Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); + Node->Type = TargetNode->Type; + if (Node->Type == ACPI_TYPE_METHOD) + { + /* Save the parameter count for methods */ + + Node->Value = TargetNode->Value; + } } return (AE_OK); Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri Oct 9 05:27:02 2020 (r366562) @@ -381,6 +381,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_DUPLICATE_EXTERN_MISMATCH */ "Type mismatch between multiple external declarations detected", /* ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:", /* ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration", +/* ASL_MSG_EXTERNAL_FOUND_HERE */ "External declaration below ", +/* ASL_MSG_LOWER_CASE_NAMESEG */ "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case", +/* ASL_MSG_LOWER_CASE_NAMEPATH */ "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case", }; /* Table compiler */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri Oct 9 05:27:02 2020 (r366562) @@ -383,6 +383,9 @@ typedef enum ASL_MSG_DUPLICATE_EXTERN_MISMATCH, ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL, + ASL_MSG_EXTERNAL_FOUND_HERE, + ASL_MSG_LOWER_CASE_NAMESEG, + ASL_MSG_LOWER_CASE_NAMEPATH, /* These messages are used by the Data Table compiler only */ Modified: head/sys/contrib/dev/acpica/compiler/aslparseop.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslparseop.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslparseop.c Fri Oct 9 05:27:02 2020 (r366562) @@ -388,6 +388,8 @@ TrCreateValuedLeafOp ( UINT64 Value) { ACPI_PARSE_OBJECT *Op; + UINT32 i; + char *StringPtr = NULL; Op = TrAllocateOp (ParseOpcode); @@ -408,11 +410,35 @@ TrCreateValuedLeafOp ( case PARSEOP_NAMESEG: + /* Check for mixed case (or all lower case). Issue a remark in this case */ + + for (i = 0; i < ACPI_NAMESEG_SIZE; i++) + { + if (islower (Op->Asl.Value.Name[i])) + { + AcpiUtStrupr (&Op->Asl.Value.Name[i]); + AslError (ASL_REMARK, ASL_MSG_LOWER_CASE_NAMESEG, Op, Op->Asl.Value.Name); + break; + } + } DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Op->Asl.Value.String); break; case PARSEOP_NAMESTRING: + /* Check for mixed case (or all lower case). Issue a remark in this case */ + + StringPtr = Op->Asl.Value.Name; + for (i = 0; *StringPtr; i++) + { + if (islower (*StringPtr)) + { + AcpiUtStrupr (&Op->Asl.Value.Name[i]); + AslError (ASL_REMARK, ASL_MSG_LOWER_CASE_NAMEPATH, Op, Op->Asl.Value.Name); + break; + } + StringPtr++; + } DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Op->Asl.Value.String); break; Modified: head/sys/contrib/dev/acpica/compiler/aslprepkg.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Oct 9 05:27:02 2020 (r366562) @@ -318,6 +318,17 @@ ApCheckPackage ( */ for (i = 0; i < Count; i++) { + if (!Op) + { + /* + * If we get to this point, it means that the package length + * is larger than the initializer list. Stop processing the + * package and return because we have run out of package + * elements to analyze. + */ + return; + } + ApCheckObjectType (Predefined->Info.Name, Op, Package->RetInfo.ObjectType1, i); Op = Op->Asl.Next; @@ -917,7 +928,7 @@ ApPackageTooSmall ( UINT32 ExpectedCount) { - sprintf (AslGbl_MsgBuffer, "%s: length %u, required minimum is %u", + sprintf (AslGbl_MsgBuffer, "%4.4s: length %u, required minimum is %u", PredefinedName, Count, ExpectedCount); AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); @@ -946,7 +957,7 @@ ApZeroLengthPackage ( ACPI_PARSE_OBJECT *Op) { - sprintf (AslGbl_MsgBuffer, "%s: length is zero", PredefinedName); + sprintf (AslGbl_MsgBuffer, "%4.4s: length is zero", PredefinedName); AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); } @@ -975,7 +986,7 @@ ApPackageTooLarge ( UINT32 ExpectedCount) { - sprintf (AslGbl_MsgBuffer, "%s: length is %u, only %u required", + sprintf (AslGbl_MsgBuffer, "%4.4s: length is %u, only %u required", PredefinedName, Count, ExpectedCount); AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, AslGbl_MsgBuffer); Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslutils.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslutils.c Fri Oct 9 05:27:02 2020 (r366562) @@ -1074,14 +1074,16 @@ UtDoConstant ( { ACPI_STATUS Status; UINT64 ConvertedInteger; - char ErrBuf[64]; + char ErrBuf[128]; + const ACPI_EXCEPTION_INFO *ExceptionInfo; Status = AcpiUtStrtoul64 (String, &ConvertedInteger); if (ACPI_FAILURE (Status)) { - sprintf (ErrBuf, "While creating 64-bit constant: %s\n", - AcpiFormatException (Status)); + ExceptionInfo = AcpiUtValidateException ((ACPI_STATUS) Status); + sprintf (ErrBuf, " %s while converting to 64-bit integer", + ExceptionInfo->Description); AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, AslGbl_CurrentLineOffset, Modified: head/sys/contrib/dev/acpica/compiler/aslxref.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslxref.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/compiler/aslxref.c Fri Oct 9 05:27:02 2020 (r366562) @@ -433,6 +433,7 @@ XfNamespaceLocateBegin ( UINT32 i; ACPI_NAMESPACE_NODE *DeclarationParentMethod; ACPI_PARSE_OBJECT *ReferenceParentMethod; + char *ExternalPath; ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op); @@ -1263,7 +1264,15 @@ XfNamespaceLocateBegin ( Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_CONDREFOF && !XfRefIsGuardedByIfCondRefOf (Node, Op)) { - AslError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL); + ExternalPath = AcpiNsGetNormalizedPathname (Node, TRUE); + sprintf (AslGbl_MsgBuffer, "full path of external object: %s", + ExternalPath); + AslDualParseOpError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL, + ASL_MSG_EXTERNAL_FOUND_HERE, Node->Op, AslGbl_MsgBuffer); + if (ExternalPath) + { + ACPI_FREE (ExternalPath); + } } /* 5) Check for a connection object */ Modified: head/sys/contrib/dev/acpica/components/debugger/dbexec.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Oct 9 05:27:02 2020 (r366562) @@ -252,7 +252,8 @@ AcpiDbDeleteObjects ( * * RETURN: Status * - * DESCRIPTION: Execute a control method. + * DESCRIPTION: Execute a control method. Used to evaluate objects via the + * "EXECUTE" or "EVALUATE" commands. * ******************************************************************************/ @@ -504,11 +505,12 @@ AcpiDbExecutionWalk ( Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); + AcpiGbl_MethodExecuting = FALSE; + AcpiOsPrintf ("Evaluation of [%4.4s] returned %s\n", AcpiUtGetNodeName (Node), AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; return (AE_OK); } @@ -525,7 +527,8 @@ AcpiDbExecutionWalk ( * RETURN: None * * DESCRIPTION: Execute a control method. Name is relative to the current - * scope. + * scope. Function used for the "EXECUTE", "EVALUATE", and + * "ALL" commands * ******************************************************************************/ @@ -569,6 +572,12 @@ AcpiDbExecute ( return; } + if ((Flags & EX_ALL) && (strlen (Name) > 4)) + { + AcpiOsPrintf ("Input name (%s) must be a 4-char NameSeg\n", Name); + return; + } + NameString = ACPI_ALLOCATE (strlen (Name) + 1); if (!NameString) { @@ -588,14 +597,28 @@ AcpiDbExecute ( return; } - AcpiGbl_DbMethodInfo.Name = NameString; - AcpiGbl_DbMethodInfo.Args = Args; - AcpiGbl_DbMethodInfo.Types = Types; - AcpiGbl_DbMethodInfo.Flags = Flags; + /* Command (ALL ) to execute all methods of a particular name */ - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + else if (Flags & EX_ALL) + { + AcpiGbl_DbMethodInfo.Name = NameString; + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + AcpiDbEvaluateAll (NameString); + ACPI_FREE (NameString); + return; + } + else + { + AcpiGbl_DbMethodInfo.Name = NameString; + AcpiGbl_DbMethodInfo.Args = Args; + AcpiGbl_DbMethodInfo.Types = Types; + AcpiGbl_DbMethodInfo.Flags = Flags; + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + } + Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); if (ACPI_FAILURE (Status)) { @@ -655,6 +678,7 @@ AcpiDbExecute ( (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); + AcpiOsPrintf ("\n"); /* Dump a _PLD buffer if present */ Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbinput.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c Fri Oct 9 05:27:02 2020 (r366562) @@ -195,6 +195,7 @@ enum AcpiExDebuggerCommands { CMD_NOT_FOUND = 0, CMD_NULL, + CMD_ALL, CMD_ALLOCATIONS, CMD_ARGS, CMD_ARGUMENTS, @@ -275,6 +276,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands { {"", 0}, {"", 0}, + {"ALL", 1}, {"ALLOCATIONS", 0}, {"ARGS", 0}, {"ARGUMENTS", 0}, @@ -377,6 +379,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandH {1, " Type ", "Display object type\n"}, {0, "\nControl Method Execution:", "\n"}, + {1, " All ", "Evaluate all objects named NameSeg\n"}, {1, " Evaluate [Arguments]", "Evaluate object or control method\n"}, {1, " Execute [Arguments]", "Synonym for Evaluate\n"}, #ifdef ACPI_APPLICATION @@ -599,7 +602,7 @@ AcpiDbDisplayHelp ( } else { - /* Display help for all commands that match the subtring */ + /* Display help for all commands that match the substring */ AcpiDbDisplayCommandInfo (Command, TRUE); } @@ -945,6 +948,13 @@ AcpiDbCommandDispatch ( { return (AE_OK); } + break; + + case CMD_ALL: + + AcpiOsPrintf ("Executing all objects with NameSeg: %s\n", AcpiGbl_DbArgs[1]); + AcpiDbExecute (AcpiGbl_DbArgs[1], + &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP | EX_ALL); break; case CMD_ALLOCATIONS: Modified: head/sys/contrib/dev/acpica/components/debugger/dbmethod.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Oct 9 05:27:02 2020 (r366562) @@ -170,7 +170,11 @@ AcpiDbWalkForExecute ( void *Context, void **ReturnValue); +static ACPI_STATUS +AcpiDbEvaluateObject ( + ACPI_NAMESPACE_NODE *Node); + /******************************************************************************* * * FUNCTION: AcpiDbSetMethodBreakpoint @@ -542,47 +546,30 @@ AcpiDbDisassembleMethod ( /******************************************************************************* * - * FUNCTION: AcpiDbWalkForExecute + * FUNCTION: AcpiDbEvaluateObject * - * PARAMETERS: Callback from WalkNamespace + * PARAMETERS: Node - Namespace node for the object * * RETURN: Status * - * DESCRIPTION: Batch execution module. Currently only executes predefined - * ACPI names. + * DESCRIPTION: Main execution function for the Evaluate/Execute/All debugger + * commands. * ******************************************************************************/ static ACPI_STATUS -AcpiDbWalkForExecute ( - ACPI_HANDLE ObjHandle, - UINT32 NestingLevel, - void *Context, - void **ReturnValue) +AcpiDbEvaluateObject ( + ACPI_NAMESPACE_NODE *Node) { - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; char *Pathname; UINT32 i; ACPI_DEVICE_INFO *ObjInfo; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - const ACPI_PREDEFINED_INFO *Predefined; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; - Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); - if (!Predefined) - { - return (AE_OK); - } - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - return (AE_OK); - } - Pathname = AcpiNsGetExternalPathname (Node); if (!Pathname) { @@ -591,7 +578,7 @@ AcpiDbWalkForExecute ( /* Get the object info for number of method parameters */ - Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); + Status = AcpiGetObjectInfo (Node, &ObjInfo); if (ACPI_FAILURE (Status)) { ACPI_FREE (Pathname); @@ -624,13 +611,70 @@ AcpiDbWalkForExecute ( AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); + AcpiGbl_MethodExecuting = FALSE; AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; + if (ReturnObj.Length) + { + AcpiOsPrintf ("Evaluation of %s returned object %p, " + "external buffer length %X\n", + Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); + + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); + AcpiOsPrintf ("\n"); + } + ACPI_FREE (Pathname); /* Ignore status from method execution */ + return (AE_OK); + + /* Update count, check if we have executed enough methods */ + +} + +/******************************************************************************* + * + * FUNCTION: AcpiDbWalkForExecute + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Batch execution function. Evaluates all "predefined" objects -- + * the nameseg begins with an underscore. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForExecute ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; + ACPI_STATUS Status; + const ACPI_PREDEFINED_INFO *Predefined; + + + Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); + if (!Predefined) + { + return (AE_OK); + } + + if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) + { + return (AE_OK); + } + + AcpiDbEvaluateObject (Node); + + /* Ignore status from object evaluation */ + Status = AE_OK; /* Update count, check if we have executed enough methods */ @@ -647,6 +691,56 @@ AcpiDbWalkForExecute ( /******************************************************************************* * + * FUNCTION: AcpiDbWalkForExecuteAll + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Batch execution function. Evaluates all objects whose path ends + * with the nameseg "Info->NameSeg". Used for the "ALL" command. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForExecuteAll ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; + ACPI_STATUS Status; + + + if (!ACPI_COMPARE_NAMESEG (Node->Name.Ascii, Info->NameSeg)) + { + return (AE_OK); + } + + if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) + { + return (AE_OK); + } + + /* Now evaluate the input object (node) */ + + AcpiDbEvaluateObject (Node); + + /* Ignore status from method execution */ + + Status = AE_OK; + + /* Update count of executed methods/objects */ + + Info->Count++; + return (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbEvaluatePredefinedNames * * PARAMETERS: None @@ -674,4 +768,39 @@ AcpiDbEvaluatePredefinedNames ( AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbEvaluateAll + * + * PARAMETERS: NoneAcpiGbl_DbMethodInfo + * + * RETURN: None + * + * DESCRIPTION: Namespace batch execution. Implements the "ALL" command. + * Execute all namepaths whose final nameseg matches the + * input nameseg. + * + ******************************************************************************/ + +void +AcpiDbEvaluateAll ( + char *NameSeg) +{ + ACPI_DB_EXECUTE_WALK Info; + + + Info.Count = 0; + Info.MaxCount = ACPI_UINT32_MAX; + ACPI_COPY_NAMESEG (Info.NameSeg, NameSeg); + Info.NameSeg[ACPI_NAMESEG_SIZE] = 0; + + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbWalkForExecuteAll, NULL, (void *) &Info, NULL); + + AcpiOsPrintf ("Evaluated %u names in the namespace\n", Info.Count); } Modified: head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c ============================================================================== --- head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c Fri Oct 9 05:27:02 2020 (r366562) @@ -494,6 +494,10 @@ AcpiDmUuid ( { AcpiOsPrintf (" /* %s */", Description); } + else + { + AcpiOsPrintf (" /* Unknown UUID */"); + } } Modified: head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c ============================================================================== --- head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c Fri Oct 9 05:27:02 2020 (r366562) @@ -744,7 +744,7 @@ AcpiDmIsOptimizationIgnored ( * Only a small subset of ASL/AML operators can be optimized. * Can only optimize/fold if there is no target (or targets) * specified for the operator. And of course, the operator - * is surrrounded by a Store() operator. + * is surrounded by a Store() operator. */ switch (StoreArgument->Common.AmlOpcode) { Modified: head/sys/contrib/dev/acpica/components/events/evrgnini.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evrgnini.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/events/evrgnini.c Fri Oct 9 05:27:02 2020 (r366562) @@ -183,6 +183,7 @@ AcpiEvSystemMemoryRegionSetup ( { ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle; ACPI_MEM_SPACE_CONTEXT *LocalRegionContext; + ACPI_MEM_MAPPING *Mm; ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup); @@ -194,12 +195,14 @@ AcpiEvSystemMemoryRegionSetup ( { LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext; - /* Delete a cached mapping if present */ + /* Delete memory mappings if present */ - if (LocalRegionContext->MappedLength) + while (LocalRegionContext->FirstMm) { - AcpiOsUnmapMemory (LocalRegionContext->MappedLogicalAddress, - LocalRegionContext->MappedLength); + Mm = LocalRegionContext->FirstMm; + LocalRegionContext->FirstMm = Mm->NextMm; + AcpiOsUnmapMemory(Mm->LogicalAddress, Mm->Length); + ACPI_FREE(Mm); } ACPI_FREE (LocalRegionContext); *RegionContext = NULL; Modified: head/sys/contrib/dev/acpica/components/executer/exregion.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exregion.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/executer/exregion.c Fri Oct 9 05:27:02 2020 (r366562) @@ -188,6 +188,7 @@ AcpiExSystemMemorySpaceHandler ( ACPI_STATUS Status = AE_OK; void *LogicalAddrPtr = NULL; ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; + ACPI_MEM_MAPPING *Mm = MemInfo->CurMm; UINT32 Length; ACPI_SIZE MapLength; ACPI_SIZE PageBoundaryMapLength; @@ -247,23 +248,48 @@ AcpiExSystemMemorySpaceHandler ( * Is 1) Address below the current mapping? OR * 2) Address beyond the current mapping? */ - if ((Address < MemInfo->MappedPhysicalAddress) || - (((UINT64) Address + Length) > - ((UINT64) - MemInfo->MappedPhysicalAddress + MemInfo->MappedLength))) + if (!Mm || (Address < Mm->PhysicalAddress) || + ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length)) { /* - * The request cannot be resolved by the current memory mapping; - * Delete the existing mapping and create a new one. + * The request cannot be resolved by the current memory mapping. + * + * Look for an existing saved mapping covering the address range + * at hand. If found, save it as the current one and carry out + * the access. */ - if (MemInfo->MappedLength) + for (Mm = MemInfo->FirstMm; Mm; Mm = Mm->NextMm) { - /* Valid mapping, delete it */ + if (Mm == MemInfo->CurMm) + { + continue; + } - AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress, - MemInfo->MappedLength); + if (Address < Mm->PhysicalAddress) + { + continue; + } + + if ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length) + { + continue; + } + + MemInfo->CurMm = Mm; + goto access; } + /* Create a new mappings list entry */ + + Mm = ACPI_ALLOCATE_ZEROED(sizeof(*Mm)); + if (!Mm) + { + ACPI_ERROR((AE_INFO, + "Unable to save memory mapping at 0x%8.8X%8.8X, size %u", + ACPI_FORMAT_UINT64(Address), Length)); + return_ACPI_STATUS(AE_NO_MEMORY); + } + /* * October 2009: Attempt to map from the requested address to the * end of the region. However, we will never map more than one @@ -297,28 +323,38 @@ AcpiExSystemMemorySpaceHandler ( /* Create a new mapping starting at the address given */ - MemInfo->MappedLogicalAddress = AcpiOsMapMemory (Address, MapLength); - if (!MemInfo->MappedLogicalAddress) + LogicalAddrPtr = AcpiOsMapMemory(Address, MapLength); + if (!LogicalAddrPtr) { ACPI_ERROR ((AE_INFO, "Could not map memory at 0x%8.8X%8.8X, size %u", ACPI_FORMAT_UINT64 (Address), (UINT32) MapLength)); - MemInfo->MappedLength = 0; + ACPI_FREE(Mm); return_ACPI_STATUS (AE_NO_MEMORY); } /* Save the physical address and mapping size */ - MemInfo->MappedPhysicalAddress = Address; - MemInfo->MappedLength = MapLength; + Mm->LogicalAddress = LogicalAddrPtr; + Mm->PhysicalAddress = Address; + Mm->Length = MapLength; + + /* + * Add the new entry to the mappigs list and save it as the + * current mapping. + */ + Mm->NextMm = MemInfo->FirstMm; + MemInfo->FirstMm = Mm; + MemInfo->CurMm = Mm; } +access: /* * Generate a logical pointer corresponding to the address we want to * access */ - LogicalAddrPtr = MemInfo->MappedLogicalAddress + - ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress); + LogicalAddrPtr = Mm->LogicalAddress + + ((UINT64) Address - (UINT64) Mm->PhysicalAddress); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", Modified: head/sys/contrib/dev/acpica/components/namespace/nsalloc.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsalloc.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/namespace/nsalloc.c Fri Oct 9 05:27:02 2020 (r366562) @@ -481,7 +481,7 @@ AcpiNsDeleteChildren ( NodeToDelete = NextNode; NextNode = NextNode->Peer; AcpiNsDeleteNode (NodeToDelete); - }; + } /* Clear the parent's child pointer */ Modified: head/sys/contrib/dev/acpica/components/namespace/nsarguments.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsarguments.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/namespace/nsarguments.c Fri Oct 9 05:27:02 2020 (r366562) @@ -205,7 +205,9 @@ AcpiNsCheckArgumentTypes ( ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); UserArgType = Info->Parameters[i]->Common.Type; - if (UserArgType != ArgType) + /* No typechecking for ACPI_TYPE_ANY */ + + if ((UserArgType != ArgType) && (ArgType != ACPI_TYPE_ANY)) { ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, "Argument #%u type mismatch - " Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfobj.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsxfobj.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/namespace/nsxfobj.c Fri Oct 9 05:27:02 2020 (r366562) @@ -169,7 +169,8 @@ * * RETURN: Status * - * DESCRIPTION: This routine returns the type associatd with a particular handle + * DESCRIPTION: This routine returns the type associated with a particular + * handle * ******************************************************************************/ Modified: head/sys/contrib/dev/acpica/components/parser/psparse.c ============================================================================== --- head/sys/contrib/dev/acpica/components/parser/psparse.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/parser/psparse.c Fri Oct 9 05:27:02 2020 (r366562) @@ -662,8 +662,8 @@ AcpiPsParseAml ( } /* - * If the transfer to the new method method call worked - *, a new walk state was created -- get it + * If the transfer to the new method method call worked, + * a new walk state was created -- get it */ WalkState = AcpiDsGetCurrentWalkState (Thread); continue; Modified: head/sys/contrib/dev/acpica/components/utilities/utpredef.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utpredef.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/utilities/utpredef.c Fri Oct 9 05:27:02 2020 (r366562) @@ -317,7 +317,7 @@ AcpiUtGetArgumentTypes ( static const char *UtExternalTypeNames[] = /* Indexed by ACPI_TYPE_* */ { - ", UNSUPPORTED-TYPE", + ", Type_ANY", ", Integer", ", String", ", Buffer", @@ -499,7 +499,7 @@ AcpiUtGetArgumentTypes ( { ThisArgumentType = METHOD_GET_NEXT_TYPE (ArgumentTypes); - if (!ThisArgumentType || (ThisArgumentType > METHOD_MAX_ARG_TYPE)) + if (ThisArgumentType > METHOD_MAX_ARG_TYPE) { printf ("**** Invalid argument type (%u) " "in predefined info structure\n", ThisArgumentType); Modified: head/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c Fri Oct 9 04:03:57 2020 (r366561) +++ head/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c Fri Oct 9 05:27:02 2020 (r366562) @@ -207,10 +207,16 @@ AcpiUtConvertOctalString ( while (*String) { - /* Character must be ASCII 0-7, otherwise terminate with no error */ - *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***