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