1 /******************************************************************************
   2  *
   3  * Name: acdebug.h - ACPI/AML debugger
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, 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 /*
 168  * dbconvert - miscellaneous conversion routines
 169  */
 170 ACPI_STATUS
 171 AcpiDbHexCharToValue (
 172     int                     HexChar,
 173     UINT8                   *ReturnValue);
 174 
 175 ACPI_STATUS
 176 AcpiDbConvertToPackage (
 177     char                    *String,
 178     ACPI_OBJECT             *Object);
 179 
 180 ACPI_STATUS
 181 AcpiDbConvertToObject (
 182     ACPI_OBJECT_TYPE        Type,
 183     char                    *String,
 184     ACPI_OBJECT             *Object);
 185 
 186 UINT8 *
 187 AcpiDbEncodePldBuffer (
 188     ACPI_PLD_INFO           *PldInfo);
 189 
 190 void
 191 AcpiDbDumpPldBuffer (
 192     ACPI_OBJECT             *ObjDesc);
 193 
 194 
 195 /*
 196  * dbmethod - control method commands
 197  */
 198 void
 199 AcpiDbSetMethodBreakpoint (
 200     char                    *Location,
 201     ACPI_WALK_STATE         *WalkState,
 202     ACPI_PARSE_OBJECT       *Op);
 203 
 204 void
 205 AcpiDbSetMethodCallBreakpoint (
 206     ACPI_PARSE_OBJECT       *Op);
 207 
 208 void
 209 AcpiDbSetMethodData (
 210     char                    *TypeArg,
 211     char                    *IndexArg,
 212     char                    *ValueArg);
 213 
 214 ACPI_STATUS
 215 AcpiDbDisassembleMethod (
 216     char                    *Name);
 217 
 218 void
 219 AcpiDbDisassembleAml (
 220     char                    *Statements,
 221     ACPI_PARSE_OBJECT       *Op);
 222 
 223 void
 224 AcpiDbBatchExecute (
 225     char                    *CountArg);
 226 
 227 
 228 /*
 229  * dbnames - namespace commands
 230  */
 231 void
 232 AcpiDbSetScope (
 233     char                    *Name);
 234 
 235 void
 236 AcpiDbDumpNamespace (
 237     char                    *StartArg,
 238     char                    *DepthArg);
 239 
 240 void
 241 AcpiDbDumpNamespacePaths (
 242     void);
 243 
 244 void
 245 AcpiDbDumpNamespaceByOwner (
 246     char                    *OwnerArg,
 247     char                    *DepthArg);
 248 
 249 ACPI_STATUS
 250 AcpiDbFindNameInNamespace (
 251     char                    *NameArg);
 252 
 253 void
 254 AcpiDbCheckPredefinedNames (
 255     void);
 256 
 257 ACPI_STATUS
 258 AcpiDbDisplayObjects (
 259     char                    *ObjTypeArg,
 260     char                    *DisplayCountArg);
 261 
 262 void
 263 AcpiDbCheckIntegrity (
 264     void);
 265 
 266 void
 267 AcpiDbFindReferences (
 268     char                    *ObjectArg);
 269 
 270 void
 271 AcpiDbGetBusInfo (
 272     void);
 273 
 274 
 275 /*
 276  * dbdisply - debug display commands
 277  */
 278 void
 279 AcpiDbDisplayMethodInfo (
 280     ACPI_PARSE_OBJECT       *Op);
 281 
 282 void
 283 AcpiDbDecodeAndDisplayObject (
 284     char                    *Target,
 285     char                    *OutputType);
 286 
 287 void
 288 AcpiDbDisplayResultObject (
 289     ACPI_OPERAND_OBJECT     *ObjDesc,
 290     ACPI_WALK_STATE         *WalkState);
 291 
 292 ACPI_STATUS
 293 AcpiDbDisplayAllMethods (
 294     char                    *DisplayCountArg);
 295 
 296 void
 297 AcpiDbDisplayArguments (
 298     void);
 299 
 300 void
 301 AcpiDbDisplayLocals (
 302     void);
 303 
 304 void
 305 AcpiDbDisplayResults (
 306     void);
 307 
 308 void
 309 AcpiDbDisplayCallingTree (
 310     void);
 311 
 312 void
 313 AcpiDbDisplayObjectType (
 314     char                    *ObjectArg);
 315 
 316 void
 317 AcpiDbDisplayArgumentObject (
 318     ACPI_OPERAND_OBJECT     *ObjDesc,
 319     ACPI_WALK_STATE         *WalkState);
 320 
 321 
 322 /*
 323  * dbexec - debugger control method execution
 324  */
 325 void
 326 AcpiDbExecute (
 327     char                    *Name,
 328     char                    **Args,
 329     ACPI_OBJECT_TYPE        *Types,
 330     UINT32                  Flags);
 331 
 332 void
 333 AcpiDbCreateExecutionThreads (
 334     char                    *NumThreadsArg,
 335     char                    *NumLoopsArg,
 336     char                    *MethodNameArg);
 337 
 338 void
 339 AcpiDbDeleteObjects (
 340     UINT32                  Count,
 341     ACPI_OBJECT             *Objects);
 342 
 343 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 344 UINT32
 345 AcpiDbGetCacheInfo (
 346     ACPI_MEMORY_LIST        *Cache);
 347 #endif
 348 
 349 
 350 /*
 351  * dbfileio - Debugger file I/O commands
 352  */
 353 ACPI_OBJECT_TYPE
 354 AcpiDbMatchArgument (
 355     char                    *UserArgument,
 356     ACPI_DB_ARGUMENT_INFO   *Arguments);
 357 
 358 void
 359 AcpiDbCloseDebugFile (
 360     void);
 361 
 362 void
 363 AcpiDbOpenDebugFile (
 364     char                    *Name);
 365 
 366 ACPI_STATUS
 367 AcpiDbLoadAcpiTable (
 368     char                    *Filename);
 369 
 370 ACPI_STATUS
 371 AcpiDbGetTableFromFile (
 372     char                    *Filename,
 373     ACPI_TABLE_HEADER       **Table);
 374 
 375 ACPI_STATUS
 376 AcpiDbReadTableFromFile (
 377     char                    *Filename,
 378     ACPI_TABLE_HEADER       **Table);
 379 
 380 
 381 /*
 382  * dbhistry - debugger HISTORY command
 383  */
 384 void
 385 AcpiDbAddToHistory (
 386     char                    *CommandLine);
 387 
 388 void
 389 AcpiDbDisplayHistory (
 390     void);
 391 
 392 char *
 393 AcpiDbGetFromHistory (
 394     char                    *CommandNumArg);
 395 
 396 char *
 397 AcpiDbGetHistoryByIndex (
 398     UINT32                  CommanddNum);
 399 
 400 
 401 /*
 402  * dbinput - user front-end to the AML debugger
 403  */
 404 ACPI_STATUS
 405 AcpiDbCommandDispatch (
 406     char                    *InputBuffer,
 407     ACPI_WALK_STATE         *WalkState,
 408     ACPI_PARSE_OBJECT       *Op);
 409 
 410 void ACPI_SYSTEM_XFACE
 411 AcpiDbExecuteThread (
 412     void                    *Context);
 413 
 414 ACPI_STATUS
 415 AcpiDbUserCommands (
 416     char                    Prompt,
 417     ACPI_PARSE_OBJECT       *Op);
 418 
 419 char *
 420 AcpiDbGetNextToken (
 421     char                    *String,
 422     char                    **Next,
 423     ACPI_OBJECT_TYPE        *ReturnType);
 424 
 425 
 426 /*
 427  * dbstats - Generation and display of ACPI table statistics
 428  */
 429 void
 430 AcpiDbGenerateStatistics (
 431     ACPI_PARSE_OBJECT       *Root,
 432     BOOLEAN                 IsMethod);
 433 
 434 ACPI_STATUS
 435 AcpiDbDisplayStatistics (
 436     char                    *TypeArg);
 437 
 438 
 439 /*
 440  * dbutils - AML debugger utilities
 441  */
 442 void
 443 AcpiDbSetOutputDestination (
 444     UINT32                  Where);
 445 
 446 void
 447 AcpiDbDumpExternalObject (
 448     ACPI_OBJECT             *ObjDesc,
 449     UINT32                  Level);
 450 
 451 void
 452 AcpiDbPrepNamestring (
 453     char                    *Name);
 454 
 455 ACPI_NAMESPACE_NODE *
 456 AcpiDbLocalNsLookup (
 457     char                    *Name);
 458 
 459 void
 460 AcpiDbUint32ToHexString (
 461     UINT32                  Value,
 462     char                    *Buffer);
 463 
 464 #endif  /* __ACDEBUG_H__ */