dbdisply.c revision 87031
1/*******************************************************************************
2 *
3 * Module Name: dbdisply - debug display commands
4 *              $Revision: 60 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights.  You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code.  No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision.  In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change.  Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee.  Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution.  In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government.  In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include "acpi.h"
119#include "acparser.h"
120#include "amlcode.h"
121#include "acdispat.h"
122#include "acnamesp.h"
123#include "acparser.h"
124#include "acevents.h"
125#include "acinterp.h"
126#include "acdebug.h"
127
128
129#ifdef ENABLE_DEBUGGER
130
131
132#define _COMPONENT          ACPI_DEBUGGER
133        MODULE_NAME         ("dbdisply")
134
135
136/******************************************************************************
137 *
138 * FUNCTION:    AcpiDbGetPointer
139 *
140 * PARAMETERS:  Target          - Pointer to string to be converted
141 *
142 * RETURN:      Converted pointer
143 *
144 * DESCRIPTION: Convert an ascii pointer value to a real value
145 *
146 *****************************************************************************/
147
148void *
149AcpiDbGetPointer (
150    void                    *Target)
151{
152    void                    *ObjPtr;
153
154
155#ifdef _IA16
156#include <stdio.h>
157
158    /* Have to handle 16-bit pointers of the form segment:offset */
159
160    if (!sscanf (Target, "%p", &ObjPtr))
161    {
162        AcpiOsPrintf ("Invalid pointer: %s\n", Target);
163        return (NULL);
164    }
165
166#else
167
168    /* Simple flat pointer */
169
170    ObjPtr = (void *) STRTOUL (Target, NULL, 16);
171#endif
172
173    return (ObjPtr);
174}
175
176
177/*******************************************************************************
178 *
179 * FUNCTION:    AcpiDbDumpParserDescriptor
180 *
181 * PARAMETERS:  Op              - A parser Op descriptor
182 *
183 * RETURN:      None
184 *
185 * DESCRIPTION: Display a formatted parser object
186 *
187 ******************************************************************************/
188
189void
190AcpiDbDumpParserDescriptor (
191    ACPI_PARSE_OBJECT       *Op)
192{
193    const ACPI_OPCODE_INFO  *Info;
194
195
196    Info = AcpiPsGetOpcodeInfo (Op->Opcode);
197
198    AcpiOsPrintf ("Parser Op Descriptor:\n");
199    AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode);
200
201    DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
202
203    AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value);
204    AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent);
205    AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next);
206}
207
208
209/*******************************************************************************
210 *
211 * FUNCTION:    AcpiDbDecodeAndDisplayObject
212 *
213 * PARAMETERS:  Target          - String with object to be displayed.  Names
214 *                                and hex pointers are supported.
215 *              OutputType      - Byte, Word, Dword, or Qword (B|W|D|Q)
216 *
217 * RETURN:      None
218 *
219 * DESCRIPTION: Display a formatted ACPI object
220 *
221 ******************************************************************************/
222
223void
224AcpiDbDecodeAndDisplayObject (
225    NATIVE_CHAR             *Target,
226    NATIVE_CHAR             *OutputType)
227{
228    void                    *ObjPtr;
229    ACPI_NAMESPACE_NODE     *Node;
230    ACPI_OPERAND_OBJECT     *ObjDesc;
231    UINT32                  Display = DB_BYTE_DISPLAY;
232    NATIVE_CHAR             Buffer[80];
233    ACPI_BUFFER             RetBuf;
234    ACPI_STATUS             Status;
235    UINT32                  Size;
236
237
238    if (!Target)
239    {
240        return;
241    }
242
243    /* Decode the output type */
244
245    if (OutputType)
246    {
247        STRUPR (OutputType);
248        if (OutputType[0] == 'W')
249        {
250            Display = DB_WORD_DISPLAY;
251        }
252        else if (OutputType[0] == 'D')
253        {
254            Display = DB_DWORD_DISPLAY;
255        }
256        else if (OutputType[0] == 'Q')
257        {
258            Display = DB_QWORD_DISPLAY;
259        }
260    }
261
262    RetBuf.Length = sizeof (Buffer);
263    RetBuf.Pointer = Buffer;
264
265    /* Differentiate between a number and a name */
266
267    if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
268    {
269        ObjPtr = AcpiDbGetPointer (Target);
270        if (!AcpiOsReadable (ObjPtr, 16))
271        {
272            AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
273            return;
274        }
275
276        /* Decode the object type */
277
278        if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_NAMED))
279        {
280            /* This is a Node */
281
282            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
283            {
284                AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
285                return;
286            }
287
288            Node = ObjPtr;
289            goto DumpNte;
290        }
291
292        else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_INTERNAL))
293        {
294            /* This is an ACPI OBJECT */
295
296            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
297            {
298                AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
299                return;
300            }
301
302            AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
303            AcpiExDumpObjectDescriptor (ObjPtr, 1);
304        }
305
306        else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER))
307        {
308            /* This is an Parser Op object */
309
310            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
311            {
312                AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
313                return;
314            }
315
316            AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
317            AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
318        }
319
320        else
321        {
322            Size = 16;
323            if (AcpiOsReadable (ObjPtr, 64))
324            {
325                Size = 64;
326            }
327
328            /* Just dump some memory */
329
330            AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
331        }
332
333        return;
334    }
335
336
337    /* The parameter is a name string that must be resolved to a Named obj */
338
339    Node = AcpiDbLocalNsLookup (Target);
340    if (!Node)
341    {
342        return;
343    }
344
345
346DumpNte:
347    /* Now dump the Named obj */
348
349    Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
350    if (ACPI_FAILURE (Status))
351    {
352        AcpiOsPrintf ("Could not convert name to pathname\n");
353    }
354
355    else
356    {
357        AcpiOsPrintf ("Object (%p) Pathname:  %s\n", Node, RetBuf.Pointer);
358    }
359
360    if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
361    {
362        AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
363        return;
364    }
365
366    AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
367    AcpiExDumpNode (Node, 1);
368
369    ObjDesc = AcpiNsGetAttachedObject (Node);
370    if (ObjDesc)
371    {
372        AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
373        if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
374        {
375            AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc);
376            return;
377        }
378
379        AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
380        AcpiExDumpObjectDescriptor (ObjDesc, 1);
381    }
382}
383
384
385/*******************************************************************************
386 *
387 * FUNCTION:    AcpiDbDecodeInternalObject
388 *
389 * PARAMETERS:  ObjDesc         - Object to be displayed
390 *
391 * RETURN:      None
392 *
393 * DESCRIPTION: Short display of an internal object.  Numbers and Strings.
394 *
395 ******************************************************************************/
396
397void
398AcpiDbDecodeInternalObject (
399    ACPI_OPERAND_OBJECT     *ObjDesc)
400{
401    UINT32                  i;
402
403
404    if (!ObjDesc)
405    {
406        return;
407    }
408
409    AcpiOsPrintf (" %s", AcpiUtGetTypeName (ObjDesc->Common.Type));
410
411    switch (ObjDesc->Common.Type)
412    {
413    case ACPI_TYPE_INTEGER:
414
415        AcpiOsPrintf (" %.8X%.8X", HIDWORD (ObjDesc->Integer.Value),
416                                   LODWORD (ObjDesc->Integer.Value));
417        break;
418
419
420    case ACPI_TYPE_STRING:
421
422        AcpiOsPrintf ("(%d) \"%.24s",
423                ObjDesc->String.Length, ObjDesc->String.Pointer);
424
425        if (ObjDesc->String.Length > 24)
426        {
427            AcpiOsPrintf ("...");
428        }
429        else
430        {
431            AcpiOsPrintf ("\"");
432        }
433        break;
434
435
436    case ACPI_TYPE_BUFFER:
437
438        AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
439        for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
440        {
441            AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
442        }
443        break;
444    }
445}
446
447
448/*******************************************************************************
449 *
450 * FUNCTION:    AcpiDbDisplayInternalObject
451 *
452 * PARAMETERS:  ObjDesc         - Object to be displayed
453 *              WalkState       - Current walk state
454 *
455 * RETURN:      None
456 *
457 * DESCRIPTION: Short display of an internal object
458 *
459 ******************************************************************************/
460
461void
462AcpiDbDisplayInternalObject (
463    ACPI_OPERAND_OBJECT     *ObjDesc,
464    ACPI_WALK_STATE         *WalkState)
465{
466    UINT8                   Type;
467
468
469    AcpiOsPrintf ("%p ", ObjDesc);
470
471    if (!ObjDesc)
472    {
473        AcpiOsPrintf ("<NullObj>\n");
474        return;
475    }
476
477    /* Decode the object type */
478
479    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER))
480    {
481        AcpiOsPrintf ("<Parser>  ");
482    }
483
484    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
485    {
486        AcpiOsPrintf ("<Node>            Name %4.4s Type-%s",
487                        &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name,
488                        AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type));
489
490        if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG)
491        {
492            AcpiOsPrintf (" [Method Arg]");
493        }
494        if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL)
495        {
496            AcpiOsPrintf (" [Method Local]");
497        }
498    }
499
500    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
501    {
502        Type = ObjDesc->Common.Type;
503        if (Type > INTERNAL_TYPE_MAX)
504        {
505            AcpiOsPrintf (" Type %x [Invalid Type]", Type);
506            return;
507        }
508
509        /* Decode the ACPI object type */
510
511        switch (ObjDesc->Common.Type)
512        {
513        case INTERNAL_TYPE_REFERENCE:
514            switch (ObjDesc->Reference.Opcode)
515            {
516            case AML_ZERO_OP:
517                AcpiOsPrintf ("[Const]           Zero (0) [Null Target]", 0);
518                break;
519
520            case AML_ONES_OP:
521                AcpiOsPrintf ("[Const]           Ones (0xFFFFFFFFFFFFFFFF) [No Limit]");
522                break;
523
524            case AML_ONE_OP:
525                AcpiOsPrintf ("[Const]           One (1)");
526                break;
527
528            case AML_REVISION_OP:
529                AcpiOsPrintf ("[Const]           Revision (%X)", ACPI_CA_SUPPORT_LEVEL);
530                break;
531
532            case AML_LOCAL_OP:
533                AcpiOsPrintf ("[Local%d]", ObjDesc->Reference.Offset);
534                if (WalkState)
535                {
536                    ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
537                    AcpiOsPrintf (" %p", ObjDesc);
538                    AcpiDbDecodeInternalObject (ObjDesc);
539                }
540                break;
541
542            case AML_ARG_OP:
543                AcpiOsPrintf ("[Arg%d]  ", ObjDesc->Reference.Offset);
544                if (WalkState)
545                {
546                    ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
547                    AcpiOsPrintf (" %p", ObjDesc);
548                    AcpiDbDecodeInternalObject (ObjDesc);
549                }
550                break;
551
552            case AML_DEBUG_OP:
553                AcpiOsPrintf ("[Debug]  ");
554                break;
555
556            case AML_INDEX_OP:
557                AcpiOsPrintf ("[Index]     ");
558                AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
559                break;
560
561            default:
562                break;
563
564            }
565            break;
566
567        default:
568            AcpiOsPrintf ("<Obj> ");
569            AcpiOsPrintf ("           ");
570            AcpiDbDecodeInternalObject (ObjDesc);
571            break;
572        }
573    }
574
575    else
576    {
577        AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
578    }
579
580    AcpiOsPrintf ("\n");
581}
582
583
584/*******************************************************************************
585 *
586 * FUNCTION:    AcpiDbDisplayMethodInfo
587 *
588 * PARAMETERS:  StartOp         - Root of the control method parse tree
589 *
590 * RETURN:      None
591 *
592 * DESCRIPTION: Display information about the current method
593 *
594 ******************************************************************************/
595
596void
597AcpiDbDisplayMethodInfo (
598    ACPI_PARSE_OBJECT       *StartOp)
599{
600    ACPI_WALK_STATE         *WalkState;
601    ACPI_OPERAND_OBJECT     *ObjDesc;
602    ACPI_NAMESPACE_NODE     *Node;
603    ACPI_PARSE_OBJECT       *RootOp;
604    ACPI_PARSE_OBJECT       *Op;
605    const ACPI_OPCODE_INFO  *OpInfo;
606    UINT32                  NumOps = 0;
607    UINT32                  NumOperands = 0;
608    UINT32                  NumOperators = 0;
609    UINT32                  NumRemainingOps = 0;
610    UINT32                  NumRemainingOperands = 0;
611    UINT32                  NumRemainingOperators = 0;
612    UINT32                  NumArgs;
613    UINT32                  Concurrency;
614    BOOLEAN                 CountRemaining = FALSE;
615
616
617    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
618    if (!WalkState)
619    {
620        AcpiOsPrintf ("There is no method currently executing\n");
621        return;
622    }
623
624    ObjDesc = WalkState->MethodDesc;
625    Node    = WalkState->MethodNode;
626
627    NumArgs     = ObjDesc->Method.ParamCount;
628    Concurrency = ObjDesc->Method.Concurrency;
629
630    AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name);
631    AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency);
632
633
634    RootOp = StartOp;
635    while (RootOp->Parent)
636    {
637        RootOp = RootOp->Parent;
638    }
639
640    Op = RootOp;
641
642    while (Op)
643    {
644        if (Op == StartOp)
645        {
646            CountRemaining = TRUE;
647        }
648
649        NumOps++;
650        if (CountRemaining)
651        {
652            NumRemainingOps++;
653        }
654
655        /* Decode the opcode */
656
657        OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
658        switch (OpInfo->Class)
659        {
660        case AML_CLASS_ARGUMENT:
661            if (CountRemaining)
662            {
663                NumRemainingOperands++;
664            }
665
666            NumOperands++;
667            break;
668
669        case AML_CLASS_UNKNOWN:
670            /* Bad opcode or ASCII character */
671
672            continue;
673
674        default:
675            if (CountRemaining)
676            {
677                NumRemainingOperators++;
678            }
679
680            NumOperators++;
681            break;
682        }
683
684        Op = AcpiPsGetDepthNext (StartOp, Op);
685    }
686
687    AcpiOsPrintf ("Method contains:       %X AML Opcodes - %X Operators, %X Operands\n",
688                NumOps, NumOperators, NumOperands);
689
690    AcpiOsPrintf ("Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands\n",
691                NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
692}
693
694
695/*******************************************************************************
696 *
697 * FUNCTION:    AcpiDbDisplayLocals
698 *
699 * PARAMETERS:  None
700 *
701 * RETURN:      None
702 *
703 * DESCRIPTION: Display all locals for the currently running control method
704 *
705 ******************************************************************************/
706
707void
708AcpiDbDisplayLocals (void)
709{
710    UINT32                  i;
711    ACPI_WALK_STATE         *WalkState;
712    ACPI_OPERAND_OBJECT     *ObjDesc;
713    ACPI_NAMESPACE_NODE     *Node;
714
715
716    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
717    if (!WalkState)
718    {
719        AcpiOsPrintf ("There is no method currently executing\n");
720        return;
721    }
722
723    ObjDesc = WalkState->MethodDesc;
724    Node = WalkState->MethodNode;
725    AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name);
726
727    for (i = 0; i < MTH_NUM_LOCALS; i++)
728    {
729        ObjDesc = WalkState->LocalVariables[i].Object;
730        AcpiOsPrintf ("Local%d: ", i);
731        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
732    }
733}
734
735
736/*******************************************************************************
737 *
738 * FUNCTION:    AcpiDbDisplayArguments
739 *
740 * PARAMETERS:  None
741 *
742 * RETURN:      None
743 *
744 * DESCRIPTION: Display all arguments for the currently running control method
745 *
746 ******************************************************************************/
747
748void
749AcpiDbDisplayArguments (void)
750{
751    UINT32                  i;
752    ACPI_WALK_STATE         *WalkState;
753    ACPI_OPERAND_OBJECT     *ObjDesc;
754    UINT32                  NumArgs;
755    UINT32                  Concurrency;
756    ACPI_NAMESPACE_NODE     *Node;
757
758
759    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
760    if (!WalkState)
761    {
762        AcpiOsPrintf ("There is no method currently executing\n");
763        return;
764    }
765
766    ObjDesc = WalkState->MethodDesc;
767    Node    = WalkState->MethodNode;
768
769    NumArgs     = ObjDesc->Method.ParamCount;
770    Concurrency = ObjDesc->Method.Concurrency;
771
772    AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
773            &Node->Name, NumArgs, Concurrency);
774
775    for (i = 0; i < NumArgs; i++)
776    {
777        ObjDesc = WalkState->Arguments[i].Object;
778        AcpiOsPrintf ("Arg%d: ", i);
779        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
780    }
781}
782
783
784/*******************************************************************************
785 *
786 * FUNCTION:    AcpiDbDisplayResults
787 *
788 * PARAMETERS:  None
789 *
790 * RETURN:      None
791 *
792 * DESCRIPTION: Display current contents of a method result stack
793 *
794 ******************************************************************************/
795
796void
797AcpiDbDisplayResults (void)
798{
799    UINT32                  i;
800    ACPI_WALK_STATE         *WalkState;
801    ACPI_OPERAND_OBJECT     *ObjDesc;
802    UINT32                  NumResults = 0;
803    ACPI_NAMESPACE_NODE     *Node;
804
805
806    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
807    if (!WalkState)
808    {
809        AcpiOsPrintf ("There is no method currently executing\n");
810        return;
811    }
812
813    ObjDesc = WalkState->MethodDesc;
814    Node = WalkState->MethodNode;
815
816    if (WalkState->Results)
817    {
818        NumResults = WalkState->Results->Results.NumResults;
819    }
820
821    AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
822        &Node->Name, NumResults);
823
824    for (i = 0; i < NumResults; i++)
825    {
826        ObjDesc = WalkState->Results->Results.ObjDesc[i];
827        AcpiOsPrintf ("Result%d: ", i);
828        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
829    }
830}
831
832
833/*******************************************************************************
834 *
835 * FUNCTION:    AcpiDbDisplayCallingTree
836 *
837 * PARAMETERS:  None
838 *
839 * RETURN:      None
840 *
841 * DESCRIPTION: Display current calling tree of nested control methods
842 *
843 ******************************************************************************/
844
845void
846AcpiDbDisplayCallingTree (void)
847{
848    UINT32                  i;
849    ACPI_WALK_STATE         *WalkState;
850    ACPI_NAMESPACE_NODE     *Node;
851
852
853    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
854    if (!WalkState)
855    {
856        AcpiOsPrintf ("There is no method currently executing\n");
857        return;
858    }
859
860    Node = WalkState->MethodNode;
861    AcpiOsPrintf ("Current Control Method Call Tree\n");
862
863    for (i = 0; WalkState; i++)
864    {
865        Node = WalkState->MethodNode;
866
867        AcpiOsPrintf ("    [%4.4s]\n", &Node->Name);
868
869        WalkState = WalkState->Next;
870    }
871}
872
873
874/*******************************************************************************
875 *
876 * FUNCTION:    AcpiDbDisplayResultObject
877 *
878 * PARAMETERS:  ObjDesc         - Object to be displayed
879 *              WalkState       - Current walk state
880 *
881 * RETURN:      None
882 *
883 * DESCRIPTION: Display the result of an AML opcode
884 *
885 ******************************************************************************/
886
887void
888AcpiDbDisplayResultObject (
889    ACPI_OPERAND_OBJECT     *ObjDesc,
890    ACPI_WALK_STATE         *WalkState)
891{
892
893    /* TBD: [Future] We don't always want to display the result.
894     * For now, only display if single stepping
895     * however, this output is very useful in other contexts also
896     */
897    if (!AcpiGbl_CmSingleStep)
898    {
899        return;
900    }
901
902    AcpiOsPrintf ("ResultObj: ");
903    AcpiDbDisplayInternalObject (ObjDesc, WalkState);
904    AcpiOsPrintf ("\n");
905}
906
907
908/*******************************************************************************
909 *
910 * FUNCTION:    AcpiDbDisplayArgumentObject
911 *
912 * PARAMETERS:  ObjDesc         - Object to be displayed
913 *              WalkState       - Current walk state
914 *
915 * RETURN:      None
916 *
917 * DESCRIPTION: Display the result of an AML opcode
918 *
919 ******************************************************************************/
920
921void
922AcpiDbDisplayArgumentObject (
923    ACPI_OPERAND_OBJECT     *ObjDesc,
924    ACPI_WALK_STATE         *WalkState)
925{
926
927    if (!AcpiGbl_CmSingleStep)
928    {
929        return;
930    }
931
932    AcpiOsPrintf ("ArgObj:    ");
933    AcpiDbDisplayInternalObject (ObjDesc, WalkState);
934}
935
936#endif /* ENABLE_DEBUGGER */
937
938