xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h (revision 4fd62caa9acc437534c41bbb7d3fc9d53e915005)
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 - 2012, 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 
120 #define ACPI_DEBUG_BUFFER_SIZE  0x4000      /* 16K buffer for return objects */
121 
122 typedef struct CommandInfo
123 {
124     char                    *Name;          /* Command Name */
125     UINT8                   MinArgs;        /* Minimum arguments required */
126 
127 } COMMAND_INFO;
128 
129 typedef struct ArgumentInfo
130 {
131     char                    *Name;          /* Argument Name */
132 
133 } ARGUMENT_INFO;
134 
135 typedef struct acpi_execute_walk
136 {
137     UINT32                  Count;
138     UINT32                  MaxCount;
139 
140 } ACPI_EXECUTE_WALK;
141 
142 
143 #define PARAM_LIST(pl)                  pl
144 #define DBTEST_OUTPUT_LEVEL(lvl)        if (AcpiGbl_DbOpt_verbose)
145 #define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
146                                             AcpiOsPrintf PARAM_LIST(fp);}
147 
148 #define EX_NO_SINGLE_STEP               1
149 #define EX_SINGLE_STEP                  2
150 
151 
152 /*
153  * dbxface - external debugger interfaces
154  */
155 ACPI_STATUS
156 AcpiDbInitialize (
157     void);
158 
159 void
160 AcpiDbTerminate (
161     void);
162 
163 ACPI_STATUS
164 AcpiDbSingleStep (
165     ACPI_WALK_STATE         *WalkState,
166     ACPI_PARSE_OBJECT       *Op,
167     UINT32                  OpType);
168 
169 
170 /*
171  * dbcmds - debug commands and output routines
172  */
173 ACPI_NAMESPACE_NODE *
174 AcpiDbConvertToNode (
175     char                    *InString);
176 
177 void
178 AcpiDbDisplayTableInfo (
179     char                    *TableArg);
180 
181 void
182 AcpiDbDisplayTemplate (
183     char                    *BufferArg);
184 
185 void
186 AcpiDbUnloadAcpiTable (
187     char                    *Name);
188 
189 void
190 AcpiDbSendNotify (
191     char                    *Name,
192     UINT32                  Value);
193 
194 void
195 AcpiDbDisplayInterfaces (
196     char                    *ActionArg,
197     char                    *InterfaceNameArg);
198 
199 ACPI_STATUS
200 AcpiDbSleep (
201     char                    *ObjectArg);
202 
203 void
204 AcpiDbDisplayLocks (
205     void);
206 
207 void
208 AcpiDbDisplayResources (
209     char                    *ObjectArg);
210 
211 ACPI_HW_DEPENDENT_RETURN_VOID (
212 void
213 AcpiDbDisplayGpes (
214     void))
215 
216 void
217 AcpiDbDisplayHandlers (
218     void);
219 
220 ACPI_HW_DEPENDENT_RETURN_VOID (
221 void
222 AcpiDbGenerateGpe (
223     char                    *GpeArg,
224     char                    *BlockArg))
225 
226 
227 /*
228  * dbmethod - control method commands
229  */
230 void
231 AcpiDbSetMethodBreakpoint (
232     char                    *Location,
233     ACPI_WALK_STATE         *WalkState,
234     ACPI_PARSE_OBJECT       *Op);
235 
236 void
237 AcpiDbSetMethodCallBreakpoint (
238     ACPI_PARSE_OBJECT       *Op);
239 
240 void
241 AcpiDbSetMethodData (
242     char                    *TypeArg,
243     char                    *IndexArg,
244     char                    *ValueArg);
245 
246 ACPI_STATUS
247 AcpiDbDisassembleMethod (
248     char                    *Name);
249 
250 void
251 AcpiDbDisassembleAml (
252     char                    *Statements,
253     ACPI_PARSE_OBJECT       *Op);
254 
255 void
256 AcpiDbBatchExecute (
257     char                    *CountArg);
258 
259 
260 /*
261  * dbnames - namespace commands
262  */
263 void
264 AcpiDbSetScope (
265     char                    *Name);
266 
267 void
268 AcpiDbDumpNamespace (
269     char                    *StartArg,
270     char                    *DepthArg);
271 
272 void
273 AcpiDbDumpNamespaceByOwner (
274     char                    *OwnerArg,
275     char                    *DepthArg);
276 
277 ACPI_STATUS
278 AcpiDbFindNameInNamespace (
279     char                    *NameArg);
280 
281 void
282 AcpiDbCheckPredefinedNames (
283     void);
284 
285 ACPI_STATUS
286 AcpiDbDisplayObjects (
287     char                    *ObjTypeArg,
288     char                    *DisplayCountArg);
289 
290 void
291 AcpiDbCheckIntegrity (
292     void);
293 
294 void
295 AcpiDbFindReferences (
296     char                    *ObjectArg);
297 
298 void
299 AcpiDbGetBusInfo (
300     void);
301 
302 
303 /*
304  * dbdisply - debug display commands
305  */
306 void
307 AcpiDbDisplayMethodInfo (
308     ACPI_PARSE_OBJECT       *Op);
309 
310 void
311 AcpiDbDecodeAndDisplayObject (
312     char                    *Target,
313     char                    *OutputType);
314 
315 void
316 AcpiDbDisplayResultObject (
317     ACPI_OPERAND_OBJECT     *ObjDesc,
318     ACPI_WALK_STATE         *WalkState);
319 
320 ACPI_STATUS
321 AcpiDbDisplayAllMethods (
322     char                    *DisplayCountArg);
323 
324 void
325 AcpiDbDisplayArguments (
326     void);
327 
328 void
329 AcpiDbDisplayLocals (
330     void);
331 
332 void
333 AcpiDbDisplayResults (
334     void);
335 
336 void
337 AcpiDbDisplayCallingTree (
338     void);
339 
340 void
341 AcpiDbDisplayObjectType (
342     char                    *ObjectArg);
343 
344 void
345 AcpiDbDisplayArgumentObject (
346     ACPI_OPERAND_OBJECT     *ObjDesc,
347     ACPI_WALK_STATE         *WalkState);
348 
349 
350 /*
351  * dbexec - debugger control method execution
352  */
353 void
354 AcpiDbExecute (
355     char                    *Name,
356     char                    **Args,
357     ACPI_OBJECT_TYPE        *Types,
358     UINT32                  Flags);
359 
360 void
361 AcpiDbCreateExecutionThreads (
362     char                    *NumThreadsArg,
363     char                    *NumLoopsArg,
364     char                    *MethodNameArg);
365 
366 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
367 UINT32
368 AcpiDbGetCacheInfo (
369     ACPI_MEMORY_LIST        *Cache);
370 #endif
371 
372 
373 /*
374  * dbfileio - Debugger file I/O commands
375  */
376 ACPI_OBJECT_TYPE
377 AcpiDbMatchArgument (
378     char                    *UserArgument,
379     ARGUMENT_INFO           *Arguments);
380 
381 void
382 AcpiDbCloseDebugFile (
383     void);
384 
385 void
386 AcpiDbOpenDebugFile (
387     char                    *Name);
388 
389 ACPI_STATUS
390 AcpiDbLoadAcpiTable (
391     char                    *Filename);
392 
393 ACPI_STATUS
394 AcpiDbGetTableFromFile (
395     char                    *Filename,
396     ACPI_TABLE_HEADER       **Table);
397 
398 ACPI_STATUS
399 AcpiDbReadTableFromFile (
400     char                    *Filename,
401     ACPI_TABLE_HEADER       **Table);
402 
403 
404 /*
405  * dbhistry - debugger HISTORY command
406  */
407 void
408 AcpiDbAddToHistory (
409     char                    *CommandLine);
410 
411 void
412 AcpiDbDisplayHistory (
413     void);
414 
415 char *
416 AcpiDbGetFromHistory (
417     char                    *CommandNumArg);
418 
419 
420 /*
421  * dbinput - user front-end to the AML debugger
422  */
423 ACPI_STATUS
424 AcpiDbCommandDispatch (
425     char                    *InputBuffer,
426     ACPI_WALK_STATE         *WalkState,
427     ACPI_PARSE_OBJECT       *Op);
428 
429 void ACPI_SYSTEM_XFACE
430 AcpiDbExecuteThread (
431     void                    *Context);
432 
433 ACPI_STATUS
434 AcpiDbUserCommands (
435     char                    Prompt,
436     ACPI_PARSE_OBJECT       *Op);
437 
438 char *
439 AcpiDbGetNextToken (
440     char                    *String,
441     char                    **Next,
442     ACPI_OBJECT_TYPE        *ReturnType);
443 
444 
445 /*
446  * dbstats - Generation and display of ACPI table statistics
447  */
448 void
449 AcpiDbGenerateStatistics (
450     ACPI_PARSE_OBJECT       *Root,
451     BOOLEAN                 IsMethod);
452 
453 ACPI_STATUS
454 AcpiDbDisplayStatistics (
455     char                    *TypeArg);
456 
457 
458 /*
459  * dbutils - AML debugger utilities
460  */
461 void
462 AcpiDbSetOutputDestination (
463     UINT32                  Where);
464 
465 void
466 AcpiDbDumpExternalObject (
467     ACPI_OBJECT             *ObjDesc,
468     UINT32                  Level);
469 
470 void
471 AcpiDbPrepNamestring (
472     char                    *Name);
473 
474 ACPI_NAMESPACE_NODE *
475 AcpiDbLocalNsLookup (
476     char                    *Name);
477 
478 void
479 AcpiDbUint32ToHexString (
480     UINT32                  Value,
481     char                    *Buffer);
482 
483 #endif  /* __ACDEBUG_H__ */
484