1 /****************************************************************************** 2 * 3 * Name: acdebug.h - ACPI/AML debugger 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2019, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef __ACDEBUG_H__ 45 #define __ACDEBUG_H__ 46 47 /* The debugger is used in conjunction with the disassembler most of time */ 48 49 #ifdef ACPI_DISASSEMBLER 50 #include "acdisasm.h" 51 #endif 52 53 54 #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ 55 #define ACPI_DEBUG_LENGTH_FORMAT " (%.4X bits, %.3X bytes)" 56 57 typedef struct acpi_db_command_info 58 { 59 const char *Name; /* Command Name */ 60 UINT8 MinArgs; /* Minimum arguments required */ 61 62 } ACPI_DB_COMMAND_INFO; 63 64 typedef struct acpi_db_command_help 65 { 66 UINT8 LineCount; /* Number of help lines */ 67 char *Invocation; /* Command Invocation */ 68 char *Description; /* Command Description */ 69 70 } ACPI_DB_COMMAND_HELP; 71 72 typedef struct acpi_db_argument_info 73 { 74 const char *Name; /* Argument Name */ 75 76 } ACPI_DB_ARGUMENT_INFO; 77 78 typedef struct acpi_db_execute_walk 79 { 80 UINT32 Count; 81 UINT32 MaxCount; 82 83 } ACPI_DB_EXECUTE_WALK; 84 85 86 #define PARAM_LIST(pl) pl 87 88 #define EX_NO_SINGLE_STEP 1 89 #define EX_SINGLE_STEP 2 90 91 92 /* 93 * dbxface - external debugger interfaces 94 */ 95 ACPI_DBR_DEPENDENT_RETURN_OK ( 96 ACPI_STATUS 97 AcpiDbSingleStep ( 98 ACPI_WALK_STATE *WalkState, 99 ACPI_PARSE_OBJECT *Op, 100 UINT32 OpType)) 101 102 ACPI_DBR_DEPENDENT_RETURN_VOID ( 103 void 104 AcpiDbSignalBreakPoint ( 105 ACPI_WALK_STATE *WalkState)) 106 107 108 /* 109 * dbcmds - debug commands and output routines 110 */ 111 ACPI_NAMESPACE_NODE * 112 AcpiDbConvertToNode ( 113 char *InString); 114 115 void 116 AcpiDbDisplayTableInfo ( 117 char *TableArg); 118 119 void 120 AcpiDbDisplayTemplate ( 121 char *BufferArg); 122 123 void 124 AcpiDbUnloadAcpiTable ( 125 char *Name); 126 127 void 128 AcpiDbSendNotify ( 129 char *Name, 130 UINT32 Value); 131 132 void 133 AcpiDbDisplayInterfaces ( 134 char *ActionArg, 135 char *InterfaceNameArg); 136 137 ACPI_STATUS 138 AcpiDbSleep ( 139 char *ObjectArg); 140 141 void 142 AcpiDbTrace ( 143 char *EnableArg, 144 char *MethodArg, 145 char *OnceArg); 146 147 void 148 AcpiDbDisplayLocks ( 149 void); 150 151 void 152 AcpiDbDisplayResources ( 153 char *ObjectArg); 154 155 ACPI_HW_DEPENDENT_RETURN_VOID ( 156 void 157 AcpiDbDisplayGpes ( 158 void)) 159 160 void 161 AcpiDbDisplayHandlers ( 162 void); 163 164 ACPI_HW_DEPENDENT_RETURN_VOID ( 165 void 166 AcpiDbGenerateGpe ( 167 char *GpeArg, 168 char *BlockArg)) 169 170 ACPI_HW_DEPENDENT_RETURN_VOID ( 171 void 172 AcpiDbGenerateSci ( 173 void)) 174 175 void 176 AcpiDbExecuteTest ( 177 char *TypeArg); 178 179 180 /* 181 * dbconvert - miscellaneous conversion routines 182 */ 183 ACPI_STATUS 184 AcpiDbHexCharToValue ( 185 int HexChar, 186 UINT8 *ReturnValue); 187 188 ACPI_STATUS 189 AcpiDbConvertToPackage ( 190 char *String, 191 ACPI_OBJECT *Object); 192 193 ACPI_STATUS 194 AcpiDbConvertToObject ( 195 ACPI_OBJECT_TYPE Type, 196 char *String, 197 ACPI_OBJECT *Object); 198 199 UINT8 * 200 AcpiDbEncodePldBuffer ( 201 ACPI_PLD_INFO *PldInfo); 202 203 void 204 AcpiDbDumpPldBuffer ( 205 ACPI_OBJECT *ObjDesc); 206 207 208 /* 209 * dbmethod - control method commands 210 */ 211 void 212 AcpiDbSetMethodBreakpoint ( 213 char *Location, 214 ACPI_WALK_STATE *WalkState, 215 ACPI_PARSE_OBJECT *Op); 216 217 void 218 AcpiDbSetMethodCallBreakpoint ( 219 ACPI_PARSE_OBJECT *Op); 220 221 void 222 AcpiDbSetMethodData ( 223 char *TypeArg, 224 char *IndexArg, 225 char *ValueArg); 226 227 ACPI_STATUS 228 AcpiDbDisassembleMethod ( 229 char *Name); 230 231 void 232 AcpiDbDisassembleAml ( 233 char *Statements, 234 ACPI_PARSE_OBJECT *Op); 235 236 void 237 AcpiDbEvaluatePredefinedNames ( 238 void); 239 240 241 /* 242 * dbnames - namespace commands 243 */ 244 void 245 AcpiDbSetScope ( 246 char *Name); 247 248 void 249 AcpiDbDumpNamespace ( 250 char *StartArg, 251 char *DepthArg); 252 253 void 254 AcpiDbDumpNamespacePaths ( 255 void); 256 257 void 258 AcpiDbDumpNamespaceByOwner ( 259 char *OwnerArg, 260 char *DepthArg); 261 262 ACPI_STATUS 263 AcpiDbFindNameInNamespace ( 264 char *NameArg); 265 266 void 267 AcpiDbCheckPredefinedNames ( 268 void); 269 270 ACPI_STATUS 271 AcpiDbDisplayObjects ( 272 char *ObjTypeArg, 273 char *DisplayCountArg); 274 275 void 276 AcpiDbCheckIntegrity ( 277 void); 278 279 void 280 AcpiDbFindReferences ( 281 char *ObjectArg); 282 283 void 284 AcpiDbGetBusInfo ( 285 void); 286 287 288 /* 289 * dbdisply - debug display commands 290 */ 291 void 292 AcpiDbDisplayMethodInfo ( 293 ACPI_PARSE_OBJECT *Op); 294 295 void 296 AcpiDbDecodeAndDisplayObject ( 297 char *Target, 298 char *OutputType); 299 300 ACPI_DBR_DEPENDENT_RETURN_VOID ( 301 void 302 AcpiDbDisplayResultObject ( 303 ACPI_OPERAND_OBJECT *ObjDesc, 304 ACPI_WALK_STATE *WalkState)) 305 306 ACPI_STATUS 307 AcpiDbDisplayAllMethods ( 308 char *DisplayCountArg); 309 310 void 311 AcpiDbDisplayArguments ( 312 void); 313 314 void 315 AcpiDbDisplayLocals ( 316 void); 317 318 void 319 AcpiDbDisplayResults ( 320 void); 321 322 void 323 AcpiDbDisplayCallingTree ( 324 void); 325 326 void 327 AcpiDbDisplayObjectType ( 328 char *ObjectArg); 329 330 ACPI_DBR_DEPENDENT_RETURN_VOID ( 331 void 332 AcpiDbDisplayArgumentObject ( 333 ACPI_OPERAND_OBJECT *ObjDesc, 334 ACPI_WALK_STATE *WalkState)) 335 336 337 /* 338 * dbexec - debugger control method execution 339 */ 340 void 341 AcpiDbExecute ( 342 char *Name, 343 char **Args, 344 ACPI_OBJECT_TYPE *Types, 345 UINT32 Flags); 346 347 void 348 AcpiDbCreateExecutionThread ( 349 char *MethodNameArg, 350 char **Arguments, 351 ACPI_OBJECT_TYPE *Types); 352 353 void 354 AcpiDbCreateExecutionThreads ( 355 char *NumThreadsArg, 356 char *NumLoopsArg, 357 char *MethodNameArg); 358 359 void 360 AcpiDbDeleteObjects ( 361 UINT32 Count, 362 ACPI_OBJECT *Objects); 363 364 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 365 UINT32 366 AcpiDbGetCacheInfo ( 367 ACPI_MEMORY_LIST *Cache); 368 #endif 369 370 371 /* 372 * dbfileio - Debugger file I/O commands 373 */ 374 ACPI_OBJECT_TYPE 375 AcpiDbMatchArgument ( 376 char *UserArgument, 377 ACPI_DB_ARGUMENT_INFO *Arguments); 378 379 void 380 AcpiDbCloseDebugFile ( 381 void); 382 383 void 384 AcpiDbOpenDebugFile ( 385 char *Name); 386 387 ACPI_STATUS 388 AcpiDbLoadAcpiTable ( 389 char *Filename); 390 391 ACPI_STATUS 392 AcpiDbLoadTables ( 393 ACPI_NEW_TABLE_DESC *ListHead); 394 395 396 /* 397 * dbhistry - debugger HISTORY command 398 */ 399 void 400 AcpiDbAddToHistory ( 401 char *CommandLine); 402 403 void 404 AcpiDbDisplayHistory ( 405 void); 406 407 char * 408 AcpiDbGetFromHistory ( 409 char *CommandNumArg); 410 411 char * 412 AcpiDbGetHistoryByIndex ( 413 UINT32 CommanddNum); 414 415 416 /* 417 * dbinput - user front-end to the AML debugger 418 */ 419 ACPI_STATUS 420 AcpiDbCommandDispatch ( 421 char *InputBuffer, 422 ACPI_WALK_STATE *WalkState, 423 ACPI_PARSE_OBJECT *Op); 424 425 void ACPI_SYSTEM_XFACE 426 AcpiDbExecuteThread ( 427 void *Context); 428 429 ACPI_STATUS 430 AcpiDbUserCommands ( 431 void); 432 433 char * 434 AcpiDbGetNextToken ( 435 char *String, 436 char **Next, 437 ACPI_OBJECT_TYPE *ReturnType); 438 439 440 /* 441 * dbobject 442 */ 443 void 444 AcpiDbDecodeInternalObject ( 445 ACPI_OPERAND_OBJECT *ObjDesc); 446 447 void 448 AcpiDbDisplayInternalObject ( 449 ACPI_OPERAND_OBJECT *ObjDesc, 450 ACPI_WALK_STATE *WalkState); 451 452 void 453 AcpiDbDecodeArguments ( 454 ACPI_WALK_STATE *WalkState); 455 456 void 457 AcpiDbDecodeLocals ( 458 ACPI_WALK_STATE *WalkState); 459 460 void 461 AcpiDbDumpMethodInfo ( 462 ACPI_STATUS Status, 463 ACPI_WALK_STATE *WalkState); 464 465 466 /* 467 * dbstats - Generation and display of ACPI table statistics 468 */ 469 void 470 AcpiDbGenerateStatistics ( 471 ACPI_PARSE_OBJECT *Root, 472 BOOLEAN IsMethod); 473 474 ACPI_STATUS 475 AcpiDbDisplayStatistics ( 476 char *TypeArg); 477 478 479 /* 480 * dbutils - AML debugger utilities 481 */ 482 void 483 AcpiDbSetOutputDestination ( 484 UINT32 Where); 485 486 void 487 AcpiDbDumpExternalObject ( 488 ACPI_OBJECT *ObjDesc, 489 UINT32 Level); 490 491 void 492 AcpiDbPrepNamestring ( 493 char *Name); 494 495 ACPI_NAMESPACE_NODE * 496 AcpiDbLocalNsLookup ( 497 char *Name); 498 499 void 500 AcpiDbUint32ToHexString ( 501 UINT32 Value, 502 char *Buffer); 503 504 #endif /* __ACDEBUG_H__ */ 505