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