1 /****************************************************************************** 2 * 3 * Name: acdebug.h - ACPI/AML debugger 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 *****************************************************************************/ 115 116 #ifndef __ACDEBUG_H__ 117 #define __ACDEBUG_H__ 118 119 /* The debugger is used in conjunction with the disassembler most of time */ 120 121 #ifdef ACPI_DISASSEMBLER 122 #include "acdisasm.h" 123 #endif 124 125 126 #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ 127 128 typedef struct acpi_db_command_info 129 { 130 const char *Name; /* Command Name */ 131 UINT8 MinArgs; /* Minimum arguments required */ 132 133 } ACPI_DB_COMMAND_INFO; 134 135 typedef struct acpi_db_command_help 136 { 137 UINT8 LineCount; /* Number of help lines */ 138 char *Invocation; /* Command Invocation */ 139 char *Description; /* Command Description */ 140 141 } ACPI_DB_COMMAND_HELP; 142 143 typedef struct acpi_db_argument_info 144 { 145 const char *Name; /* Argument Name */ 146 147 } ACPI_DB_ARGUMENT_INFO; 148 149 typedef struct acpi_db_execute_walk 150 { 151 UINT32 Count; 152 UINT32 MaxCount; 153 154 } ACPI_DB_EXECUTE_WALK; 155 156 157 #define PARAM_LIST(pl) pl 158 159 #define EX_NO_SINGLE_STEP 1 160 #define EX_SINGLE_STEP 2 161 162 163 /* 164 * dbxface - external debugger interfaces 165 */ 166 ACPI_DBR_DEPENDENT_RETURN_OK ( 167 ACPI_STATUS 168 AcpiDbSingleStep ( 169 ACPI_WALK_STATE *WalkState, 170 ACPI_PARSE_OBJECT *Op, 171 UINT32 OpType)) 172 173 ACPI_DBR_DEPENDENT_RETURN_VOID ( 174 void 175 AcpiDbSignalBreakPoint ( 176 ACPI_WALK_STATE *WalkState)) 177 178 179 /* 180 * dbcmds - debug commands and output routines 181 */ 182 ACPI_NAMESPACE_NODE * 183 AcpiDbConvertToNode ( 184 char *InString); 185 186 void 187 AcpiDbDisplayTableInfo ( 188 char *TableArg); 189 190 void 191 AcpiDbDisplayTemplate ( 192 char *BufferArg); 193 194 void 195 AcpiDbUnloadAcpiTable ( 196 char *Name); 197 198 void 199 AcpiDbSendNotify ( 200 char *Name, 201 UINT32 Value); 202 203 void 204 AcpiDbDisplayInterfaces ( 205 char *ActionArg, 206 char *InterfaceNameArg); 207 208 ACPI_STATUS 209 AcpiDbSleep ( 210 char *ObjectArg); 211 212 void 213 AcpiDbTrace ( 214 char *EnableArg, 215 char *MethodArg, 216 char *OnceArg); 217 218 void 219 AcpiDbDisplayLocks ( 220 void); 221 222 void 223 AcpiDbDisplayResources ( 224 char *ObjectArg); 225 226 ACPI_HW_DEPENDENT_RETURN_VOID ( 227 void 228 AcpiDbDisplayGpes ( 229 void)) 230 231 void 232 AcpiDbDisplayHandlers ( 233 void); 234 235 ACPI_HW_DEPENDENT_RETURN_VOID ( 236 void 237 AcpiDbGenerateGpe ( 238 char *GpeArg, 239 char *BlockArg)) 240 241 ACPI_HW_DEPENDENT_RETURN_VOID ( 242 void 243 AcpiDbGenerateSci ( 244 void)) 245 246 void 247 AcpiDbExecuteTest ( 248 char *TypeArg); 249 250 251 /* 252 * dbconvert - miscellaneous conversion routines 253 */ 254 ACPI_STATUS 255 AcpiDbHexCharToValue ( 256 int HexChar, 257 UINT8 *ReturnValue); 258 259 ACPI_STATUS 260 AcpiDbConvertToPackage ( 261 char *String, 262 ACPI_OBJECT *Object); 263 264 ACPI_STATUS 265 AcpiDbConvertToObject ( 266 ACPI_OBJECT_TYPE Type, 267 char *String, 268 ACPI_OBJECT *Object); 269 270 UINT8 * 271 AcpiDbEncodePldBuffer ( 272 ACPI_PLD_INFO *PldInfo); 273 274 void 275 AcpiDbDumpPldBuffer ( 276 ACPI_OBJECT *ObjDesc); 277 278 279 /* 280 * dbmethod - control method commands 281 */ 282 void 283 AcpiDbSetMethodBreakpoint ( 284 char *Location, 285 ACPI_WALK_STATE *WalkState, 286 ACPI_PARSE_OBJECT *Op); 287 288 void 289 AcpiDbSetMethodCallBreakpoint ( 290 ACPI_PARSE_OBJECT *Op); 291 292 void 293 AcpiDbSetMethodData ( 294 char *TypeArg, 295 char *IndexArg, 296 char *ValueArg); 297 298 ACPI_STATUS 299 AcpiDbDisassembleMethod ( 300 char *Name); 301 302 void 303 AcpiDbDisassembleAml ( 304 char *Statements, 305 ACPI_PARSE_OBJECT *Op); 306 307 void 308 AcpiDbBatchExecute ( 309 char *CountArg); 310 311 312 /* 313 * dbnames - namespace commands 314 */ 315 void 316 AcpiDbSetScope ( 317 char *Name); 318 319 void 320 AcpiDbDumpNamespace ( 321 char *StartArg, 322 char *DepthArg); 323 324 void 325 AcpiDbDumpNamespacePaths ( 326 void); 327 328 void 329 AcpiDbDumpNamespaceByOwner ( 330 char *OwnerArg, 331 char *DepthArg); 332 333 ACPI_STATUS 334 AcpiDbFindNameInNamespace ( 335 char *NameArg); 336 337 void 338 AcpiDbCheckPredefinedNames ( 339 void); 340 341 ACPI_STATUS 342 AcpiDbDisplayObjects ( 343 char *ObjTypeArg, 344 char *DisplayCountArg); 345 346 void 347 AcpiDbCheckIntegrity ( 348 void); 349 350 void 351 AcpiDbFindReferences ( 352 char *ObjectArg); 353 354 void 355 AcpiDbGetBusInfo ( 356 void); 357 358 359 /* 360 * dbdisply - debug display commands 361 */ 362 void 363 AcpiDbDisplayMethodInfo ( 364 ACPI_PARSE_OBJECT *Op); 365 366 void 367 AcpiDbDecodeAndDisplayObject ( 368 char *Target, 369 char *OutputType); 370 371 ACPI_DBR_DEPENDENT_RETURN_VOID ( 372 void 373 AcpiDbDisplayResultObject ( 374 ACPI_OPERAND_OBJECT *ObjDesc, 375 ACPI_WALK_STATE *WalkState)) 376 377 ACPI_STATUS 378 AcpiDbDisplayAllMethods ( 379 char *DisplayCountArg); 380 381 void 382 AcpiDbDisplayArguments ( 383 void); 384 385 void 386 AcpiDbDisplayLocals ( 387 void); 388 389 void 390 AcpiDbDisplayResults ( 391 void); 392 393 void 394 AcpiDbDisplayCallingTree ( 395 void); 396 397 void 398 AcpiDbDisplayObjectType ( 399 char *ObjectArg); 400 401 ACPI_DBR_DEPENDENT_RETURN_VOID ( 402 void 403 AcpiDbDisplayArgumentObject ( 404 ACPI_OPERAND_OBJECT *ObjDesc, 405 ACPI_WALK_STATE *WalkState)) 406 407 408 /* 409 * dbexec - debugger control method execution 410 */ 411 void 412 AcpiDbExecute ( 413 char *Name, 414 char **Args, 415 ACPI_OBJECT_TYPE *Types, 416 UINT32 Flags); 417 418 void 419 AcpiDbCreateExecutionThreads ( 420 char *NumThreadsArg, 421 char *NumLoopsArg, 422 char *MethodNameArg); 423 424 void 425 AcpiDbDeleteObjects ( 426 UINT32 Count, 427 ACPI_OBJECT *Objects); 428 429 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 430 UINT32 431 AcpiDbGetCacheInfo ( 432 ACPI_MEMORY_LIST *Cache); 433 #endif 434 435 436 /* 437 * dbfileio - Debugger file I/O commands 438 */ 439 ACPI_OBJECT_TYPE 440 AcpiDbMatchArgument ( 441 char *UserArgument, 442 ACPI_DB_ARGUMENT_INFO *Arguments); 443 444 void 445 AcpiDbCloseDebugFile ( 446 void); 447 448 void 449 AcpiDbOpenDebugFile ( 450 char *Name); 451 452 ACPI_STATUS 453 AcpiDbLoadAcpiTable ( 454 char *Filename); 455 456 ACPI_STATUS 457 AcpiDbLoadTables ( 458 ACPI_NEW_TABLE_DESC *ListHead); 459 460 461 /* 462 * dbhistry - debugger HISTORY command 463 */ 464 void 465 AcpiDbAddToHistory ( 466 char *CommandLine); 467 468 void 469 AcpiDbDisplayHistory ( 470 void); 471 472 char * 473 AcpiDbGetFromHistory ( 474 char *CommandNumArg); 475 476 char * 477 AcpiDbGetHistoryByIndex ( 478 UINT32 CommanddNum); 479 480 481 /* 482 * dbinput - user front-end to the AML debugger 483 */ 484 ACPI_STATUS 485 AcpiDbCommandDispatch ( 486 char *InputBuffer, 487 ACPI_WALK_STATE *WalkState, 488 ACPI_PARSE_OBJECT *Op); 489 490 void ACPI_SYSTEM_XFACE 491 AcpiDbExecuteThread ( 492 void *Context); 493 494 ACPI_STATUS 495 AcpiDbUserCommands ( 496 char Prompt, 497 ACPI_PARSE_OBJECT *Op); 498 499 char * 500 AcpiDbGetNextToken ( 501 char *String, 502 char **Next, 503 ACPI_OBJECT_TYPE *ReturnType); 504 505 506 /* 507 * dbobject 508 */ 509 void 510 AcpiDbDecodeInternalObject ( 511 ACPI_OPERAND_OBJECT *ObjDesc); 512 513 void 514 AcpiDbDisplayInternalObject ( 515 ACPI_OPERAND_OBJECT *ObjDesc, 516 ACPI_WALK_STATE *WalkState); 517 518 void 519 AcpiDbDecodeArguments ( 520 ACPI_WALK_STATE *WalkState); 521 522 void 523 AcpiDbDecodeLocals ( 524 ACPI_WALK_STATE *WalkState); 525 526 void 527 AcpiDbDumpMethodInfo ( 528 ACPI_STATUS Status, 529 ACPI_WALK_STATE *WalkState); 530 531 532 /* 533 * dbstats - Generation and display of ACPI table statistics 534 */ 535 void 536 AcpiDbGenerateStatistics ( 537 ACPI_PARSE_OBJECT *Root, 538 BOOLEAN IsMethod); 539 540 ACPI_STATUS 541 AcpiDbDisplayStatistics ( 542 char *TypeArg); 543 544 545 /* 546 * dbutils - AML debugger utilities 547 */ 548 void 549 AcpiDbSetOutputDestination ( 550 UINT32 Where); 551 552 void 553 AcpiDbDumpExternalObject ( 554 ACPI_OBJECT *ObjDesc, 555 UINT32 Level); 556 557 void 558 AcpiDbPrepNamestring ( 559 char *Name); 560 561 ACPI_NAMESPACE_NODE * 562 AcpiDbLocalNsLookup ( 563 char *Name); 564 565 void 566 AcpiDbUint32ToHexString ( 567 UINT32 Value, 568 char *Buffer); 569 570 #endif /* __ACDEBUG_H__ */ 571