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