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