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 56 typedef struct acpi_db_command_info 57 { 58 const char *Name; /* Command Name */ 59 UINT8 MinArgs; /* Minimum arguments required */ 60 61 } ACPI_DB_COMMAND_INFO; 62 63 typedef struct acpi_db_command_help 64 { 65 UINT8 LineCount; /* Number of help lines */ 66 char *Invocation; /* Command Invocation */ 67 char *Description; /* Command Description */ 68 69 } ACPI_DB_COMMAND_HELP; 70 71 typedef struct acpi_db_argument_info 72 { 73 const char *Name; /* Argument Name */ 74 75 } ACPI_DB_ARGUMENT_INFO; 76 77 typedef struct acpi_db_execute_walk 78 { 79 UINT32 Count; 80 UINT32 MaxCount; 81 82 } ACPI_DB_EXECUTE_WALK; 83 84 85 #define PARAM_LIST(pl) pl 86 87 #define EX_NO_SINGLE_STEP 1 88 #define EX_SINGLE_STEP 2 89 90 91 /* 92 * dbxface - external debugger interfaces 93 */ 94 ACPI_DBR_DEPENDENT_RETURN_OK ( 95 ACPI_STATUS 96 AcpiDbSingleStep ( 97 ACPI_WALK_STATE *WalkState, 98 ACPI_PARSE_OBJECT *Op, 99 UINT32 OpType)) 100 101 ACPI_DBR_DEPENDENT_RETURN_VOID ( 102 void 103 AcpiDbSignalBreakPoint ( 104 ACPI_WALK_STATE *WalkState)) 105 106 107 /* 108 * dbcmds - debug commands and output routines 109 */ 110 ACPI_NAMESPACE_NODE * 111 AcpiDbConvertToNode ( 112 char *InString); 113 114 void 115 AcpiDbDisplayTableInfo ( 116 char *TableArg); 117 118 void 119 AcpiDbDisplayTemplate ( 120 char *BufferArg); 121 122 void 123 AcpiDbUnloadAcpiTable ( 124 char *Name); 125 126 void 127 AcpiDbSendNotify ( 128 char *Name, 129 UINT32 Value); 130 131 void 132 AcpiDbDisplayInterfaces ( 133 char *ActionArg, 134 char *InterfaceNameArg); 135 136 ACPI_STATUS 137 AcpiDbSleep ( 138 char *ObjectArg); 139 140 void 141 AcpiDbTrace ( 142 char *EnableArg, 143 char *MethodArg, 144 char *OnceArg); 145 146 void 147 AcpiDbDisplayLocks ( 148 void); 149 150 void 151 AcpiDbDisplayResources ( 152 char *ObjectArg); 153 154 ACPI_HW_DEPENDENT_RETURN_VOID ( 155 void 156 AcpiDbDisplayGpes ( 157 void)) 158 159 void 160 AcpiDbDisplayHandlers ( 161 void); 162 163 ACPI_HW_DEPENDENT_RETURN_VOID ( 164 void 165 AcpiDbGenerateGpe ( 166 char *GpeArg, 167 char *BlockArg)) 168 169 ACPI_HW_DEPENDENT_RETURN_VOID ( 170 void 171 AcpiDbGenerateSci ( 172 void)) 173 174 void 175 AcpiDbExecuteTest ( 176 char *TypeArg); 177 178 179 /* 180 * dbconvert - miscellaneous conversion routines 181 */ 182 ACPI_STATUS 183 AcpiDbHexCharToValue ( 184 int HexChar, 185 UINT8 *ReturnValue); 186 187 ACPI_STATUS 188 AcpiDbConvertToPackage ( 189 char *String, 190 ACPI_OBJECT *Object); 191 192 ACPI_STATUS 193 AcpiDbConvertToObject ( 194 ACPI_OBJECT_TYPE Type, 195 char *String, 196 ACPI_OBJECT *Object); 197 198 UINT8 * 199 AcpiDbEncodePldBuffer ( 200 ACPI_PLD_INFO *PldInfo); 201 202 void 203 AcpiDbDumpPldBuffer ( 204 ACPI_OBJECT *ObjDesc); 205 206 207 /* 208 * dbmethod - control method commands 209 */ 210 void 211 AcpiDbSetMethodBreakpoint ( 212 char *Location, 213 ACPI_WALK_STATE *WalkState, 214 ACPI_PARSE_OBJECT *Op); 215 216 void 217 AcpiDbSetMethodCallBreakpoint ( 218 ACPI_PARSE_OBJECT *Op); 219 220 void 221 AcpiDbSetMethodData ( 222 char *TypeArg, 223 char *IndexArg, 224 char *ValueArg); 225 226 ACPI_STATUS 227 AcpiDbDisassembleMethod ( 228 char *Name); 229 230 void 231 AcpiDbDisassembleAml ( 232 char *Statements, 233 ACPI_PARSE_OBJECT *Op); 234 235 void 236 AcpiDbEvaluatePredefinedNames ( 237 void); 238 239 240 /* 241 * dbnames - namespace commands 242 */ 243 void 244 AcpiDbSetScope ( 245 char *Name); 246 247 void 248 AcpiDbDumpNamespace ( 249 char *StartArg, 250 char *DepthArg); 251 252 void 253 AcpiDbDumpNamespacePaths ( 254 void); 255 256 void 257 AcpiDbDumpNamespaceByOwner ( 258 char *OwnerArg, 259 char *DepthArg); 260 261 ACPI_STATUS 262 AcpiDbFindNameInNamespace ( 263 char *NameArg); 264 265 void 266 AcpiDbCheckPredefinedNames ( 267 void); 268 269 ACPI_STATUS 270 AcpiDbDisplayObjects ( 271 char *ObjTypeArg, 272 char *DisplayCountArg); 273 274 void 275 AcpiDbCheckIntegrity ( 276 void); 277 278 void 279 AcpiDbFindReferences ( 280 char *ObjectArg); 281 282 void 283 AcpiDbGetBusInfo ( 284 void); 285 286 287 /* 288 * dbdisply - debug display commands 289 */ 290 void 291 AcpiDbDisplayMethodInfo ( 292 ACPI_PARSE_OBJECT *Op); 293 294 void 295 AcpiDbDecodeAndDisplayObject ( 296 char *Target, 297 char *OutputType); 298 299 ACPI_DBR_DEPENDENT_RETURN_VOID ( 300 void 301 AcpiDbDisplayResultObject ( 302 ACPI_OPERAND_OBJECT *ObjDesc, 303 ACPI_WALK_STATE *WalkState)) 304 305 ACPI_STATUS 306 AcpiDbDisplayAllMethods ( 307 char *DisplayCountArg); 308 309 void 310 AcpiDbDisplayArguments ( 311 void); 312 313 void 314 AcpiDbDisplayLocals ( 315 void); 316 317 void 318 AcpiDbDisplayResults ( 319 void); 320 321 void 322 AcpiDbDisplayCallingTree ( 323 void); 324 325 void 326 AcpiDbDisplayObjectType ( 327 char *ObjectArg); 328 329 ACPI_DBR_DEPENDENT_RETURN_VOID ( 330 void 331 AcpiDbDisplayArgumentObject ( 332 ACPI_OPERAND_OBJECT *ObjDesc, 333 ACPI_WALK_STATE *WalkState)) 334 335 336 /* 337 * dbexec - debugger control method execution 338 */ 339 void 340 AcpiDbExecute ( 341 char *Name, 342 char **Args, 343 ACPI_OBJECT_TYPE *Types, 344 UINT32 Flags); 345 346 void 347 AcpiDbCreateExecutionThread ( 348 char *MethodNameArg, 349 char **Arguments, 350 ACPI_OBJECT_TYPE *Types); 351 352 void 353 AcpiDbCreateExecutionThreads ( 354 char *NumThreadsArg, 355 char *NumLoopsArg, 356 char *MethodNameArg); 357 358 void 359 AcpiDbDeleteObjects ( 360 UINT32 Count, 361 ACPI_OBJECT *Objects); 362 363 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 364 UINT32 365 AcpiDbGetCacheInfo ( 366 ACPI_MEMORY_LIST *Cache); 367 #endif 368 369 370 /* 371 * dbfileio - Debugger file I/O commands 372 */ 373 ACPI_OBJECT_TYPE 374 AcpiDbMatchArgument ( 375 char *UserArgument, 376 ACPI_DB_ARGUMENT_INFO *Arguments); 377 378 void 379 AcpiDbCloseDebugFile ( 380 void); 381 382 void 383 AcpiDbOpenDebugFile ( 384 char *Name); 385 386 ACPI_STATUS 387 AcpiDbLoadAcpiTable ( 388 char *Filename); 389 390 ACPI_STATUS 391 AcpiDbLoadTables ( 392 ACPI_NEW_TABLE_DESC *ListHead); 393 394 395 /* 396 * dbhistry - debugger HISTORY command 397 */ 398 void 399 AcpiDbAddToHistory ( 400 char *CommandLine); 401 402 void 403 AcpiDbDisplayHistory ( 404 void); 405 406 char * 407 AcpiDbGetFromHistory ( 408 char *CommandNumArg); 409 410 char * 411 AcpiDbGetHistoryByIndex ( 412 UINT32 CommanddNum); 413 414 415 /* 416 * dbinput - user front-end to the AML debugger 417 */ 418 ACPI_STATUS 419 AcpiDbCommandDispatch ( 420 char *InputBuffer, 421 ACPI_WALK_STATE *WalkState, 422 ACPI_PARSE_OBJECT *Op); 423 424 void ACPI_SYSTEM_XFACE 425 AcpiDbExecuteThread ( 426 void *Context); 427 428 ACPI_STATUS 429 AcpiDbUserCommands ( 430 void); 431 432 char * 433 AcpiDbGetNextToken ( 434 char *String, 435 char **Next, 436 ACPI_OBJECT_TYPE *ReturnType); 437 438 439 /* 440 * dbobject 441 */ 442 void 443 AcpiDbDecodeInternalObject ( 444 ACPI_OPERAND_OBJECT *ObjDesc); 445 446 void 447 AcpiDbDisplayInternalObject ( 448 ACPI_OPERAND_OBJECT *ObjDesc, 449 ACPI_WALK_STATE *WalkState); 450 451 void 452 AcpiDbDecodeArguments ( 453 ACPI_WALK_STATE *WalkState); 454 455 void 456 AcpiDbDecodeLocals ( 457 ACPI_WALK_STATE *WalkState); 458 459 void 460 AcpiDbDumpMethodInfo ( 461 ACPI_STATUS Status, 462 ACPI_WALK_STATE *WalkState); 463 464 465 /* 466 * dbstats - Generation and display of ACPI table statistics 467 */ 468 void 469 AcpiDbGenerateStatistics ( 470 ACPI_PARSE_OBJECT *Root, 471 BOOLEAN IsMethod); 472 473 ACPI_STATUS 474 AcpiDbDisplayStatistics ( 475 char *TypeArg); 476 477 478 /* 479 * dbutils - AML debugger utilities 480 */ 481 void 482 AcpiDbSetOutputDestination ( 483 UINT32 Where); 484 485 void 486 AcpiDbDumpExternalObject ( 487 ACPI_OBJECT *ObjDesc, 488 UINT32 Level); 489 490 void 491 AcpiDbPrepNamestring ( 492 char *Name); 493 494 ACPI_NAMESPACE_NODE * 495 AcpiDbLocalNsLookup ( 496 char *Name); 497 498 void 499 AcpiDbUint32ToHexString ( 500 UINT32 Value, 501 char *Buffer); 502 503 #endif /* __ACDEBUG_H__ */ 504