diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-11-10 17:54:38 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-11-10 17:54:38 +0000 |
| commit | e692a0ddd0131f04acfda4c63b1a4c0c805feef5 (patch) | |
| tree | 5c1c811fa437c871de8d5ea5d7a22ed7ed40b725 /source/components | |
| parent | 2c673001fb88105f2d160032c4d4b76cb518e37f (diff) | |
Notes
Diffstat (limited to 'source/components')
| -rw-r--r-- | source/components/debugger/dbexec.c | 124 | ||||
| -rw-r--r-- | source/components/debugger/dbinput.c | 197 | ||||
| -rw-r--r-- | source/components/dispatcher/dsfield.c | 27 | ||||
| -rw-r--r-- | source/components/dispatcher/dsobject.c | 3 | ||||
| -rw-r--r-- | source/components/dispatcher/dsutils.c | 3 | ||||
| -rw-r--r-- | source/components/dispatcher/dswload.c | 4 | ||||
| -rw-r--r-- | source/components/dispatcher/dswload2.c | 12 | ||||
| -rw-r--r-- | source/components/events/evregion.c | 11 | ||||
| -rw-r--r-- | source/components/namespace/nsconvert.c | 3 | ||||
| -rw-r--r-- | source/components/namespace/nsnames.c | 172 | ||||
| -rw-r--r-- | source/components/parser/psargs.c | 2 | ||||
| -rw-r--r-- | source/components/utilities/utdecode.c | 11 | ||||
| -rw-r--r-- | source/components/utilities/uterror.c | 78 | ||||
| -rw-r--r-- | source/components/utilities/utmutex.c | 7 | ||||
| -rw-r--r-- | source/components/utilities/utstrsuppt.c | 34 | ||||
| -rw-r--r-- | source/components/utilities/uttrack.c | 2 | ||||
| -rw-r--r-- | source/components/utilities/utxferror.c | 8 |
17 files changed, 564 insertions, 134 deletions
diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 0a00be81e0ba..76f4d9f11e4f 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -187,6 +187,10 @@ AcpiDbExecutionWalk ( void *Context, void **ReturnValue); +static void ACPI_SYSTEM_XFACE +AcpiDbSingleExecutionThread ( + void *Context); + /******************************************************************************* * @@ -366,7 +370,7 @@ AcpiDbExecuteSetup ( ACPI_FUNCTION_NAME (DbExecuteSetup); - /* Catenate the current scope to the supplied name */ + /* Concatenate the current scope to the supplied name */ Info->Pathname[0] = 0; if ((Info->Name[0] != '\\') && @@ -791,6 +795,124 @@ AcpiDbMethodThread ( /******************************************************************************* * + * FUNCTION: AcpiDbSingleExecutionThread + * + * PARAMETERS: Context - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Create one thread and execute a method + * + ******************************************************************************/ + +static void ACPI_SYSTEM_XFACE +AcpiDbSingleExecutionThread ( + void *Context) +{ + ACPI_DB_METHOD_INFO *Info = Context; + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + + + AcpiOsPrintf ("\n"); + + Status = AcpiDbExecuteMethod (Info, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s During evaluation of %s\n", + AcpiFormatException (Status), Info->Pathname); + return; + } + + /* Display a return object, if any */ + + if (ReturnObj.Length) + { + AcpiOsPrintf ("Evaluation of %s returned object %p, " + "external buffer length %X\n", + AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, + (UINT32) ReturnObj.Length); + + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); + } + + AcpiOsPrintf ("\nBackground thread completed\n%c ", + ACPI_DEBUGGER_COMMAND_PROMPT); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbCreateExecutionThread + * + * PARAMETERS: MethodNameArg - Control method to execute + * Arguments - Array of arguments to the method + * Types - Corresponding array of object types + * + * RETURN: None + * + * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles + * arguments passed on command line for control methods. + * + ******************************************************************************/ + +void +AcpiDbCreateExecutionThread ( + char *MethodNameArg, + char **Arguments, + ACPI_OBJECT_TYPE *Types) +{ + ACPI_STATUS Status; + UINT32 i; + + + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + AcpiGbl_DbMethodInfo.Name = MethodNameArg; + AcpiGbl_DbMethodInfo.InitArgs = 1; + AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments; + AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; + + /* Setup method arguments, up to 7 (0-6) */ + + for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *Arguments; i++) + { + AcpiGbl_DbMethodInfo.Arguments[i] = *Arguments; + Arguments++; + + AcpiGbl_DbMethodInfo.ArgTypes[i] = *Types; + Types++; + } + + Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Get the NS node, determines existence also */ + + Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, + &AcpiGbl_DbMethodInfo.Method); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s Could not get handle for %s\n", + AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname); + return; + } + + Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD, + AcpiDbSingleExecutionThread, &AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + AcpiOsPrintf ("\nBackground thread started\n"); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbCreateExecutionThreads * * PARAMETERS: NumThreadsArg - Number of threads to create diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index d3755f4fa43b..ae044bf5d934 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -258,6 +258,7 @@ enum AcpiExDebuggerCommands CMD_UNLOAD, CMD_TERMINATE, + CMD_BACKGROUND, CMD_THREADS, CMD_TEST, @@ -336,6 +337,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"UNLOAD", 1}, {"TERMINATE", 0}, + {"BACKGROUND", 1}, {"THREADS", 3}, {"TEST", 1}, @@ -346,102 +348,113 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = /* * Help for all debugger commands. First argument is the number of lines * of help to output for the command. + * + * Note: Some commands are not supported by the kernel-level version of + * the debugger. */ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = { - {0, "\nGeneral-Purpose Commands:", "\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {2, " Dump <Address>|<Namepath>", "\n"}, - {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, - {1, " Handlers", "Info about global handlers\n"}, - {1, " Help [Command]", "This help screen or individual command\n"}, - {1, " History", "Display command history buffer\n"}, - {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"}, - {1, " Locks", "Current status of internal mutexes\n"}, - {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"}, - {1, " Quit or Exit", "Exit this command\n"}, - {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {1, " Memory", "Dump internal memory lists\n"}, - {1, " Misc", "Namespace search and mutex stats\n"}, - {1, " Objects", "Summary of namespace objects\n"}, - {1, " Sizes", "Sizes for each of the internal objects\n"}, - {1, " Stack", "Display CPU stack usage\n"}, - {1, " Tables", "Info about current ACPI table(s)\n"}, - {1, " Tables", "Display info about loaded ACPI tables\n"}, - {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, - {1, " !!", "Execute last command again\n"}, - - {0, "\nNamespace Access Commands:", "\n"}, - {1, " Businfo", "Display system bus info\n"}, - {1, " Disassemble <Method>", "Disassemble a control method\n"}, - {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, - {1, " Integrity", "Validate namespace integrity\n"}, - {1, " Methods", "Display list of loaded control methods\n"}, - {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, - {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, - {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, - {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, - {1, " Paths", "Display full pathnames of namespace objects\n"}, - {1, " Predefined", "Check all predefined names\n"}, - {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"}, - {1, " References <Addr>", "Find all references to object at addr\n"}, - {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, - {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, - {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, - {1, " Type <Object>", "Display object type\n"}, + {0, "\nNamespace Access:", "\n"}, + {1, " Businfo", "Display system bus info\n"}, + {1, " Disassemble <Method>", "Disassemble a control method\n"}, + {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, + {1, " Integrity", "Validate namespace integrity\n"}, + {1, " Methods", "Display list of loaded control methods\n"}, + {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, + {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, + {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, + {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Paths", "Display full pathnames of namespace objects\n"}, + {1, " Predefined", "Check all predefined names\n"}, + {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"}, + {1, " References <Addr>", "Find all references to object at addr\n"}, + {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, + {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, + {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, + {1, " Type <Object>", "Display object type\n"}, - {0, "\nControl Method Execution Commands:","\n"}, - {1, " Arguments (or Args)", "Display method arguments\n"}, - {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, - {1, " Call", "Run to next control method invocation\n"}, - {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"}, - {6, " Evaluate", "Synonym for Execute\n"}, - {5, " Execute <Namepath> [Arguments]", "Execute control method\n"}, - {1, " Hex Integer", "Integer method argument\n"}, - {1, " \"Ascii String\"", "String method argument\n"}, - {1, " (Hex Byte List)", "Buffer method argument\n"}, - {1, " [Package Element List]", "Package method argument\n"}, - {5, " Execute predefined", "Execute all predefined (public) methods\n"}, - {1, " Go", "Allow method to run to completion\n"}, - {1, " Information", "Display info about the current method\n"}, - {1, " Into", "Step into (not over) a method call\n"}, - {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, - {1, " Locals", "Display method local variables\n"}, - {1, " Results", "Display method result stack\n"}, - {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, - {1, " Stop", "Terminate control method\n"}, - {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, - {1, " Enable", "Enable all messages\n"}, - {1, " Disable", "Disable tracing\n"}, - {1, " Method", "Enable method execution messages\n"}, - {1, " Opcode", "Enable opcode execution messages\n"}, - {1, " Tree", "Display control method calling tree\n"}, - {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, + {0, "\nControl Method Execution:", "\n"}, + {1, " Evaluate <Namepath> [Arguments]", "Evaluate object or control method\n"}, + {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"}, +#ifdef ACPI_APPLICATION + {1, " Background <Namepath> [Arguments]", "Evaluate object/method in a separate thread\n"}, + {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, +#endif + {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"}, + {7, " [Arguments] formats:", "Control method argument formats\n"}, + {1, " Hex Integer", "Integer\n"}, + {1, " \"Ascii String\"", "String\n"}, + {1, " (Hex Byte List)", "Buffer\n"}, + {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"}, + {1, " [Package Element List]", "Package\n"}, + {1, " [0x01 0x1234 \"string\"]", "Package example (3 elements)\n"}, + {0, "\nMiscellaneous:", "\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {2, " Dump <Address>|<Namepath>", "\n"}, + {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, + {1, " Handlers", "Info about global handlers\n"}, + {1, " Help [Command]", "This help screen or individual command\n"}, + {1, " History", "Display command history buffer\n"}, + {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"}, + {1, " Locks", "Current status of internal mutexes\n"}, + {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"}, + {1, " Quit or Exit", "Exit this command\n"}, + {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {1, " Memory", "Dump internal memory lists\n"}, + {1, " Misc", "Namespace search and mutex stats\n"}, + {1, " Objects", "Summary of namespace objects\n"}, + {1, " Sizes", "Sizes for each of the internal objects\n"}, + {1, " Stack", "Display CPU stack usage\n"}, + {1, " Tables", "Info about current ACPI table(s)\n"}, + {1, " Tables", "Display info about loaded ACPI tables\n"}, #ifdef ACPI_APPLICATION - {0, "\nHardware Simulation Commands:", "\n"}, - {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, - {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, - {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPE devices\n"}, - {1, " Sci", "Generate an SCI\n"}, - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, + {1, " Terminate", "Delete namespace and all internal objects\n"}, +#endif + {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, + {1, " !!", "Execute last command again\n"}, + + {0, "\nMethod and Namespace Debugging:", "\n"}, + {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, + {1, " Enable", "Enable all messages\n"}, + {1, " Disable", "Disable tracing\n"}, + {1, " Method", "Enable method execution messages\n"}, + {1, " Opcode", "Enable opcode execution messages\n"}, + {3, " Test <TestName>", "Invoke a debug test\n"}, + {1, " Objects", "Read/write/compare all namespace data objects\n"}, + {1, " Predefined", "Validate all ACPI predefined names (_STA, etc.)\n"}, + {1, " Execute predefined", "Execute all predefined (public) methods\n"}, - {0, "\nFile I/O Commands:", "\n"}, - {1, " Close", "Close debug output file\n"}, - {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, - {1, " Open <Output Filename>", "Open a file for debug output\n"}, - {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, + {0, "\nControl Method Single-Step Execution:","\n"}, + {1, " Arguments (or Args)", "Display method arguments\n"}, + {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, + {1, " Call", "Run to next control method invocation\n"}, + {1, " Go", "Allow method to run to completion\n"}, + {1, " Information", "Display info about the current method\n"}, + {1, " Into", "Step into (not over) a method call\n"}, + {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, + {1, " Locals", "Display method local variables\n"}, + {1, " Results", "Display method result stack\n"}, + {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, + {1, " Stop", "Terminate control method\n"}, + {1, " Tree", "Display control method calling tree\n"}, + {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, - {0, "\nUser Space Commands:", "\n"}, - {1, " Terminate", "Delete namespace and all internal objects\n"}, - {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, +#ifdef ACPI_APPLICATION + {0, "\nFile Operations:", "\n"}, + {1, " Close", "Close debug output file\n"}, + {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, + {1, " Open <Output Filename>", "Open a file for debug output\n"}, + {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, - {0, "\nDebug Test Commands:", "\n"}, - {3, " Test <TestName>", "Invoke a debug test\n"}, - {1, " Objects", "Read/write/compare all namespace data objects\n"}, - {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"}, + {0, "\nHardware Simulation:", "\n"}, + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, + {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPE devices\n"}, + {1, " Sci", "Generate an SCI\n"}, + {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, #endif {0, NULL, NULL} }; @@ -571,11 +584,15 @@ AcpiDbDisplayHelp ( { /* No argument to help, display help for all commands */ + AcpiOsPrintf ("\nSummary of AML Debugger Commands\n\n"); + while (Next->Invocation) { AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description); Next++; } + AcpiOsPrintf ("\n"); + } else { @@ -1258,6 +1275,12 @@ AcpiDbCommandDispatch ( /* AcpiInitialize (NULL); */ break; + case CMD_BACKGROUND: + + AcpiDbCreateExecutionThread (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], + &AcpiGbl_DbArgTypes[2]); + break; + case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index fe9d0605e58f..08ae5cafaaa9 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -340,7 +340,8 @@ AcpiDsCreateBufferField ( ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } } @@ -524,7 +525,8 @@ AcpiDsGetFieldNames ( WalkState, &Info->ConnectionNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Child->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -540,7 +542,8 @@ AcpiDsGetFieldNames ( WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + (char *) &Arg->Named.Name, Status); return_ACPI_STATUS (Status); } else @@ -639,7 +642,8 @@ AcpiDsCreateField ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -769,7 +773,8 @@ AcpiDsInitFieldObjects ( Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + (char *) &Arg->Named.Name, Status); if (Status != AE_ALREADY_EXISTS) { return_ACPI_STATUS (Status); @@ -834,7 +839,8 @@ AcpiDsCreateBankField ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -847,7 +853,8 @@ AcpiDsCreateBankField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } @@ -920,7 +927,8 @@ AcpiDsCreateIndexField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } @@ -932,7 +940,8 @@ AcpiDsCreateIndexField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 4cbd8f78877d..81dba55588d0 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -223,7 +223,8 @@ AcpiDsBuildInternalObject ( ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Op->Common.Value.String, Status); return_ACPI_STATUS (Status); } } diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 4688e16ec8f0..710c0b3c8570 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -732,7 +732,8 @@ AcpiDsCreateOperand ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (NameString, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + NameString, Status); } } diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index 8793c0ed1cf5..1ee7dd64a5a2 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -325,7 +325,7 @@ AcpiDsLoad1BeginOp ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); return_ACPI_STATUS (Status); } @@ -495,7 +495,7 @@ AcpiDsLoad1BeginOp ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); return_ACPI_STATUS (Status); } } diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 184f6aa367d2..36885b9723ee 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -304,10 +304,12 @@ AcpiDsLoad2BeginOp ( } else { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); } #else - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); #endif return_ACPI_STATUS (Status); } @@ -462,7 +464,8 @@ AcpiDsLoad2BeginOp ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); return_ACPI_STATUS (Status); } @@ -844,7 +847,8 @@ AcpiDsLoad2EndOp ( } else { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); } break; diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 454b26e9ae37..88edc2d66169 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -423,6 +423,17 @@ AcpiEvAddressSpaceDispatch ( { ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + + /* + * Special case for an EC timeout. These are seen so frequently + * that an additional error message is helpful + */ + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && + (Status == AE_TIME)) + { + ACPI_ERROR ((AE_INFO, + "Timeout from EC hardware or EC device driver")); + } } if (!(HandlerDesc->AddressSpace.HandlerFlags & diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index bb825895b47d..9245beed0ac7 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -644,7 +644,8 @@ AcpiNsConvertToReference ( { /* Check if we are resolving a named reference within a package */ - ACPI_ERROR_NAMESPACE (OriginalObject->String.Pointer, Status); + ACPI_ERROR_NAMESPACE (&ScopeInfo, + OriginalObject->String.Pointer, Status); goto ErrorExit; } diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index fb74c44c3395..bfe270072e71 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -158,6 +158,12 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsnames") +/* Local Prototypes */ + +static void +AcpiNsNormalizePathname ( + char *OriginalPath); + /******************************************************************************* * @@ -507,3 +513,169 @@ AcpiNsGetNormalizedPathname ( return_PTR (NameBuffer); } + + +/******************************************************************************* + * + * FUNCTION: AcpiNsBuildPrefixedPathname + * + * PARAMETERS: PrefixScope - Scope/Path that prefixes the internal path + * InternalPath - Name or path of the namespace node + * + * RETURN: None + * + * DESCRIPTION: Construct a fully qualified pathname from a concatenation of: + * 1) Path associated with the PrefixScope namespace node + * 2) External path representation of the Internal path + * + ******************************************************************************/ + +char * +AcpiNsBuildPrefixedPathname ( + ACPI_GENERIC_STATE *PrefixScope, + const char *InternalPath) +{ + ACPI_STATUS Status; + char *FullPath = NULL; + char *ExternalPath = NULL; + char *PrefixPath = NULL; + UINT32 PrefixPathLength = 0; + + + /* If there is a prefix, get the pathname to it */ + + if (PrefixScope && PrefixScope->Scope.Node) + { + PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE); + if (PrefixPath) + { + PrefixPathLength = strlen (PrefixPath); + } + } + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, + NULL, &ExternalPath); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + /* Merge the prefix path and the path. 2 is for one dot and trailing null */ + + FullPath = ACPI_ALLOCATE_ZEROED ( + PrefixPathLength + strlen (ExternalPath) + 2); + if (!FullPath) + { + goto Cleanup; + } + + /* Don't merge if the External path is already fully qualified */ + + if (PrefixPath && + (*ExternalPath != '\\') && + (*ExternalPath != '^')) + { + strcat (FullPath, PrefixPath); + if (PrefixPath[1]) + { + strcat (FullPath, "."); + } + } + + AcpiNsNormalizePathname (ExternalPath); + strcat (FullPath, ExternalPath); + +Cleanup: + if (PrefixPath) + { + ACPI_FREE (PrefixPath); + } + if (ExternalPath) + { + ACPI_FREE (ExternalPath); + } + + return (FullPath); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsNormalizePathname + * + * PARAMETERS: OriginalPath - Path to be normalized, in External format + * + * RETURN: The original path is processed in-place + * + * DESCRIPTION: Remove trailing underscores from each element of a path. + * + * For example: \A___.B___.C___ becomes \A.B.C + * + ******************************************************************************/ + +static void +AcpiNsNormalizePathname ( + char *OriginalPath) +{ + char *InputPath = OriginalPath; + char *NewPathBuffer; + char *NewPath; + UINT32 i; + + + /* Allocate a temp buffer in which to construct the new path */ + + NewPathBuffer = ACPI_ALLOCATE_ZEROED (strlen (InputPath) + 1); + NewPath = NewPathBuffer; + if (!NewPathBuffer) + { + return; + } + + /* Special characters may appear at the beginning of the path */ + + if (*InputPath == '\\') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + + while (*InputPath == '^') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + + /* Remainder of the path */ + + while (*InputPath) + { + /* Do one nameseg at a time */ + + for (i = 0; (i < ACPI_NAME_SIZE) && *InputPath; i++) + { + if ((i == 0) || (*InputPath != '_')) /* First char is allowed to be underscore */ + { + *NewPath = *InputPath; + NewPath++; + } + + InputPath++; + } + + /* Dot means that there are more namesegs to come */ + + if (*InputPath == '.') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + } + + *NewPath = 0; + strcpy (OriginalPath, NewPathBuffer); + ACPI_FREE (NewPathBuffer); +} diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index baa60f26b03d..bc3f5ce40429 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -500,7 +500,7 @@ AcpiPsGetNextNamepath ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 7cb171bccecf..5c42badfbbff 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -558,11 +558,6 @@ AcpiUtGetReferenceName ( } -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * Strings and procedures used for debug only - */ - /******************************************************************************* * * FUNCTION: AcpiUtGetMutexName @@ -601,6 +596,12 @@ AcpiUtGetMutexName ( } +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* + * Strings and procedures used for debug only + */ + /******************************************************************************* * * FUNCTION: AcpiUtGetNotifyName diff --git a/source/components/utilities/uterror.c b/source/components/utilities/uterror.c index a429a7f43703..28ad2e321721 100644 --- a/source/components/utilities/uterror.c +++ b/source/components/utilities/uterror.c @@ -313,6 +313,82 @@ AcpiUtPredefinedBiosError ( /******************************************************************************* * + * FUNCTION: AcpiUtPrefixedNamespaceError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * PrefixScope - Scope/Path that prefixes the internal path + * InternalPath - Name or path of the namespace node + * LookupStatus - Exception code from NS lookup + * + * RETURN: None + * + * DESCRIPTION: Print error message with the full pathname constructed this way: + * + * PrefixScopeNodeFullPath.ExternalizedInternalPath + * + * NOTE: 10/2017: Treat the major NsLookup errors as firmware errors + * + ******************************************************************************/ + +void +AcpiUtPrefixedNamespaceError ( + const char *ModuleName, + UINT32 LineNumber, + ACPI_GENERIC_STATE *PrefixScope, + const char *InternalPath, + ACPI_STATUS LookupStatus) +{ + char *FullPath; + const char *Message; + + + /* + * Main cases: + * 1) Object creation, object must not already exist + * 2) Object lookup, object must exist + */ + switch (LookupStatus) + { + case AE_ALREADY_EXISTS: + + AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); + Message = "Failure creating"; + break; + + case AE_NOT_FOUND: + + AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); + Message = "Failure looking up"; + break; + + default: + + AcpiOsPrintf (ACPI_MSG_ERROR); + Message = "Failure looking up"; + break; + } + + /* Concatenate the prefix path and the internal path */ + + FullPath = AcpiNsBuildPrefixedPathname (PrefixScope, InternalPath); + + AcpiOsPrintf ("%s [%s], %s", Message, + FullPath ? FullPath : "Could not get pathname", + AcpiFormatException (LookupStatus)); + + if (FullPath) + { + ACPI_FREE (FullPath); + } + + ACPI_MSG_SUFFIX; +} + + +#ifdef __OBSOLETE_FUNCTION +/******************************************************************************* + * * FUNCTION: AcpiUtNamespaceError * * PARAMETERS: ModuleName - Caller's module name (for error output) @@ -378,7 +454,7 @@ AcpiUtNamespaceError ( ACPI_MSG_SUFFIX; ACPI_MSG_REDIRECT_END; } - +#endif /******************************************************************************* * diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 7297929ca0f0..503dc508d81a 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -432,8 +432,8 @@ AcpiUtAcquireMutex ( else { ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %u could not acquire Mutex [0x%X]", - (UINT32) ThisThreadId, MutexId)); + "Thread %u could not acquire Mutex [%s] (0x%X)", + (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId), MutexId)); } return (Status); @@ -473,7 +473,8 @@ AcpiUtReleaseMutex ( if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED) { ACPI_ERROR ((AE_INFO, - "Mutex [0x%X] is not acquired, cannot release", MutexId)); + "Mutex [%s] (0x%X) is not acquired, cannot release", + AcpiUtGetMutexName (MutexId), MutexId)); return (AE_NOT_ACQUIRED); } diff --git a/source/components/utilities/utstrsuppt.c b/source/components/utilities/utstrsuppt.c index 9197a57a5fbe..bdb2f4fa5b7e 100644 --- a/source/components/utilities/utstrsuppt.c +++ b/source/components/utilities/utstrsuppt.c @@ -167,13 +167,13 @@ AcpiUtInsertDigit ( static ACPI_STATUS AcpiUtStrtoulMultiply64 ( UINT64 Multiplicand, - UINT64 Multiplier, + UINT32 Base, UINT64 *OutProduct); static ACPI_STATUS AcpiUtStrtoulAdd64 ( UINT64 Addend1, - UINT64 Addend2, + UINT32 Digit, UINT64 *OutSum); @@ -518,7 +518,7 @@ AcpiUtInsertDigit ( * FUNCTION: AcpiUtStrtoulMultiply64 * * PARAMETERS: Multiplicand - Current accumulated converted integer - * Multiplier - Base/Radix + * Base - Base/Radix * OutProduct - Where the product is returned * * RETURN: Status and 64-bit product @@ -532,28 +532,36 @@ AcpiUtInsertDigit ( static ACPI_STATUS AcpiUtStrtoulMultiply64 ( UINT64 Multiplicand, - UINT64 Multiplier, + UINT32 Base, UINT64 *OutProduct) { UINT64 Product; + UINT64 Quotient; /* Exit if either operand is zero */ *OutProduct = 0; - if (!Multiplicand || !Multiplier) + if (!Multiplicand || !Base) { return (AE_OK); } - /* Check for 64-bit overflow before the actual multiplication */ - - if (Multiplicand > (ACPI_UINT64_MAX / Multiplier)) + /* + * Check for 64-bit overflow before the actual multiplication. + * + * Notes: 64-bit division is often not supported on 32-bit platforms + * (it requires a library function), Therefore ACPICA has a local + * 64-bit divide function. Also, Multiplier is currently only used + * as the radix (8/10/16), to the 64/32 divide will always work. + */ + AcpiUtShortDivide (ACPI_UINT64_MAX, Base, &Quotient, NULL); + if (Multiplicand > Quotient) { return (AE_NUMERIC_OVERFLOW); } - Product = Multiplicand * Multiplier; + Product = Multiplicand * Base; /* Check for 32-bit overflow if necessary */ @@ -572,7 +580,7 @@ AcpiUtStrtoulMultiply64 ( * FUNCTION: AcpiUtStrtoulAdd64 * * PARAMETERS: Addend1 - Current accumulated converted integer - * Addend2 - New hex value/char + * Digit - New hex value/char * OutSum - Where sum is returned (Accumulator) * * RETURN: Status and 64-bit sum @@ -586,7 +594,7 @@ AcpiUtStrtoulMultiply64 ( static ACPI_STATUS AcpiUtStrtoulAdd64 ( UINT64 Addend1, - UINT64 Addend2, + UINT32 Digit, UINT64 *OutSum) { UINT64 Sum; @@ -594,12 +602,12 @@ AcpiUtStrtoulAdd64 ( /* Check for 64-bit overflow before the actual addition */ - if ((Addend1 > 0) && (Addend2 > (ACPI_UINT64_MAX - Addend1))) + if ((Addend1 > 0) && (Digit > (ACPI_UINT64_MAX - Addend1))) { return (AE_NUMERIC_OVERFLOW); } - Sum = Addend1 + Addend2; + Sum = Addend1 + Digit; /* Check for 32-bit overflow if necessary */ diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index a88a4a3de880..e74ff066a400 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -891,7 +891,7 @@ Exit: } else { - ACPI_ERROR ((AE_INFO, "%u(0x%X) Outstanding allocations", + ACPI_ERROR ((AE_INFO, "%u (0x%X) Outstanding cache allocations", NumOutstanding, NumOutstanding)); } diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index a81352b93e45..95cb4509e6c3 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -214,8 +214,8 @@ ACPI_EXPORT_SYMBOL (AcpiError) * * RETURN: None * - * DESCRIPTION: Print "ACPI Exception" message with module/line/version info - * and decoded ACPI_STATUS. + * DESCRIPTION: Print an "ACPI Error" message with module/line/version + * info as well as decoded ACPI_STATUS. * ******************************************************************************/ @@ -236,12 +236,12 @@ AcpiException ( if (ACPI_SUCCESS (Status)) { - AcpiOsPrintf (ACPI_MSG_EXCEPTION); + AcpiOsPrintf (ACPI_MSG_ERROR); } else { - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", + AcpiOsPrintf (ACPI_MSG_ERROR "%s, ", AcpiFormatException (Status)); } |
