xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h (revision f0650dc98fed895fc134a359aab99c27de6a0c6a)
1 /******************************************************************************
2  *
3  * Name: acdebug.h - ACPI/AML debugger
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef __ACDEBUG_H__
117 #define __ACDEBUG_H__
118 
119 /* The debugger is used in conjunction with the disassembler most of time */
120 
121 #ifdef ACPI_DISASSEMBLER
122 #include "acdisasm.h"
123 #endif
124 
125 
126 #define ACPI_DEBUG_BUFFER_SIZE  0x4000      /* 16K buffer for return objects */
127 
128 typedef struct acpi_db_command_info
129 {
130     char                    *Name;          /* Command Name */
131     UINT8                   MinArgs;        /* Minimum arguments required */
132 
133 } ACPI_DB_COMMAND_INFO;
134 
135 typedef struct acpi_db_command_help
136 {
137     UINT8                   LineCount;      /* Number of help lines */
138     char                    *Invocation;    /* Command Invocation */
139     char                    *Description;   /* Command Description */
140 
141 } ACPI_DB_COMMAND_HELP;
142 
143 typedef struct acpi_db_argument_info
144 {
145     char                    *Name;          /* Argument Name */
146 
147 } ACPI_DB_ARGUMENT_INFO;
148 
149 typedef struct acpi_db_execute_walk
150 {
151     UINT32                  Count;
152     UINT32                  MaxCount;
153 
154 } ACPI_DB_EXECUTE_WALK;
155 
156 
157 #define PARAM_LIST(pl)                  pl
158 
159 #define EX_NO_SINGLE_STEP               1
160 #define EX_SINGLE_STEP                  2
161 
162 
163 /*
164  * dbxface - external debugger interfaces
165  */
166 ACPI_STATUS
167 AcpiDbSingleStep (
168     ACPI_WALK_STATE         *WalkState,
169     ACPI_PARSE_OBJECT       *Op,
170     UINT32                  OpType);
171 
172 
173 /*
174  * dbcmds - debug commands and output routines
175  */
176 ACPI_NAMESPACE_NODE *
177 AcpiDbConvertToNode (
178     char                    *InString);
179 
180 void
181 AcpiDbDisplayTableInfo (
182     char                    *TableArg);
183 
184 void
185 AcpiDbDisplayTemplate (
186     char                    *BufferArg);
187 
188 void
189 AcpiDbUnloadAcpiTable (
190     char                    *Name);
191 
192 void
193 AcpiDbSendNotify (
194     char                    *Name,
195     UINT32                  Value);
196 
197 void
198 AcpiDbDisplayInterfaces (
199     char                    *ActionArg,
200     char                    *InterfaceNameArg);
201 
202 ACPI_STATUS
203 AcpiDbSleep (
204     char                    *ObjectArg);
205 
206 void
207 AcpiDbTrace (
208     char                    *EnableArg,
209     char                    *MethodArg,
210     char                    *OnceArg);
211 
212 void
213 AcpiDbDisplayLocks (
214     void);
215 
216 void
217 AcpiDbDisplayResources (
218     char                    *ObjectArg);
219 
220 ACPI_HW_DEPENDENT_RETURN_VOID (
221 void
222 AcpiDbDisplayGpes (
223     void))
224 
225 void
226 AcpiDbDisplayHandlers (
227     void);
228 
229 ACPI_HW_DEPENDENT_RETURN_VOID (
230 void
231 AcpiDbGenerateGpe (
232     char                    *GpeArg,
233     char                    *BlockArg))
234 
235 ACPI_HW_DEPENDENT_RETURN_VOID (
236 void
237 AcpiDbGenerateSci (
238     void))
239 
240 void
241 AcpiDbExecuteTest (
242     char                    *TypeArg);
243 
244 
245 /*
246  * dbconvert - miscellaneous conversion routines
247  */
248 ACPI_STATUS
249 AcpiDbHexCharToValue (
250     int                     HexChar,
251     UINT8                   *ReturnValue);
252 
253 ACPI_STATUS
254 AcpiDbConvertToPackage (
255     char                    *String,
256     ACPI_OBJECT             *Object);
257 
258 ACPI_STATUS
259 AcpiDbConvertToObject (
260     ACPI_OBJECT_TYPE        Type,
261     char                    *String,
262     ACPI_OBJECT             *Object);
263 
264 UINT8 *
265 AcpiDbEncodePldBuffer (
266     ACPI_PLD_INFO           *PldInfo);
267 
268 void
269 AcpiDbDumpPldBuffer (
270     ACPI_OBJECT             *ObjDesc);
271 
272 
273 /*
274  * dbmethod - control method commands
275  */
276 void
277 AcpiDbSetMethodBreakpoint (
278     char                    *Location,
279     ACPI_WALK_STATE         *WalkState,
280     ACPI_PARSE_OBJECT       *Op);
281 
282 void
283 AcpiDbSetMethodCallBreakpoint (
284     ACPI_PARSE_OBJECT       *Op);
285 
286 void
287 AcpiDbSetMethodData (
288     char                    *TypeArg,
289     char                    *IndexArg,
290     char                    *ValueArg);
291 
292 ACPI_STATUS
293 AcpiDbDisassembleMethod (
294     char                    *Name);
295 
296 void
297 AcpiDbDisassembleAml (
298     char                    *Statements,
299     ACPI_PARSE_OBJECT       *Op);
300 
301 void
302 AcpiDbBatchExecute (
303     char                    *CountArg);
304 
305 
306 /*
307  * dbnames - namespace commands
308  */
309 void
310 AcpiDbSetScope (
311     char                    *Name);
312 
313 void
314 AcpiDbDumpNamespace (
315     char                    *StartArg,
316     char                    *DepthArg);
317 
318 void
319 AcpiDbDumpNamespacePaths (
320     void);
321 
322 void
323 AcpiDbDumpNamespaceByOwner (
324     char                    *OwnerArg,
325     char                    *DepthArg);
326 
327 ACPI_STATUS
328 AcpiDbFindNameInNamespace (
329     char                    *NameArg);
330 
331 void
332 AcpiDbCheckPredefinedNames (
333     void);
334 
335 ACPI_STATUS
336 AcpiDbDisplayObjects (
337     char                    *ObjTypeArg,
338     char                    *DisplayCountArg);
339 
340 void
341 AcpiDbCheckIntegrity (
342     void);
343 
344 void
345 AcpiDbFindReferences (
346     char                    *ObjectArg);
347 
348 void
349 AcpiDbGetBusInfo (
350     void);
351 
352 
353 /*
354  * dbdisply - debug display commands
355  */
356 void
357 AcpiDbDisplayMethodInfo (
358     ACPI_PARSE_OBJECT       *Op);
359 
360 void
361 AcpiDbDecodeAndDisplayObject (
362     char                    *Target,
363     char                    *OutputType);
364 
365 void
366 AcpiDbDisplayResultObject (
367     ACPI_OPERAND_OBJECT     *ObjDesc,
368     ACPI_WALK_STATE         *WalkState);
369 
370 ACPI_STATUS
371 AcpiDbDisplayAllMethods (
372     char                    *DisplayCountArg);
373 
374 void
375 AcpiDbDisplayArguments (
376     void);
377 
378 void
379 AcpiDbDisplayLocals (
380     void);
381 
382 void
383 AcpiDbDisplayResults (
384     void);
385 
386 void
387 AcpiDbDisplayCallingTree (
388     void);
389 
390 void
391 AcpiDbDisplayObjectType (
392     char                    *ObjectArg);
393 
394 void
395 AcpiDbDisplayArgumentObject (
396     ACPI_OPERAND_OBJECT     *ObjDesc,
397     ACPI_WALK_STATE         *WalkState);
398 
399 
400 /*
401  * dbexec - debugger control method execution
402  */
403 void
404 AcpiDbExecute (
405     char                    *Name,
406     char                    **Args,
407     ACPI_OBJECT_TYPE        *Types,
408     UINT32                  Flags);
409 
410 void
411 AcpiDbCreateExecutionThreads (
412     char                    *NumThreadsArg,
413     char                    *NumLoopsArg,
414     char                    *MethodNameArg);
415 
416 void
417 AcpiDbDeleteObjects (
418     UINT32                  Count,
419     ACPI_OBJECT             *Objects);
420 
421 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
422 UINT32
423 AcpiDbGetCacheInfo (
424     ACPI_MEMORY_LIST        *Cache);
425 #endif
426 
427 
428 /*
429  * dbfileio - Debugger file I/O commands
430  */
431 ACPI_OBJECT_TYPE
432 AcpiDbMatchArgument (
433     char                    *UserArgument,
434     ACPI_DB_ARGUMENT_INFO   *Arguments);
435 
436 void
437 AcpiDbCloseDebugFile (
438     void);
439 
440 void
441 AcpiDbOpenDebugFile (
442     char                    *Name);
443 
444 ACPI_STATUS
445 AcpiDbLoadAcpiTable (
446     char                    *Filename);
447 
448 ACPI_STATUS
449 AcpiDbGetTableFromFile (
450     char                    *Filename,
451     ACPI_TABLE_HEADER       **Table,
452     BOOLEAN                 MustBeAmlTable);
453 
454 
455 /*
456  * dbhistry - debugger HISTORY command
457  */
458 void
459 AcpiDbAddToHistory (
460     char                    *CommandLine);
461 
462 void
463 AcpiDbDisplayHistory (
464     void);
465 
466 char *
467 AcpiDbGetFromHistory (
468     char                    *CommandNumArg);
469 
470 char *
471 AcpiDbGetHistoryByIndex (
472     UINT32                  CommanddNum);
473 
474 
475 /*
476  * dbinput - user front-end to the AML debugger
477  */
478 ACPI_STATUS
479 AcpiDbCommandDispatch (
480     char                    *InputBuffer,
481     ACPI_WALK_STATE         *WalkState,
482     ACPI_PARSE_OBJECT       *Op);
483 
484 void ACPI_SYSTEM_XFACE
485 AcpiDbExecuteThread (
486     void                    *Context);
487 
488 ACPI_STATUS
489 AcpiDbUserCommands (
490     char                    Prompt,
491     ACPI_PARSE_OBJECT       *Op);
492 
493 char *
494 AcpiDbGetNextToken (
495     char                    *String,
496     char                    **Next,
497     ACPI_OBJECT_TYPE        *ReturnType);
498 
499 
500 /*
501  * dbobject
502  */
503 void
504 AcpiDbDecodeInternalObject (
505     ACPI_OPERAND_OBJECT     *ObjDesc);
506 
507 void
508 AcpiDbDisplayInternalObject (
509     ACPI_OPERAND_OBJECT     *ObjDesc,
510     ACPI_WALK_STATE         *WalkState);
511 
512 void
513 AcpiDbDecodeArguments (
514     ACPI_WALK_STATE         *WalkState);
515 
516 void
517 AcpiDbDecodeLocals (
518     ACPI_WALK_STATE         *WalkState);
519 
520 void
521 AcpiDbDumpMethodInfo (
522     ACPI_STATUS             Status,
523     ACPI_WALK_STATE         *WalkState);
524 
525 
526 /*
527  * dbstats - Generation and display of ACPI table statistics
528  */
529 void
530 AcpiDbGenerateStatistics (
531     ACPI_PARSE_OBJECT       *Root,
532     BOOLEAN                 IsMethod);
533 
534 ACPI_STATUS
535 AcpiDbDisplayStatistics (
536     char                    *TypeArg);
537 
538 
539 /*
540  * dbutils - AML debugger utilities
541  */
542 void
543 AcpiDbSetOutputDestination (
544     UINT32                  Where);
545 
546 void
547 AcpiDbDumpExternalObject (
548     ACPI_OBJECT             *ObjDesc,
549     UINT32                  Level);
550 
551 void
552 AcpiDbPrepNamestring (
553     char                    *Name);
554 
555 ACPI_NAMESPACE_NODE *
556 AcpiDbLocalNsLookup (
557     char                    *Name);
558 
559 void
560 AcpiDbUint32ToHexString (
561     UINT32                  Value,
562     char                    *Buffer);
563 
564 #endif  /* __ACDEBUG_H__ */
565