dbinput.c revision 192384
1238104Sdes/******************************************************************************* 2238104Sdes * 3238104Sdes * Module Name: dbinput - user front-end to the AML debugger 4238104Sdes * $Revision: 1.114 $ 5238104Sdes * 6238104Sdes ******************************************************************************/ 7238104Sdes 8238104Sdes/****************************************************************************** 9238104Sdes * 10238104Sdes * 1. Copyright Notice 11238104Sdes * 12238104Sdes * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 13238104Sdes * All rights reserved. 14238104Sdes * 15238104Sdes * 2. License 16238104Sdes * 17238104Sdes * 2.1. This is your license from Intel Corp. under its intellectual property 18238104Sdes * rights. You may have additional license terms from the party that provided 19238104Sdes * you this software, covering your right to use that party's intellectual 20238104Sdes * property rights. 21238104Sdes * 22238104Sdes * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23238104Sdes * copy of the source code appearing in this file ("Covered Code") an 24238104Sdes * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25238104Sdes * base code distributed originally by Intel ("Original Intel Code") to copy, 26238104Sdes * make derivatives, distribute, use and display any portion of the Covered 27238104Sdes * Code in any form, with the right to sublicense such rights; and 28238104Sdes * 29238104Sdes * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30238104Sdes * license (with the right to sublicense), under only those claims of Intel 31238104Sdes * patents that are infringed by the Original Intel Code, to make, use, sell, 32238104Sdes * offer to sell, and import the Covered Code and derivative works thereof 33238104Sdes * solely to the minimum extent necessary to exercise the above copyright 34238104Sdes * license, and in no event shall the patent license extend to any additions 35238104Sdes * to or modifications of the Original Intel Code. No other license or right 36238104Sdes * is granted directly or by implication, estoppel or otherwise; 37238104Sdes * 38238104Sdes * The above copyright and patent license is granted only if the following 39238104Sdes * conditions are met: 40238104Sdes * 41238104Sdes * 3. Conditions 42238104Sdes * 43238104Sdes * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44238104Sdes * Redistribution of source code of any substantial portion of the Covered 45238104Sdes * Code or modification with rights to further distribute source must include 46238104Sdes * the above Copyright Notice, the above License, this list of Conditions, 47238104Sdes * and the following Disclaimer and Export Compliance provision. In addition, 48238104Sdes * Licensee must cause all Covered Code to which Licensee contributes to 49238104Sdes * contain a file documenting the changes Licensee made to create that Covered 50238104Sdes * Code and the date of any change. Licensee must include in that file the 51238104Sdes * documentation of any changes made by any predecessor Licensee. Licensee 52238104Sdes * must include a prominent statement that the modification is derived, 53238104Sdes * directly or indirectly, from Original Intel Code. 54238104Sdes * 55238104Sdes * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56238104Sdes * Redistribution of source code of any substantial portion of the Covered 57238104Sdes * Code or modification without rights to further distribute source must 58238104Sdes * include the following Disclaimer and Export Compliance provision in the 59238104Sdes * documentation and/or other materials provided with distribution. In 60238104Sdes * addition, Licensee may not authorize further sublicense of source of any 61238104Sdes * portion of the Covered Code, and must include terms to the effect that the 62238104Sdes * license from Licensee to its licensee is limited to the intellectual 63238104Sdes * property embodied in the software Licensee provides to its licensee, and 64238104Sdes * not to intellectual property embodied in modifications its licensee may 65238104Sdes * make. 66238104Sdes * 67238104Sdes * 3.3. Redistribution of Executable. Redistribution in executable form of any 68238104Sdes * substantial portion of the Covered Code or modification must reproduce the 69238104Sdes * above Copyright Notice, and the following Disclaimer and Export Compliance 70238104Sdes * provision in the documentation and/or other materials provided with the 71238104Sdes * distribution. 72238104Sdes * 73238104Sdes * 3.4. Intel retains all right, title, and interest in and to the Original 74238104Sdes * Intel Code. 75238104Sdes * 76238104Sdes * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77238104Sdes * Intel shall be used in advertising or otherwise to promote the sale, use or 78238104Sdes * other dealings in products derived from or relating to the Covered Code 79238104Sdes * without prior written authorization from Intel. 80238104Sdes * 81238104Sdes * 4. Disclaimer and Export Compliance 82238104Sdes * 83238104Sdes * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84238104Sdes * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85238104Sdes * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86238104Sdes * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87238104Sdes * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88238104Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89238104Sdes * PARTICULAR PURPOSE. 90238104Sdes * 91238104Sdes * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92238104Sdes * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93238104Sdes * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94238104Sdes * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95238104Sdes * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96238104Sdes * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97238104Sdes * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98238104Sdes * LIMITED REMEDY. 99238104Sdes * 100238104Sdes * 4.3. Licensee shall not export, either directly or indirectly, any of this 101238104Sdes * software or system incorporating such software without first obtaining any 102238104Sdes * required license or other approval from the U. S. Department of Commerce or 103238104Sdes * any other agency or department of the United States Government. In the 104238104Sdes * event Licensee exports any such software from the United States or 105238104Sdes * re-exports any such software from a foreign destination, Licensee shall 106238104Sdes * ensure that the distribution and export/re-export of the software is in 107238104Sdes * compliance with all laws, regulations, orders, or other restrictions of the 108238104Sdes * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109238104Sdes * any of its subsidiaries will export/re-export any technical data, process, 110238104Sdes * software, or service, directly or indirectly, to any country for which the 111238104Sdes * United States government or any agency thereof requires an export license, 112238104Sdes * other governmental approval, or letter of assurance, without first obtaining 113238104Sdes * such license, approval or letter. 114238104Sdes * 115238104Sdes *****************************************************************************/ 116238104Sdes 117238104Sdes 118238104Sdes#include <contrib/dev/acpica/acpi.h> 119238104Sdes#include <contrib/dev/acpica/acdebug.h> 120238104Sdes 121238104Sdes 122238104Sdes#ifdef ACPI_DEBUGGER 123238104Sdes 124238104Sdes#define _COMPONENT ACPI_CA_DEBUGGER 125238104Sdes ACPI_MODULE_NAME ("dbinput") 126238104Sdes 127238104Sdes/* Local prototypes */ 128238104Sdes 129238104Sdesstatic char * 130238104SdesAcpiDbGetNextToken ( 131238104Sdes char *String, 132238104Sdes char **Next); 133238104Sdes 134238104Sdesstatic UINT32 135238104SdesAcpiDbGetLine ( 136238104Sdes char *InputBuffer); 137238104Sdes 138238104Sdesstatic UINT32 139238104SdesAcpiDbMatchCommand ( 140238104Sdes char *UserCommand); 141238104Sdes 142238104Sdesstatic void 143238104SdesAcpiDbSingleThread ( 144238104Sdes void); 145238104Sdes 146238104Sdesstatic void 147238104SdesAcpiDbDisplayHelp ( 148238104Sdes char *HelpType); 149238104Sdes 150238104Sdes 151238104Sdes/* 152238104Sdes * Top-level debugger commands. 153238104Sdes * 154238104Sdes * This list of commands must match the string table below it 155238104Sdes */ 156238104Sdesenum AcpiExDebuggerCommands 157238104Sdes{ 158238104Sdes CMD_NOT_FOUND = 0, 159238104Sdes CMD_NULL, 160238104Sdes CMD_ALLOCATIONS, 161238104Sdes CMD_ARGS, 162238104Sdes CMD_ARGUMENTS, 163238104Sdes CMD_BREAKPOINT, 164238104Sdes CMD_BUSINFO, 165238104Sdes CMD_CALL, 166238104Sdes CMD_CLOSE, 167238104Sdes CMD_DEBUG, 168238104Sdes CMD_DISASSEMBLE, 169238104Sdes CMD_DUMP, 170238104Sdes CMD_ENABLEACPI, 171238104Sdes CMD_EVENT, 172238104Sdes CMD_EXECUTE, 173238104Sdes CMD_EXIT, 174238104Sdes CMD_FIND, 175238104Sdes CMD_GO, 176238104Sdes CMD_GPE, 177238104Sdes CMD_GPES, 178238104Sdes CMD_HELP, 179238104Sdes CMD_HELP2, 180238104Sdes CMD_HISTORY, 181238104Sdes CMD_HISTORY_EXE, 182238104Sdes CMD_HISTORY_LAST, 183238104Sdes CMD_INFORMATION, 184238104Sdes CMD_INTEGRITY, 185238104Sdes CMD_INTO, 186238104Sdes CMD_LEVEL, 187238104Sdes CMD_LIST, 188238104Sdes CMD_LOAD, 189238104Sdes CMD_LOCALS, 190238104Sdes CMD_LOCKS, 191238104Sdes CMD_METHODS, 192238104Sdes CMD_NAMESPACE, 193238104Sdes CMD_NOTIFY, 194238104Sdes CMD_OBJECT, 195238104Sdes CMD_OPEN, 196238104Sdes CMD_OWNER, 197238104Sdes CMD_PREFIX, 198238104Sdes CMD_QUIT, 199238104Sdes CMD_REFERENCES, 200238104Sdes CMD_RESOURCES, 201238104Sdes CMD_RESULTS, 202238104Sdes CMD_SET, 203238104Sdes CMD_SLEEP, 204238104Sdes CMD_STATS, 205238104Sdes CMD_STOP, 206238104Sdes CMD_TABLES, 207238104Sdes CMD_TERMINATE, 208238104Sdes CMD_THREADS, 209238104Sdes CMD_TRACE, 210238104Sdes CMD_TREE, 211238104Sdes CMD_TYPE, 212238104Sdes CMD_UNLOAD 213238104Sdes}; 214238104Sdes 215238104Sdes#define CMD_FIRST_VALID 2 216238104Sdes 217238104Sdesstatic const COMMAND_INFO AcpiGbl_DbCommands[] = 218238104Sdes{ 219238104Sdes {"<NOT FOUND>", 0}, 220238104Sdes {"<NULL>", 0}, 221238104Sdes {"ALLOCATIONS", 0}, 222238104Sdes {"ARGS", 0}, 223238104Sdes {"ARGUMENTS", 0}, 224238104Sdes {"BREAKPOINT", 1}, 225238104Sdes {"BUSINFO", 0}, 226238104Sdes {"CALL", 0}, 227238104Sdes {"CLOSE", 0}, 228238104Sdes {"DEBUG", 1}, 229238104Sdes {"DISASSEMBLE", 1}, 230238104Sdes {"DUMP", 1}, 231238104Sdes {"ENABLEACPI", 0}, 232238104Sdes {"EVENT", 1}, 233238104Sdes {"EXECUTE", 1}, 234238104Sdes {"EXIT", 0}, 235238104Sdes {"FIND", 1}, 236238104Sdes {"GO", 0}, 237238104Sdes {"GPE", 2}, 238238104Sdes {"GPES", 0}, 239238104Sdes {"HELP", 0}, 240238104Sdes {"?", 0}, 241238104Sdes {"HISTORY", 0}, 242238104Sdes {"!", 1}, 243238104Sdes {"!!", 0}, 244238104Sdes {"INFORMATION", 0}, 245238104Sdes {"INTEGRITY", 0}, 246238104Sdes {"INTO", 0}, 247238104Sdes {"LEVEL", 0}, 248238104Sdes {"LIST", 0}, 249238104Sdes {"LOAD", 1}, 250238104Sdes {"LOCALS", 0}, 251238104Sdes {"LOCKS", 0}, 252238104Sdes {"METHODS", 0}, 253238104Sdes {"NAMESPACE", 0}, 254238104Sdes {"NOTIFY", 2}, 255238104Sdes {"OBJECT", 1}, 256238104Sdes {"OPEN", 1}, 257238104Sdes {"OWNER", 1}, 258238104Sdes {"PREFIX", 0}, 259238104Sdes {"QUIT", 0}, 260238104Sdes {"REFERENCES", 1}, 261238104Sdes {"RESOURCES", 1}, 262238104Sdes {"RESULTS", 0}, 263238104Sdes {"SET", 3}, 264238104Sdes {"SLEEP", 1}, 265238104Sdes {"STATS", 0}, 266238104Sdes {"STOP", 0}, 267238104Sdes {"TABLES", 0}, 268238104Sdes {"TERMINATE", 0}, 269238104Sdes {"THREADS", 3}, 270238104Sdes {"TRACE", 1}, 271238104Sdes {"TREE", 0}, 272238104Sdes {"TYPE", 1}, 273238104Sdes {"UNLOAD", 1}, 274238104Sdes {NULL, 0} 275238104Sdes}; 276238104Sdes 277238104Sdes 278238104Sdes/******************************************************************************* 279238104Sdes * 280238104Sdes * FUNCTION: AcpiDbDisplayHelp 281238104Sdes * 282238104Sdes * PARAMETERS: HelpType - Subcommand (optional) 283238104Sdes * 284238104Sdes * RETURN: None 285238104Sdes * 286238104Sdes * DESCRIPTION: Print a usage message. 287238104Sdes * 288238104Sdes ******************************************************************************/ 289238104Sdes 290238104Sdesstatic void 291238104SdesAcpiDbDisplayHelp ( 292238104Sdes char *HelpType) 293238104Sdes{ 294238104Sdes 295238104Sdes AcpiUtStrupr (HelpType); 296238104Sdes 297238104Sdes /* No parameter, just give the overview */ 298238104Sdes 299238104Sdes if (!HelpType) 300238104Sdes { 301238104Sdes AcpiOsPrintf ("ACPI CA Debugger Commands\n\n"); 302238104Sdes AcpiOsPrintf ("The following classes of commands are available. Help is available for\n"); 303238104Sdes AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n"); 304238104Sdes AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n"); 305238104Sdes AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n"); 306238104Sdes AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n"); 307238104Sdes AcpiOsPrintf (" [STATISTICS] Statistical Information\n"); 308238104Sdes AcpiOsPrintf (" [FILE] File I/O Commands\n"); 309238104Sdes return; 310238104Sdes } 311238104Sdes 312238104Sdes /* 313238104Sdes * Parameter is the command class 314238104Sdes * 315238104Sdes * The idea here is to keep each class of commands smaller than a screenful 316238104Sdes */ 317238104Sdes switch (HelpType[0]) 318238104Sdes { 319238104Sdes case 'G': 320238104Sdes AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n"); 321238104Sdes AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); 322238104Sdes AcpiOsPrintf ("Dump <Address>|<Namepath>\n"); 323238104Sdes AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); 324238104Sdes AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n"); 325238104Sdes AcpiOsPrintf ("Help This help screen\n"); 326238104Sdes AcpiOsPrintf ("History Display command history buffer\n"); 327238104Sdes AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n"); 328238104Sdes AcpiOsPrintf ("Locks Current status of internal mutexes\n"); 329238104Sdes AcpiOsPrintf ("Quit or Exit Exit this command\n"); 330238104Sdes AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n"); 331238104Sdes AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); 332238104Sdes AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n"); 333238104Sdes AcpiOsPrintf ("Unload <TableSig> [Instance] Unload an ACPI table\n"); 334238104Sdes AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n"); 335238104Sdes AcpiOsPrintf ("!! Execute last command again\n"); 336238104Sdes return; 337238104Sdes 338238104Sdes case 'S': 339238104Sdes AcpiOsPrintf ("\nStats Subcommands\n\n"); 340238104Sdes AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); 341238104Sdes AcpiOsPrintf ("Memory Dump internal memory lists\n"); 342238104Sdes AcpiOsPrintf ("Misc Namespace search and mutex stats\n"); 343238104Sdes AcpiOsPrintf ("Objects Summary of namespace objects\n"); 344238104Sdes AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n"); 345238104Sdes AcpiOsPrintf ("Stack Display CPU stack usage\n"); 346238104Sdes AcpiOsPrintf ("Tables Info about current ACPI table(s)\n"); 347238104Sdes return; 348238104Sdes 349238104Sdes case 'N': 350238104Sdes AcpiOsPrintf ("\nNamespace Access Commands\n\n"); 351238104Sdes AcpiOsPrintf ("Businfo Display system bus info\n"); 352238104Sdes AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n"); 353238104Sdes AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n"); 354238104Sdes AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n"); 355238104Sdes AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n"); 356238104Sdes AcpiOsPrintf ("Gpes Display info on all GPEs\n"); 357238104Sdes AcpiOsPrintf ("Integrity Validate namespace integrity\n"); 358238104Sdes AcpiOsPrintf ("Methods Display list of loaded control methods\n"); 359238104Sdes AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); 360238104Sdes AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n"); 361238104Sdes AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n"); 362238104Sdes AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n"); 363238104Sdes AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n"); 364238104Sdes AcpiOsPrintf ("References <Addr> Find all references to object at addr\n"); 365238104Sdes AcpiOsPrintf ("Resources <Device> Get and display Device resources\n"); 366238104Sdes AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n"); 367238104Sdes AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n"); 368238104Sdes AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n"); 369238104Sdes AcpiOsPrintf ("Type <Object> Display object type\n"); 370238104Sdes return; 371238104Sdes 372238104Sdes case 'M': 373238104Sdes AcpiOsPrintf ("\nControl Method Execution Commands\n\n"); 374238104Sdes AcpiOsPrintf ("Arguments (or Args) Display method arguments\n"); 375238104Sdes AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n"); 376238104Sdes AcpiOsPrintf ("Call Run to next control method invocation\n"); 377238104Sdes AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n"); 378238104Sdes AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n"); 379238104Sdes AcpiOsPrintf ("Go Allow method to run to completion\n"); 380238104Sdes AcpiOsPrintf ("Information Display info about the current method\n"); 381238104Sdes AcpiOsPrintf ("Into Step into (not over) a method call\n"); 382238104Sdes AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n"); 383238104Sdes AcpiOsPrintf ("Locals Display method local variables\n"); 384238104Sdes AcpiOsPrintf ("Results Display method result stack\n"); 385238104Sdes AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n"); 386238104Sdes AcpiOsPrintf ("Stop Terminate control method\n"); 387238104Sdes AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n"); 388238104Sdes AcpiOsPrintf ("Trace <method name> Trace method execution\n"); 389238104Sdes AcpiOsPrintf ("Tree Display control method calling tree\n"); 390238104Sdes AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n"); 391238104Sdes return; 392238104Sdes 393238104Sdes case 'F': 394238104Sdes AcpiOsPrintf ("\nFile I/O Commands\n\n"); 395238104Sdes AcpiOsPrintf ("Close Close debug output file\n"); 396238104Sdes AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n"); 397238104Sdes AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n"); 398238104Sdes return; 399238104Sdes 400238104Sdes default: 401238104Sdes AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType); 402238104Sdes return; 403238104Sdes } 404238104Sdes} 405238104Sdes 406238104Sdes 407238104Sdes/******************************************************************************* 408238104Sdes * 409238104Sdes * FUNCTION: AcpiDbGetNextToken 410238104Sdes * 411238104Sdes * PARAMETERS: String - Command buffer 412238104Sdes * Next - Return value, end of next token 413238104Sdes * 414238104Sdes * RETURN: Pointer to the start of the next token. 415238104Sdes * 416238104Sdes * DESCRIPTION: Command line parsing. Get the next token on the command line 417238104Sdes * 418238104Sdes ******************************************************************************/ 419238104Sdes 420238104Sdesstatic char * 421238104SdesAcpiDbGetNextToken ( 422238104Sdes char *String, 423238104Sdes char **Next) 424238104Sdes{ 425238104Sdes char *Start; 426238104Sdes 427238104Sdes 428238104Sdes /* At end of buffer? */ 429238104Sdes 430238104Sdes if (!String || !(*String)) 431238104Sdes { 432238104Sdes return (NULL); 433238104Sdes } 434238104Sdes 435238104Sdes /* Get rid of any spaces at the beginning */ 436238104Sdes 437238104Sdes if (*String == ' ') 438238104Sdes { 439238104Sdes while (*String && (*String == ' ')) 440238104Sdes { 441238104Sdes String++; 442238104Sdes } 443238104Sdes 444238104Sdes if (!(*String)) 445238104Sdes { 446238104Sdes return (NULL); 447238104Sdes } 448238104Sdes } 449238104Sdes 450238104Sdes Start = String; 451238104Sdes 452238104Sdes /* Find end of token */ 453238104Sdes 454238104Sdes while (*String && (*String != ' ')) 455238104Sdes { 456238104Sdes String++; 457238104Sdes } 458238104Sdes 459238104Sdes if (!(*String)) 460238104Sdes { 461238104Sdes *Next = NULL; 462238104Sdes } 463238104Sdes else 464238104Sdes { 465238104Sdes *String = 0; 466238104Sdes *Next = String + 1; 467238104Sdes } 468238104Sdes 469238104Sdes return (Start); 470238104Sdes} 471238104Sdes 472238104Sdes 473238104Sdes/******************************************************************************* 474238104Sdes * 475238104Sdes * FUNCTION: AcpiDbGetLine 476238104Sdes * 477238104Sdes * PARAMETERS: InputBuffer - Command line buffer 478238104Sdes * 479238104Sdes * RETURN: Count of arguments to the command 480238104Sdes * 481238104Sdes * DESCRIPTION: Get the next command line from the user. Gets entire line 482238104Sdes * up to the next newline 483238104Sdes * 484238104Sdes ******************************************************************************/ 485238104Sdes 486238104Sdesstatic UINT32 487238104SdesAcpiDbGetLine ( 488238104Sdes char *InputBuffer) 489238104Sdes{ 490238104Sdes UINT32 i; 491238104Sdes UINT32 Count; 492238104Sdes char *Next; 493238104Sdes char *This; 494238104Sdes 495238104Sdes 496238104Sdes ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer); 497238104Sdes 498238104Sdes This = AcpiGbl_DbParsedBuf; 499238104Sdes for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) 500238104Sdes { 501238104Sdes AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next); 502238104Sdes if (!AcpiGbl_DbArgs[i]) 503238104Sdes { 504238104Sdes break; 505238104Sdes } 506238104Sdes 507238104Sdes This = Next; 508238104Sdes } 509238104Sdes 510238104Sdes /* Uppercase the actual command */ 511238104Sdes 512238104Sdes if (AcpiGbl_DbArgs[0]) 513238104Sdes { 514238104Sdes AcpiUtStrupr (AcpiGbl_DbArgs[0]); 515238104Sdes } 516238104Sdes 517238104Sdes Count = i; 518238104Sdes if (Count) 519238104Sdes { 520238104Sdes Count--; /* Number of args only */ 521238104Sdes } 522238104Sdes 523238104Sdes return (Count); 524238104Sdes} 525238104Sdes 526238104Sdes 527238104Sdes/******************************************************************************* 528238104Sdes * 529238104Sdes * FUNCTION: AcpiDbMatchCommand 530238104Sdes * 531238104Sdes * PARAMETERS: UserCommand - User command line 532238104Sdes * 533238104Sdes * RETURN: Index into command array, -1 if not found 534238104Sdes * 535238104Sdes * DESCRIPTION: Search command array for a command match 536238104Sdes * 537238104Sdes ******************************************************************************/ 538238104Sdes 539238104Sdesstatic UINT32 540238104SdesAcpiDbMatchCommand ( 541238104Sdes char *UserCommand) 542238104Sdes{ 543238104Sdes UINT32 i; 544238104Sdes 545238104Sdes 546238104Sdes if (!UserCommand || UserCommand[0] == 0) 547238104Sdes { 548238104Sdes return (CMD_NULL); 549238104Sdes } 550238104Sdes 551238104Sdes for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) 552238104Sdes { 553238104Sdes if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == 554238104Sdes AcpiGbl_DbCommands[i].Name) 555238104Sdes { 556238104Sdes return (i); 557238104Sdes } 558238104Sdes } 559238104Sdes 560238104Sdes /* Command not recognized */ 561238104Sdes 562238104Sdes return (CMD_NOT_FOUND); 563238104Sdes} 564238104Sdes 565238104Sdes 566238104Sdes/******************************************************************************* 567238104Sdes * 568238104Sdes * FUNCTION: AcpiDbCommandDispatch 569238104Sdes * 570238104Sdes * PARAMETERS: InputBuffer - Command line buffer 571238104Sdes * WalkState - Current walk 572238104Sdes * Op - Current (executing) parse op 573238104Sdes * 574238104Sdes * RETURN: Status 575238104Sdes * 576238104Sdes * DESCRIPTION: Command dispatcher. 577238104Sdes * 578238104Sdes ******************************************************************************/ 579238104Sdes 580238104SdesACPI_STATUS 581238104SdesAcpiDbCommandDispatch ( 582238104Sdes char *InputBuffer, 583238104Sdes ACPI_WALK_STATE *WalkState, 584238104Sdes ACPI_PARSE_OBJECT *Op) 585238104Sdes{ 586238104Sdes UINT32 Temp; 587238104Sdes UINT32 CommandIndex; 588238104Sdes UINT32 ParamCount; 589238104Sdes char *CommandLine; 590238104Sdes ACPI_STATUS Status = AE_CTRL_TRUE; 591238104Sdes 592238104Sdes 593238104Sdes /* If AcpiTerminate has been called, terminate this thread */ 594238104Sdes 595238104Sdes if (AcpiGbl_DbTerminateThreads) 596238104Sdes { 597238104Sdes return (AE_CTRL_TERMINATE); 598238104Sdes } 599238104Sdes 600238104Sdes ParamCount = AcpiDbGetLine (InputBuffer); 601238104Sdes CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); 602238104Sdes Temp = 0; 603238104Sdes 604238104Sdes /* Verify that we have the minimum number of params */ 605238104Sdes 606238104Sdes if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) 607238104Sdes { 608238104Sdes AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n", 609238104Sdes ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, 610238104Sdes AcpiGbl_DbCommands[CommandIndex].MinArgs); 611238104Sdes 612238104Sdes return (AE_CTRL_TRUE); 613238104Sdes } 614238104Sdes 615238104Sdes /* Decode and dispatch the command */ 616238104Sdes 617238104Sdes switch (CommandIndex) 618238104Sdes { 619238104Sdes case CMD_NULL: 620238104Sdes if (Op) 621238104Sdes { 622238104Sdes return (AE_OK); 623238104Sdes } 624238104Sdes break; 625238104Sdes 626238104Sdes case CMD_ALLOCATIONS: 627238104Sdes 628238104Sdes#ifdef ACPI_DBG_TRACK_ALLOCATIONS 629238104Sdes AcpiUtDumpAllocations ((UINT32) -1, NULL); 630238104Sdes#endif 631238104Sdes break; 632238104Sdes 633238104Sdes case CMD_ARGS: 634238104Sdes case CMD_ARGUMENTS: 635238104Sdes AcpiDbDisplayArguments (); 636238104Sdes break; 637238104Sdes 638238104Sdes case CMD_BREAKPOINT: 639238104Sdes AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); 640238104Sdes break; 641238104Sdes 642238104Sdes case CMD_BUSINFO: 643238104Sdes AcpiDbGetBusInfo (); 644238104Sdes break; 645238104Sdes 646238104Sdes case CMD_CALL: 647238104Sdes AcpiDbSetMethodCallBreakpoint (Op); 648238104Sdes Status = AE_OK; 649238104Sdes break; 650238104Sdes 651238104Sdes case CMD_CLOSE: 652238104Sdes AcpiDbCloseDebugFile (); 653238104Sdes break; 654238104Sdes 655238104Sdes case CMD_DEBUG: 656238104Sdes AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); 657238104Sdes break; 658238104Sdes 659238104Sdes case CMD_DISASSEMBLE: 660238104Sdes (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); 661238104Sdes break; 662238104Sdes 663238104Sdes case CMD_DUMP: 664238104Sdes AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 665238104Sdes break; 666238104Sdes 667238104Sdes case CMD_ENABLEACPI: 668238104Sdes Status = AcpiEnable(); 669238104Sdes if (ACPI_FAILURE(Status)) 670238104Sdes { 671238104Sdes AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); 672238104Sdes return (Status); 673238104Sdes } 674238104Sdes break; 675238104Sdes 676238104Sdes case CMD_EVENT: 677238104Sdes AcpiOsPrintf ("Event command not implemented\n"); 678238104Sdes break; 679238104Sdes 680238104Sdes case CMD_EXECUTE: 681238104Sdes AcpiDbExecute (AcpiGbl_DbArgs[1], 682238104Sdes &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); 683238104Sdes break; 684238104Sdes 685238104Sdes case CMD_FIND: 686238104Sdes Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); 687238104Sdes break; 688238104Sdes 689238104Sdes case CMD_GO: 690238104Sdes AcpiGbl_CmSingleStep = FALSE; 691238104Sdes return (AE_OK); 692238104Sdes 693238104Sdes case CMD_GPE: 694238104Sdes AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 695238104Sdes break; 696238104Sdes 697238104Sdes case CMD_GPES: 698238104Sdes AcpiDbDisplayGpes (); 699238104Sdes break; 700238104Sdes 701238104Sdes case CMD_HELP: 702238104Sdes case CMD_HELP2: 703238104Sdes AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); 704238104Sdes break; 705238104Sdes 706238104Sdes case CMD_HISTORY: 707238104Sdes AcpiDbDisplayHistory (); 708238104Sdes break; 709238104Sdes 710238104Sdes case CMD_HISTORY_EXE: 711238104Sdes CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); 712238104Sdes if (!CommandLine) 713238104Sdes { 714238104Sdes return (AE_CTRL_TRUE); 715238104Sdes } 716238104Sdes 717238104Sdes Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); 718238104Sdes return (Status); 719238104Sdes 720238104Sdes case CMD_HISTORY_LAST: 721238104Sdes CommandLine = AcpiDbGetFromHistory (NULL); 722238104Sdes if (!CommandLine) 723238104Sdes { 724238104Sdes return (AE_CTRL_TRUE); 725238104Sdes } 726238104Sdes 727238104Sdes Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); 728238104Sdes return (Status); 729238104Sdes 730238104Sdes case CMD_INFORMATION: 731238104Sdes AcpiDbDisplayMethodInfo (Op); 732238104Sdes break; 733238104Sdes 734238104Sdes case CMD_INTEGRITY: 735238104Sdes AcpiDbCheckIntegrity (); 736238104Sdes break; 737238104Sdes 738238104Sdes case CMD_INTO: 739238104Sdes if (Op) 740238104Sdes { 741238104Sdes AcpiGbl_CmSingleStep = TRUE; 742238104Sdes return (AE_OK); 743238104Sdes } 744238104Sdes break; 745238104Sdes 746238104Sdes case CMD_LEVEL: 747238104Sdes if (ParamCount == 0) 748238104Sdes { 749238104Sdes AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", 750238104Sdes AcpiGbl_DbDebugLevel); 751238104Sdes AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", 752238104Sdes AcpiGbl_DbConsoleDebugLevel); 753238104Sdes } 754238104Sdes else if (ParamCount == 2) 755238104Sdes { 756238104Sdes Temp = AcpiGbl_DbConsoleDebugLevel; 757238104Sdes AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], 758238104Sdes NULL, 16); 759238104Sdes AcpiOsPrintf ( 760238104Sdes "Debug Level for console output was %8.8lX, now %8.8lX\n", 761238104Sdes Temp, AcpiGbl_DbConsoleDebugLevel); 762238104Sdes } 763238104Sdes else 764238104Sdes { 765238104Sdes Temp = AcpiGbl_DbDebugLevel; 766238104Sdes AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); 767238104Sdes AcpiOsPrintf ( 768238104Sdes "Debug Level for file output was %8.8lX, now %8.8lX\n", 769238104Sdes Temp, AcpiGbl_DbDebugLevel); 770238104Sdes } 771238104Sdes break; 772238104Sdes 773238104Sdes case CMD_LIST: 774238104Sdes AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); 775238104Sdes break; 776238104Sdes 777238104Sdes case CMD_LOAD: 778238104Sdes Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); 779238104Sdes break; 780238104Sdes 781238104Sdes case CMD_LOCKS: 782238104Sdes AcpiDbDisplayLocks (); 783238104Sdes break; 784238104Sdes 785238104Sdes case CMD_LOCALS: 786238104Sdes AcpiDbDisplayLocals (); 787238104Sdes break; 788238104Sdes 789238104Sdes case CMD_METHODS: 790238104Sdes Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); 791238104Sdes break; 792238104Sdes 793238104Sdes case CMD_NAMESPACE: 794238104Sdes AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 795238104Sdes break; 796238104Sdes 797238104Sdes case CMD_NOTIFY: 798238104Sdes Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); 799238104Sdes AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); 800238104Sdes break; 801238104Sdes 802238104Sdes case CMD_OBJECT: 803238104Sdes AcpiUtStrupr (AcpiGbl_DbArgs[1]); 804238104Sdes Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 805238104Sdes break; 806238104Sdes 807238104Sdes case CMD_OPEN: 808238104Sdes AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); 809238104Sdes break; 810238104Sdes 811238104Sdes case CMD_OWNER: 812238104Sdes AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 813238104Sdes break; 814238104Sdes 815238104Sdes case CMD_PREFIX: 816238104Sdes AcpiDbSetScope (AcpiGbl_DbArgs[1]); 817238104Sdes break; 818238104Sdes 819238104Sdes case CMD_REFERENCES: 820238104Sdes AcpiDbFindReferences (AcpiGbl_DbArgs[1]); 821238104Sdes break; 822238104Sdes 823238104Sdes case CMD_RESOURCES: 824238104Sdes AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); 825238104Sdes break; 826238104Sdes 827238104Sdes case CMD_RESULTS: 828238104Sdes AcpiDbDisplayResults (); 829238104Sdes break; 830238104Sdes 831238104Sdes case CMD_SET: 832238104Sdes AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], 833238104Sdes AcpiGbl_DbArgs[3]); 834238104Sdes break; 835238104Sdes 836238104Sdes case CMD_SLEEP: 837238104Sdes Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); 838238104Sdes break; 839238104Sdes 840238104Sdes case CMD_STATS: 841238104Sdes Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); 842238104Sdes break; 843238104Sdes 844238104Sdes case CMD_STOP: 845238104Sdes return (AE_NOT_IMPLEMENTED); 846238104Sdes 847238104Sdes case CMD_TABLES: 848238104Sdes AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); 849238104Sdes break; 850238104Sdes 851238104Sdes case CMD_TERMINATE: 852238104Sdes AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 853238104Sdes AcpiUtSubsystemShutdown (); 854238104Sdes 855238104Sdes /* 856238104Sdes * TBD: [Restructure] Need some way to re-initialize without 857238104Sdes * re-creating the semaphores! 858238104Sdes */ 859238104Sdes 860238104Sdes /* AcpiInitialize (NULL); */ 861238104Sdes break; 862238104Sdes 863238104Sdes case CMD_THREADS: 864238104Sdes AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], 865238104Sdes AcpiGbl_DbArgs[3]); 866238104Sdes break; 867238104Sdes 868238104Sdes case CMD_TRACE: 869238104Sdes AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); 870238104Sdes break; 871238104Sdes 872238104Sdes case CMD_TREE: 873238104Sdes AcpiDbDisplayCallingTree (); 874238104Sdes break; 875238104Sdes 876238104Sdes case CMD_TYPE: 877238104Sdes AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); 878238104Sdes break; 879238104Sdes 880238104Sdes case CMD_UNLOAD: 881238104Sdes AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); 882238104Sdes break; 883238104Sdes 884238104Sdes case CMD_EXIT: 885238104Sdes case CMD_QUIT: 886238104Sdes if (Op) 887238104Sdes { 888238104Sdes AcpiOsPrintf ("Method execution terminated\n"); 889238104Sdes return (AE_CTRL_TERMINATE); 890238104Sdes } 891238104Sdes 892238104Sdes if (!AcpiGbl_DbOutputToFile) 893238104Sdes { 894238104Sdes AcpiDbgLevel = ACPI_DEBUG_DEFAULT; 895238104Sdes } 896238104Sdes 897238104Sdes AcpiDbCloseDebugFile (); 898238104Sdes AcpiGbl_DbTerminateThreads = TRUE; 899238104Sdes return (AE_CTRL_TERMINATE); 900238104Sdes 901238104Sdes case CMD_NOT_FOUND: 902238104Sdes default: 903238104Sdes AcpiOsPrintf ("Unknown Command\n"); 904238104Sdes return (AE_CTRL_TRUE); 905238104Sdes } 906238104Sdes 907238104Sdes if (ACPI_SUCCESS (Status)) 908238104Sdes { 909238104Sdes Status = AE_CTRL_TRUE; 910238104Sdes } 911238104Sdes 912238104Sdes /* Add all commands that come here to the history buffer */ 913238104Sdes 914238104Sdes AcpiDbAddToHistory (InputBuffer); 915238104Sdes return (Status); 916238104Sdes} 917238104Sdes 918238104Sdes 919238104Sdes/******************************************************************************* 920238104Sdes * 921238104Sdes * FUNCTION: AcpiDbExecuteThread 922238104Sdes * 923238104Sdes * PARAMETERS: Context - Not used 924238104Sdes * 925238104Sdes * RETURN: None 926238104Sdes * 927238104Sdes * DESCRIPTION: Debugger execute thread. Waits for a command line, then 928238104Sdes * simply dispatches it. 929238104Sdes * 930246827Sdes ******************************************************************************/ 931238104Sdes 932238104Sdesvoid ACPI_SYSTEM_XFACE 933238104SdesAcpiDbExecuteThread ( 934238104Sdes void *Context) 935238104Sdes{ 936238104Sdes ACPI_STATUS Status = AE_OK; 937238104Sdes ACPI_STATUS MStatus; 938238104Sdes 939238104Sdes 940238104Sdes while (Status != AE_CTRL_TERMINATE) 941238104Sdes { 942238104Sdes AcpiGbl_MethodExecuting = FALSE; 943238104Sdes AcpiGbl_StepToNextCall = FALSE; 944238104Sdes 945238104Sdes MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); 946238104Sdes if (ACPI_FAILURE (MStatus)) 947238104Sdes { 948238104Sdes return; 949238104Sdes } 950238104Sdes 951238104Sdes Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); 952238104Sdes 953238104Sdes MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); 954238104Sdes if (ACPI_FAILURE (MStatus)) 955238104Sdes { 956238104Sdes return; 957238104Sdes } 958238104Sdes } 959238104Sdes} 960238104Sdes 961238104Sdes 962238104Sdes/******************************************************************************* 963238104Sdes * 964238104Sdes * FUNCTION: AcpiDbSingleThread 965238104Sdes * 966238104Sdes * PARAMETERS: None 967238104Sdes * 968238104Sdes * RETURN: None 969238104Sdes * 970238104Sdes * DESCRIPTION: Debugger execute thread. Waits for a command line, then 971238104Sdes * simply dispatches it. 972238104Sdes * 973238104Sdes ******************************************************************************/ 974238104Sdes 975238104Sdesstatic void 976238104SdesAcpiDbSingleThread ( 977238104Sdes void) 978238104Sdes{ 979238104Sdes 980238104Sdes AcpiGbl_MethodExecuting = FALSE; 981238104Sdes AcpiGbl_StepToNextCall = FALSE; 982238104Sdes 983238104Sdes (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); 984238104Sdes} 985238104Sdes 986238104Sdes 987238104Sdes/******************************************************************************* 988238104Sdes * 989238104Sdes * FUNCTION: AcpiDbUserCommands 990238104Sdes * 991238104Sdes * PARAMETERS: Prompt - User prompt (depends on mode) 992238104Sdes * Op - Current executing parse op 993238104Sdes * 994238104Sdes * RETURN: None 995238104Sdes * 996238104Sdes * DESCRIPTION: Command line execution for the AML debugger. Commands are 997238104Sdes * matched and dispatched here. 998238104Sdes * 999238104Sdes ******************************************************************************/ 1000238104Sdes 1001238104SdesACPI_STATUS 1002238104SdesAcpiDbUserCommands ( 1003238104Sdes char Prompt, 1004238104Sdes ACPI_PARSE_OBJECT *Op) 1005238104Sdes{ 1006238104Sdes ACPI_STATUS Status = AE_OK; 1007238104Sdes 1008238104Sdes 1009238104Sdes /* TBD: [Restructure] Need a separate command line buffer for step mode */ 1010238104Sdes 1011238104Sdes while (!AcpiGbl_DbTerminateThreads) 1012238104Sdes { 1013238104Sdes /* Force output to console until a command is entered */ 1014238104Sdes 1015238104Sdes AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 1016238104Sdes 1017238104Sdes /* Different prompt if method is executing */ 1018238104Sdes 1019238104Sdes if (!AcpiGbl_MethodExecuting) 1020238104Sdes { 1021238104Sdes AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); 1022238104Sdes } 1023238104Sdes else 1024238104Sdes { 1025238104Sdes AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); 1026238104Sdes } 1027238104Sdes 1028238104Sdes /* Get the user input line */ 1029238104Sdes 1030238104Sdes (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); 1031238104Sdes 1032238104Sdes /* Check for single or multithreaded debug */ 1033238104Sdes 1034238104Sdes if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) 1035238104Sdes { 1036238104Sdes /* 1037238104Sdes * Signal the debug thread that we have a command to execute, 1038238104Sdes * and wait for the command to complete. 1039238104Sdes */ 1040238104Sdes Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); 1041238104Sdes if (ACPI_FAILURE (Status)) 1042238104Sdes { 1043238104Sdes return (Status); 1044238104Sdes } 1045238104Sdes 1046238104Sdes Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); 1047238104Sdes if (ACPI_FAILURE (Status)) 1048238104Sdes { 1049238104Sdes return (Status); 1050238104Sdes } 1051238104Sdes } 1052238104Sdes else 1053238104Sdes { 1054238104Sdes /* Just call to the command line interpreter */ 1055238104Sdes 1056238104Sdes AcpiDbSingleThread (); 1057238104Sdes } 1058238104Sdes } 1059238104Sdes 1060238104Sdes /* 1061238104Sdes * Only this thread (the original thread) should actually terminate the 1062238104Sdes * subsystem, because all the semaphores are deleted during termination 1063238104Sdes */ 1064238104Sdes Status = AcpiTerminate (); 1065238104Sdes return (Status); 1066238104Sdes} 1067238104Sdes 1068238104Sdes#endif /* ACPI_DEBUGGER */ 1069238104Sdes 1070238104Sdes