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 - 2016, 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/* The debugger is used in conjunction with the disassembler most of time */
120
121#ifdef ACPI_DISASSEMBLER
122#include "acdisasm.h"
123#endif
124
125
126#define ACPI_DEBUG_BUFFER_SIZE  0x4000      /* 16K buffer for return objects */
127
128typedef struct acpi_db_command_info
129{
130    const char              *Name;          /* Command Name */
131    UINT8                   MinArgs;        /* Minimum arguments required */
132
133} ACPI_DB_COMMAND_INFO;
134
135typedef struct acpi_db_command_help
136{
137    UINT8                   LineCount;      /* Number of help lines */
138    char                    *Invocation;    /* Command Invocation */
139    char                    *Description;   /* Command Description */
140
141} ACPI_DB_COMMAND_HELP;
142
143typedef struct acpi_db_argument_info
144{
145    const char              *Name;          /* Argument Name */
146
147} ACPI_DB_ARGUMENT_INFO;
148
149typedef struct acpi_db_execute_walk
150{
151    UINT32                  Count;
152    UINT32                  MaxCount;
153
154} ACPI_DB_EXECUTE_WALK;
155
156
157#define PARAM_LIST(pl)                  pl
158
159#define EX_NO_SINGLE_STEP               1
160#define EX_SINGLE_STEP                  2
161
162
163/*
164 * dbxface - external debugger interfaces
165 */
166ACPI_DBR_DEPENDENT_RETURN_OK (
167ACPI_STATUS
168AcpiDbSingleStep (
169    ACPI_WALK_STATE         *WalkState,
170    ACPI_PARSE_OBJECT       *Op,
171    UINT32                  OpType))
172
173ACPI_DBR_DEPENDENT_RETURN_VOID (
174void
175AcpiDbSignalBreakPoint (
176    ACPI_WALK_STATE         *WalkState))
177
178
179/*
180 * dbcmds - debug commands and output routines
181 */
182ACPI_NAMESPACE_NODE *
183AcpiDbConvertToNode (
184    char                    *InString);
185
186void
187AcpiDbDisplayTableInfo (
188    char                    *TableArg);
189
190void
191AcpiDbDisplayTemplate (
192    char                    *BufferArg);
193
194void
195AcpiDbUnloadAcpiTable (
196    char                    *Name);
197
198void
199AcpiDbSendNotify (
200    char                    *Name,
201    UINT32                  Value);
202
203void
204AcpiDbDisplayInterfaces (
205    char                    *ActionArg,
206    char                    *InterfaceNameArg);
207
208ACPI_STATUS
209AcpiDbSleep (
210    char                    *ObjectArg);
211
212void
213AcpiDbTrace (
214    char                    *EnableArg,
215    char                    *MethodArg,
216    char                    *OnceArg);
217
218void
219AcpiDbDisplayLocks (
220    void);
221
222void
223AcpiDbDisplayResources (
224    char                    *ObjectArg);
225
226ACPI_HW_DEPENDENT_RETURN_VOID (
227void
228AcpiDbDisplayGpes (
229    void))
230
231void
232AcpiDbDisplayHandlers (
233    void);
234
235ACPI_HW_DEPENDENT_RETURN_VOID (
236void
237AcpiDbGenerateGpe (
238    char                    *GpeArg,
239    char                    *BlockArg))
240
241ACPI_HW_DEPENDENT_RETURN_VOID (
242void
243AcpiDbGenerateSci (
244    void))
245
246void
247AcpiDbExecuteTest (
248    char                    *TypeArg);
249
250
251/*
252 * dbconvert - miscellaneous conversion routines
253 */
254ACPI_STATUS
255AcpiDbHexCharToValue (
256    int                     HexChar,
257    UINT8                   *ReturnValue);
258
259ACPI_STATUS
260AcpiDbConvertToPackage (
261    char                    *String,
262    ACPI_OBJECT             *Object);
263
264ACPI_STATUS
265AcpiDbConvertToObject (
266    ACPI_OBJECT_TYPE        Type,
267    char                    *String,
268    ACPI_OBJECT             *Object);
269
270UINT8 *
271AcpiDbEncodePldBuffer (
272    ACPI_PLD_INFO           *PldInfo);
273
274void
275AcpiDbDumpPldBuffer (
276    ACPI_OBJECT             *ObjDesc);
277
278
279/*
280 * dbmethod - control method commands
281 */
282void
283AcpiDbSetMethodBreakpoint (
284    char                    *Location,
285    ACPI_WALK_STATE         *WalkState,
286    ACPI_PARSE_OBJECT       *Op);
287
288void
289AcpiDbSetMethodCallBreakpoint (
290    ACPI_PARSE_OBJECT       *Op);
291
292void
293AcpiDbSetMethodData (
294    char                    *TypeArg,
295    char                    *IndexArg,
296    char                    *ValueArg);
297
298ACPI_STATUS
299AcpiDbDisassembleMethod (
300    char                    *Name);
301
302void
303AcpiDbDisassembleAml (
304    char                    *Statements,
305    ACPI_PARSE_OBJECT       *Op);
306
307void
308AcpiDbBatchExecute (
309    char                    *CountArg);
310
311
312/*
313 * dbnames - namespace commands
314 */
315void
316AcpiDbSetScope (
317    char                    *Name);
318
319void
320AcpiDbDumpNamespace (
321    char                    *StartArg,
322    char                    *DepthArg);
323
324void
325AcpiDbDumpNamespacePaths (
326    void);
327
328void
329AcpiDbDumpNamespaceByOwner (
330    char                    *OwnerArg,
331    char                    *DepthArg);
332
333ACPI_STATUS
334AcpiDbFindNameInNamespace (
335    char                    *NameArg);
336
337void
338AcpiDbCheckPredefinedNames (
339    void);
340
341ACPI_STATUS
342AcpiDbDisplayObjects (
343    char                    *ObjTypeArg,
344    char                    *DisplayCountArg);
345
346void
347AcpiDbCheckIntegrity (
348    void);
349
350void
351AcpiDbFindReferences (
352    char                    *ObjectArg);
353
354void
355AcpiDbGetBusInfo (
356    void);
357
358
359/*
360 * dbdisply - debug display commands
361 */
362void
363AcpiDbDisplayMethodInfo (
364    ACPI_PARSE_OBJECT       *Op);
365
366void
367AcpiDbDecodeAndDisplayObject (
368    char                    *Target,
369    char                    *OutputType);
370
371ACPI_DBR_DEPENDENT_RETURN_VOID (
372void
373AcpiDbDisplayResultObject (
374    ACPI_OPERAND_OBJECT     *ObjDesc,
375    ACPI_WALK_STATE         *WalkState))
376
377ACPI_STATUS
378AcpiDbDisplayAllMethods (
379    char                    *DisplayCountArg);
380
381void
382AcpiDbDisplayArguments (
383    void);
384
385void
386AcpiDbDisplayLocals (
387    void);
388
389void
390AcpiDbDisplayResults (
391    void);
392
393void
394AcpiDbDisplayCallingTree (
395    void);
396
397void
398AcpiDbDisplayObjectType (
399    char                    *ObjectArg);
400
401ACPI_DBR_DEPENDENT_RETURN_VOID (
402void
403AcpiDbDisplayArgumentObject (
404    ACPI_OPERAND_OBJECT     *ObjDesc,
405    ACPI_WALK_STATE         *WalkState))
406
407
408/*
409 * dbexec - debugger control method execution
410 */
411void
412AcpiDbExecute (
413    char                    *Name,
414    char                    **Args,
415    ACPI_OBJECT_TYPE        *Types,
416    UINT32                  Flags);
417
418void
419AcpiDbCreateExecutionThreads (
420    char                    *NumThreadsArg,
421    char                    *NumLoopsArg,
422    char                    *MethodNameArg);
423
424void
425AcpiDbDeleteObjects (
426    UINT32                  Count,
427    ACPI_OBJECT             *Objects);
428
429#ifdef ACPI_DBG_TRACK_ALLOCATIONS
430UINT32
431AcpiDbGetCacheInfo (
432    ACPI_MEMORY_LIST        *Cache);
433#endif
434
435
436/*
437 * dbfileio - Debugger file I/O commands
438 */
439ACPI_OBJECT_TYPE
440AcpiDbMatchArgument (
441    char                    *UserArgument,
442    ACPI_DB_ARGUMENT_INFO   *Arguments);
443
444void
445AcpiDbCloseDebugFile (
446    void);
447
448void
449AcpiDbOpenDebugFile (
450    char                    *Name);
451
452ACPI_STATUS
453AcpiDbLoadAcpiTable (
454    char                    *Filename);
455
456ACPI_STATUS
457AcpiDbLoadTables (
458    ACPI_NEW_TABLE_DESC     *ListHead);
459
460
461/*
462 * dbhistry - debugger HISTORY command
463 */
464void
465AcpiDbAddToHistory (
466    char                    *CommandLine);
467
468void
469AcpiDbDisplayHistory (
470    void);
471
472char *
473AcpiDbGetFromHistory (
474    char                    *CommandNumArg);
475
476char *
477AcpiDbGetHistoryByIndex (
478    UINT32                  CommanddNum);
479
480
481/*
482 * dbinput - user front-end to the AML debugger
483 */
484ACPI_STATUS
485AcpiDbCommandDispatch (
486    char                    *InputBuffer,
487    ACPI_WALK_STATE         *WalkState,
488    ACPI_PARSE_OBJECT       *Op);
489
490void ACPI_SYSTEM_XFACE
491AcpiDbExecuteThread (
492    void                    *Context);
493
494ACPI_STATUS
495AcpiDbUserCommands (
496    char                    Prompt,
497    ACPI_PARSE_OBJECT       *Op);
498
499char *
500AcpiDbGetNextToken (
501    char                    *String,
502    char                    **Next,
503    ACPI_OBJECT_TYPE        *ReturnType);
504
505
506/*
507 * dbobject
508 */
509void
510AcpiDbDecodeInternalObject (
511    ACPI_OPERAND_OBJECT     *ObjDesc);
512
513void
514AcpiDbDisplayInternalObject (
515    ACPI_OPERAND_OBJECT     *ObjDesc,
516    ACPI_WALK_STATE         *WalkState);
517
518void
519AcpiDbDecodeArguments (
520    ACPI_WALK_STATE         *WalkState);
521
522void
523AcpiDbDecodeLocals (
524    ACPI_WALK_STATE         *WalkState);
525
526void
527AcpiDbDumpMethodInfo (
528    ACPI_STATUS             Status,
529    ACPI_WALK_STATE         *WalkState);
530
531
532/*
533 * dbstats - Generation and display of ACPI table statistics
534 */
535void
536AcpiDbGenerateStatistics (
537    ACPI_PARSE_OBJECT       *Root,
538    BOOLEAN                 IsMethod);
539
540ACPI_STATUS
541AcpiDbDisplayStatistics (
542    char                    *TypeArg);
543
544
545/*
546 * dbutils - AML debugger utilities
547 */
548void
549AcpiDbSetOutputDestination (
550    UINT32                  Where);
551
552void
553AcpiDbDumpExternalObject (
554    ACPI_OBJECT             *ObjDesc,
555    UINT32                  Level);
556
557void
558AcpiDbPrepNamestring (
559    char                    *Name);
560
561ACPI_NAMESPACE_NODE *
562AcpiDbLocalNsLookup (
563    char                    *Name);
564
565void
566AcpiDbUint32ToHexString (
567    UINT32                  Value,
568    char                    *Buffer);
569
570#endif  /* __ACDEBUG_H__ */
571