xref: /freebsd/sys/contrib/dev/acpica/include/acdebug.h (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
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 /* The debugger is used in conjunction with the disassembler most of time */
48 
49 #ifdef ACPI_DISASSEMBLER
50 #include <contrib/dev/acpica/include/acdisasm.h>
51 #endif
52 
53 
54 #define ACPI_DEBUG_BUFFER_SIZE  0x4000      /* 16K buffer for return objects */
55 
56 typedef struct acpi_db_command_info
57 {
58     char                    *Name;          /* Command Name */
59     UINT8                   MinArgs;        /* Minimum arguments required */
60 
61 } ACPI_DB_COMMAND_INFO;
62 
63 typedef struct acpi_db_command_help
64 {
65     UINT8                   LineCount;      /* Number of help lines */
66     char                    *Invocation;    /* Command Invocation */
67     char                    *Description;   /* Command Description */
68 
69 } ACPI_DB_COMMAND_HELP;
70 
71 typedef struct acpi_db_argument_info
72 {
73     char                    *Name;          /* Argument Name */
74 
75 } ACPI_DB_ARGUMENT_INFO;
76 
77 typedef struct acpi_db_execute_walk
78 {
79     UINT32                  Count;
80     UINT32                  MaxCount;
81 
82 } ACPI_DB_EXECUTE_WALK;
83 
84 
85 #define PARAM_LIST(pl)                  pl
86 
87 #define EX_NO_SINGLE_STEP               1
88 #define EX_SINGLE_STEP                  2
89 
90 
91 /*
92  * dbxface - external debugger interfaces
93  */
94 ACPI_STATUS
95 AcpiDbSingleStep (
96     ACPI_WALK_STATE         *WalkState,
97     ACPI_PARSE_OBJECT       *Op,
98     UINT32                  OpType);
99 
100 
101 /*
102  * dbcmds - debug commands and output routines
103  */
104 ACPI_NAMESPACE_NODE *
105 AcpiDbConvertToNode (
106     char                    *InString);
107 
108 void
109 AcpiDbDisplayTableInfo (
110     char                    *TableArg);
111 
112 void
113 AcpiDbDisplayTemplate (
114     char                    *BufferArg);
115 
116 void
117 AcpiDbUnloadAcpiTable (
118     char                    *Name);
119 
120 void
121 AcpiDbSendNotify (
122     char                    *Name,
123     UINT32                  Value);
124 
125 void
126 AcpiDbDisplayInterfaces (
127     char                    *ActionArg,
128     char                    *InterfaceNameArg);
129 
130 ACPI_STATUS
131 AcpiDbSleep (
132     char                    *ObjectArg);
133 
134 void
135 AcpiDbTrace (
136     char                    *EnableArg,
137     char                    *MethodArg,
138     char                    *OnceArg);
139 
140 void
141 AcpiDbDisplayLocks (
142     void);
143 
144 void
145 AcpiDbDisplayResources (
146     char                    *ObjectArg);
147 
148 ACPI_HW_DEPENDENT_RETURN_VOID (
149 void
150 AcpiDbDisplayGpes (
151     void))
152 
153 void
154 AcpiDbDisplayHandlers (
155     void);
156 
157 ACPI_HW_DEPENDENT_RETURN_VOID (
158 void
159 AcpiDbGenerateGpe (
160     char                    *GpeArg,
161     char                    *BlockArg))
162 
163 ACPI_HW_DEPENDENT_RETURN_VOID (
164 void
165 AcpiDbGenerateSci (
166     void))
167 
168 void
169 AcpiDbExecuteTest (
170     char                    *TypeArg);
171 
172 
173 /*
174  * dbconvert - miscellaneous conversion routines
175  */
176 ACPI_STATUS
177 AcpiDbHexCharToValue (
178     int                     HexChar,
179     UINT8                   *ReturnValue);
180 
181 ACPI_STATUS
182 AcpiDbConvertToPackage (
183     char                    *String,
184     ACPI_OBJECT             *Object);
185 
186 ACPI_STATUS
187 AcpiDbConvertToObject (
188     ACPI_OBJECT_TYPE        Type,
189     char                    *String,
190     ACPI_OBJECT             *Object);
191 
192 UINT8 *
193 AcpiDbEncodePldBuffer (
194     ACPI_PLD_INFO           *PldInfo);
195 
196 void
197 AcpiDbDumpPldBuffer (
198     ACPI_OBJECT             *ObjDesc);
199 
200 
201 /*
202  * dbmethod - control method commands
203  */
204 void
205 AcpiDbSetMethodBreakpoint (
206     char                    *Location,
207     ACPI_WALK_STATE         *WalkState,
208     ACPI_PARSE_OBJECT       *Op);
209 
210 void
211 AcpiDbSetMethodCallBreakpoint (
212     ACPI_PARSE_OBJECT       *Op);
213 
214 void
215 AcpiDbSetMethodData (
216     char                    *TypeArg,
217     char                    *IndexArg,
218     char                    *ValueArg);
219 
220 ACPI_STATUS
221 AcpiDbDisassembleMethod (
222     char                    *Name);
223 
224 void
225 AcpiDbDisassembleAml (
226     char                    *Statements,
227     ACPI_PARSE_OBJECT       *Op);
228 
229 void
230 AcpiDbBatchExecute (
231     char                    *CountArg);
232 
233 
234 /*
235  * dbnames - namespace commands
236  */
237 void
238 AcpiDbSetScope (
239     char                    *Name);
240 
241 void
242 AcpiDbDumpNamespace (
243     char                    *StartArg,
244     char                    *DepthArg);
245 
246 void
247 AcpiDbDumpNamespacePaths (
248     void);
249 
250 void
251 AcpiDbDumpNamespaceByOwner (
252     char                    *OwnerArg,
253     char                    *DepthArg);
254 
255 ACPI_STATUS
256 AcpiDbFindNameInNamespace (
257     char                    *NameArg);
258 
259 void
260 AcpiDbCheckPredefinedNames (
261     void);
262 
263 ACPI_STATUS
264 AcpiDbDisplayObjects (
265     char                    *ObjTypeArg,
266     char                    *DisplayCountArg);
267 
268 void
269 AcpiDbCheckIntegrity (
270     void);
271 
272 void
273 AcpiDbFindReferences (
274     char                    *ObjectArg);
275 
276 void
277 AcpiDbGetBusInfo (
278     void);
279 
280 
281 /*
282  * dbdisply - debug display commands
283  */
284 void
285 AcpiDbDisplayMethodInfo (
286     ACPI_PARSE_OBJECT       *Op);
287 
288 void
289 AcpiDbDecodeAndDisplayObject (
290     char                    *Target,
291     char                    *OutputType);
292 
293 void
294 AcpiDbDisplayResultObject (
295     ACPI_OPERAND_OBJECT     *ObjDesc,
296     ACPI_WALK_STATE         *WalkState);
297 
298 ACPI_STATUS
299 AcpiDbDisplayAllMethods (
300     char                    *DisplayCountArg);
301 
302 void
303 AcpiDbDisplayArguments (
304     void);
305 
306 void
307 AcpiDbDisplayLocals (
308     void);
309 
310 void
311 AcpiDbDisplayResults (
312     void);
313 
314 void
315 AcpiDbDisplayCallingTree (
316     void);
317 
318 void
319 AcpiDbDisplayObjectType (
320     char                    *ObjectArg);
321 
322 void
323 AcpiDbDisplayArgumentObject (
324     ACPI_OPERAND_OBJECT     *ObjDesc,
325     ACPI_WALK_STATE         *WalkState);
326 
327 
328 /*
329  * dbexec - debugger control method execution
330  */
331 void
332 AcpiDbExecute (
333     char                    *Name,
334     char                    **Args,
335     ACPI_OBJECT_TYPE        *Types,
336     UINT32                  Flags);
337 
338 void
339 AcpiDbCreateExecutionThreads (
340     char                    *NumThreadsArg,
341     char                    *NumLoopsArg,
342     char                    *MethodNameArg);
343 
344 void
345 AcpiDbDeleteObjects (
346     UINT32                  Count,
347     ACPI_OBJECT             *Objects);
348 
349 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
350 UINT32
351 AcpiDbGetCacheInfo (
352     ACPI_MEMORY_LIST        *Cache);
353 #endif
354 
355 
356 /*
357  * dbfileio - Debugger file I/O commands
358  */
359 ACPI_OBJECT_TYPE
360 AcpiDbMatchArgument (
361     char                    *UserArgument,
362     ACPI_DB_ARGUMENT_INFO   *Arguments);
363 
364 void
365 AcpiDbCloseDebugFile (
366     void);
367 
368 void
369 AcpiDbOpenDebugFile (
370     char                    *Name);
371 
372 ACPI_STATUS
373 AcpiDbLoadAcpiTable (
374     char                    *Filename);
375 
376 ACPI_STATUS
377 AcpiDbGetTableFromFile (
378     char                    *Filename,
379     ACPI_TABLE_HEADER       **Table,
380     BOOLEAN                 MustBeAmlTable);
381 
382 
383 /*
384  * dbhistry - debugger HISTORY command
385  */
386 void
387 AcpiDbAddToHistory (
388     char                    *CommandLine);
389 
390 void
391 AcpiDbDisplayHistory (
392     void);
393 
394 char *
395 AcpiDbGetFromHistory (
396     char                    *CommandNumArg);
397 
398 char *
399 AcpiDbGetHistoryByIndex (
400     UINT32                  CommanddNum);
401 
402 
403 /*
404  * dbinput - user front-end to the AML debugger
405  */
406 ACPI_STATUS
407 AcpiDbCommandDispatch (
408     char                    *InputBuffer,
409     ACPI_WALK_STATE         *WalkState,
410     ACPI_PARSE_OBJECT       *Op);
411 
412 void ACPI_SYSTEM_XFACE
413 AcpiDbExecuteThread (
414     void                    *Context);
415 
416 ACPI_STATUS
417 AcpiDbUserCommands (
418     char                    Prompt,
419     ACPI_PARSE_OBJECT       *Op);
420 
421 char *
422 AcpiDbGetNextToken (
423     char                    *String,
424     char                    **Next,
425     ACPI_OBJECT_TYPE        *ReturnType);
426 
427 
428 /*
429  * dbobject
430  */
431 void
432 AcpiDbDecodeInternalObject (
433     ACPI_OPERAND_OBJECT     *ObjDesc);
434 
435 void
436 AcpiDbDisplayInternalObject (
437     ACPI_OPERAND_OBJECT     *ObjDesc,
438     ACPI_WALK_STATE         *WalkState);
439 
440 void
441 AcpiDbDecodeArguments (
442     ACPI_WALK_STATE         *WalkState);
443 
444 void
445 AcpiDbDecodeLocals (
446     ACPI_WALK_STATE         *WalkState);
447 
448 void
449 AcpiDbDumpMethodInfo (
450     ACPI_STATUS             Status,
451     ACPI_WALK_STATE         *WalkState);
452 
453 
454 /*
455  * dbstats - Generation and display of ACPI table statistics
456  */
457 void
458 AcpiDbGenerateStatistics (
459     ACPI_PARSE_OBJECT       *Root,
460     BOOLEAN                 IsMethod);
461 
462 ACPI_STATUS
463 AcpiDbDisplayStatistics (
464     char                    *TypeArg);
465 
466 
467 /*
468  * dbutils - AML debugger utilities
469  */
470 void
471 AcpiDbSetOutputDestination (
472     UINT32                  Where);
473 
474 void
475 AcpiDbDumpExternalObject (
476     ACPI_OBJECT             *ObjDesc,
477     UINT32                  Level);
478 
479 void
480 AcpiDbPrepNamestring (
481     char                    *Name);
482 
483 ACPI_NAMESPACE_NODE *
484 AcpiDbLocalNsLookup (
485     char                    *Name);
486 
487 void
488 AcpiDbUint32ToHexString (
489     UINT32                  Value,
490     char                    *Buffer);
491 
492 #endif  /* __ACDEBUG_H__ */
493