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