dbdisply.c revision 71867
1/*******************************************************************************
2 *
3 * Module Name: dbdisply - debug display commands
4 *              $Revision: 41 $
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          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
172#endif
173
174    return (ObjPtr);
175}
176
177
178/*******************************************************************************
179 *
180 * FUNCTION:    AcpiDbDumpParserDescriptor
181 *
182 * PARAMETERS:  Op              - A parser Op descriptor
183 *
184 * RETURN:      None
185 *
186 * DESCRIPTION: Display a formatted parser object
187 *
188 ******************************************************************************/
189
190void
191AcpiDbDumpParserDescriptor (
192    ACPI_PARSE_OBJECT       *Op)
193{
194    ACPI_OPCODE_INFO        *Info;
195
196
197    Info = AcpiPsGetOpcodeInfo (Op->Opcode);
198
199    AcpiOsPrintf ("Parser Op Descriptor:\n");
200    AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode);
201
202    DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
203
204    AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value);
205    AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent);
206    AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next);
207}
208
209
210/*******************************************************************************
211 *
212 * FUNCTION:    AcpiDbDecodeAndDisplayObject
213 *
214 * PARAMETERS:  Target          - String with object to be displayed.  Names
215 *                                and hex pointers are supported.
216 *              OutputType      - Byte, Word, Dword, or Qword (B|W|D|Q)
217 *
218 * RETURN:      None
219 *
220 * DESCRIPTION: Display a formatted ACPI object
221 *
222 ******************************************************************************/
223
224void
225AcpiDbDecodeAndDisplayObject (
226    NATIVE_CHAR             *Target,
227    NATIVE_CHAR             *OutputType)
228{
229    void                    *ObjPtr;
230    ACPI_NAMESPACE_NODE     *Node;
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
263    RetBuf.Length = sizeof (Buffer);
264    RetBuf.Pointer = Buffer;
265
266    /* Differentiate between a number and a name */
267
268    if ((Target[0] >= 0x30) && (Target[0] <= 0x39))
269    {
270        ObjPtr = AcpiDbGetPointer (Target);
271        if (!AcpiOsReadable (ObjPtr, 16))
272        {
273            AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
274            return;
275        }
276
277        /* Decode the object type */
278
279        if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_NAMED))
280        {
281            /* This is a Node */
282
283            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
284            {
285                AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
286                return;
287            }
288
289            Node = ObjPtr;
290            goto DumpNte;
291        }
292
293        else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_INTERNAL))
294        {
295            /* This is an ACPI OBJECT */
296
297            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
298            {
299                AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
300                return;
301            }
302
303            AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
304            AcpiAmlDumpObjectDescriptor (ObjPtr, 1);
305        }
306
307        else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER))
308        {
309            /* This is an Parser Op object */
310
311            if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
312            {
313                AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
314                return;
315            }
316
317
318            AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
319            AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
320        }
321
322        else
323        {
324            Size = 16;
325            if (AcpiOsReadable (ObjPtr, 64))
326            {
327                Size = 64;
328            }
329
330            /* Just dump some memory */
331
332            AcpiCmDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX);
333        }
334
335        return;
336    }
337
338
339    /* The parameter is a name string that must be resolved to a Named obj */
340
341    Node = AcpiDbLocalNsLookup (Target);
342    if (!Node)
343    {
344        return;
345    }
346
347
348DumpNte:
349    /* Now dump the Named obj */
350
351    Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
352    if (ACPI_FAILURE (Status))
353    {
354        AcpiOsPrintf ("Could not convert name to pathname\n");
355    }
356
357    else
358    {
359        AcpiOsPrintf ("Object Pathname:  %s\n", RetBuf.Pointer);
360    }
361
362    if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
363    {
364        AcpiOsPrintf ("Invalid Named object at address %p\n", Node);
365        return;
366    }
367
368    AcpiCmDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
369    AcpiAmlDumpNode (Node, 1);
370
371    if (Node->Object)
372    {
373        AcpiOsPrintf ("\nAttached Object (%p):\n", Node->Object);
374        if (!AcpiOsReadable (Node->Object, sizeof (ACPI_OPERAND_OBJECT)))
375        {
376            AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", Node->Object);
377            return;
378        }
379
380        AcpiCmDumpBuffer (Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
381        AcpiAmlDumpObjectDescriptor (Node->Object, 1);
382    }
383}
384
385
386/*******************************************************************************
387 *
388 * FUNCTION:    AcpiDbDecodeInternalObject
389 *
390 * PARAMETERS:  ObjDesc         - Object to be displayed
391 *
392 * RETURN:      None
393 *
394 * DESCRIPTION: Short display of an internal object.  Numbers and Strings.
395 *
396 ******************************************************************************/
397
398void
399AcpiDbDecodeInternalObject (
400    ACPI_OPERAND_OBJECT     *ObjDesc)
401{
402    UINT32                  i;
403
404
405    if (!ObjDesc)
406    {
407        return;
408    }
409
410    AcpiOsPrintf (" %s", AcpiCmGetTypeName (ObjDesc->Common.Type));
411
412    switch (ObjDesc->Common.Type)
413    {
414    case ACPI_TYPE_INTEGER:
415        AcpiOsPrintf (" %.8X", ObjDesc->Integer.Value);
416        break;
417
418    case ACPI_TYPE_STRING:
419        AcpiOsPrintf ("(%d) \"%.16s\"...",
420                ObjDesc->String.Length, ObjDesc->String.Pointer);
421        break;
422
423    case ACPI_TYPE_BUFFER:
424        AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length);
425        for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
426        {
427            AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
428        }
429        break;
430    }
431}
432
433
434/*******************************************************************************
435 *
436 * FUNCTION:    AcpiDbDisplayInternalObject
437 *
438 * PARAMETERS:  ObjDesc         - Object to be displayed
439 *              WalkState       - Current walk state
440 *
441 * RETURN:      None
442 *
443 * DESCRIPTION: Short display of an internal object
444 *
445 ******************************************************************************/
446
447void
448AcpiDbDisplayInternalObject (
449    ACPI_OPERAND_OBJECT     *ObjDesc,
450    ACPI_WALK_STATE         *WalkState)
451{
452    UINT8                   Type;
453
454
455    AcpiOsPrintf ("%p ", ObjDesc);
456
457    if (!ObjDesc)
458    {
459        AcpiOsPrintf ("<NullObj>\n");
460        return;
461    }
462
463
464    /* Decode the object type */
465
466    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER))
467    {
468        AcpiOsPrintf ("<Parser>  ");
469    }
470
471    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
472    {
473        AcpiOsPrintf ("<Node>            Name %4.4s Type-%s",
474                        &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name,
475                        AcpiCmGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type));
476        if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG)
477        {
478            AcpiOsPrintf (" [Method Arg]");
479        }
480        if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL)
481        {
482            AcpiOsPrintf (" [Method Local]");
483        }
484    }
485
486    else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
487    {
488        AcpiOsPrintf ("<Obj> ");
489        Type = ObjDesc->Common.Type;
490        if (Type > INTERNAL_TYPE_MAX)
491        {
492            AcpiOsPrintf (" Type %x [Invalid Type]", Type);
493            return;
494        }
495
496        /* Decode the ACPI object type */
497
498        switch (ObjDesc->Common.Type)
499        {
500        case INTERNAL_TYPE_REFERENCE:
501            switch (ObjDesc->Reference.OpCode)
502            {
503            case AML_ZERO_OP:
504                AcpiOsPrintf ("[Const]     Number %.8X", 0);
505                break;
506
507            case AML_ONES_OP:
508                AcpiOsPrintf ("[Const]     Number %.8X", ACPI_UINT32_MAX);
509                break;
510
511            case AML_ONE_OP:
512                AcpiOsPrintf ("[Const]     Number %.8X", 1);
513                break;
514
515            case AML_LOCAL_OP:
516                AcpiOsPrintf ("[Local%d]   ", ObjDesc->Reference.Offset);
517                if (WalkState)
518                {
519                    ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
520                    AcpiDbDecodeInternalObject (ObjDesc);
521                }
522                break;
523
524            case AML_ARG_OP:
525                AcpiOsPrintf ("[Arg%d]     ", ObjDesc->Reference.Offset);
526                if (WalkState)
527                {
528                    ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
529                    AcpiDbDecodeInternalObject (ObjDesc);
530                }
531                break;
532
533            case AML_DEBUG_OP:
534                AcpiOsPrintf ("[Debug]  ");
535                break;
536
537            case AML_INDEX_OP:
538                AcpiOsPrintf ("[Index]     ");
539                AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
540                break;
541
542            default:
543                break;
544
545            }
546            break;
547
548        default:
549            AcpiOsPrintf ("           ");
550            AcpiDbDecodeInternalObject (ObjDesc);
551            break;
552        }
553    }
554
555    else
556    {
557        AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> ");
558    }
559
560    AcpiOsPrintf ("\n");
561}
562
563
564/*******************************************************************************
565 *
566 * FUNCTION:    AcpiDbDisplayMethodInfo
567 *
568 * PARAMETERS:  StartOp         - Root of the control method parse tree
569 *
570 * RETURN:      None
571 *
572 * DESCRIPTION: Display information about the current method
573 *
574 ******************************************************************************/
575
576void
577AcpiDbDisplayMethodInfo (
578    ACPI_PARSE_OBJECT       *StartOp)
579{
580    ACPI_WALK_STATE         *WalkState;
581    ACPI_OPERAND_OBJECT     *ObjDesc;
582    ACPI_NAMESPACE_NODE     *Node;
583    ACPI_PARSE_OBJECT       *RootOp;
584    ACPI_PARSE_OBJECT       *Op;
585    ACPI_OPCODE_INFO        *OpInfo;
586    UINT32                  NumOps = 0;
587    UINT32                  NumOperands = 0;
588    UINT32                  NumOperators = 0;
589    UINT32                  NumRemainingOps = 0;
590    UINT32                  NumRemainingOperands = 0;
591    UINT32                  NumRemainingOperators = 0;
592    UINT32                  NumArgs;
593    UINT32                  Concurrency;
594    BOOLEAN                 CountRemaining = FALSE;
595
596
597    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
598    if (!WalkState)
599    {
600        AcpiOsPrintf ("There is no method currently executing\n");
601        return;
602    }
603
604    ObjDesc = WalkState->MethodDesc;
605    Node = WalkState->MethodNode;
606
607    NumArgs = ObjDesc->Method.ParamCount;
608    Concurrency = ObjDesc->Method.Concurrency;
609
610    AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name);
611    AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency);
612
613
614    RootOp = StartOp;
615    while (RootOp->Parent)
616    {
617        RootOp = RootOp->Parent;
618    }
619
620    Op = RootOp;
621
622    while (Op)
623    {
624        if (Op == StartOp)
625        {
626            CountRemaining = TRUE;
627        }
628
629        NumOps++;
630        if (CountRemaining)
631        {
632            NumRemainingOps++;
633        }
634
635        OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
636        if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
637        {
638            /* Bad opcode or ASCII character */
639
640            continue;
641        }
642
643
644        /* Decode the opcode */
645
646        switch (ACPI_GET_OP_CLASS (OpInfo))
647        {
648        case OPTYPE_CONSTANT:           /* argument type only */
649        case OPTYPE_LITERAL:            /* argument type only */
650        case OPTYPE_DATA_TERM:          /* argument type only */
651        case OPTYPE_LOCAL_VARIABLE:     /* argument type only */
652        case OPTYPE_METHOD_ARGUMENT:    /* argument type only */
653            if (CountRemaining)
654            {
655                NumRemainingOperands++;
656            }
657
658            NumOperands++;
659            break;
660
661        default:
662            if (CountRemaining)
663            {
664                NumRemainingOperators++;
665            }
666
667            NumOperators++;
668            break;
669        }
670
671
672        Op = AcpiPsGetDepthNext (StartOp, Op);
673    }
674
675    AcpiOsPrintf ("Method contains:       %X AML Opcodes - %X Operators, %X Operands\n",
676                NumOps, NumOperators, NumOperands);
677
678    AcpiOsPrintf ("Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands\n",
679                NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
680}
681
682
683/*******************************************************************************
684 *
685 * FUNCTION:    AcpiDbDisplayLocals
686 *
687 * PARAMETERS:  None
688 *
689 * RETURN:      None
690 *
691 * DESCRIPTION: Display all locals for the currently running control method
692 *
693 ******************************************************************************/
694
695void
696AcpiDbDisplayLocals (void)
697{
698    UINT32                  i;
699    ACPI_WALK_STATE         *WalkState;
700    ACPI_OPERAND_OBJECT     *ObjDesc;
701    ACPI_NAMESPACE_NODE     *Node;
702
703
704    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
705    if (!WalkState)
706    {
707        AcpiOsPrintf ("There is no method currently executing\n");
708        return;
709    }
710
711    ObjDesc = WalkState->MethodDesc;
712    Node = WalkState->MethodNode;
713
714
715    AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name);
716
717    for (i = 0; i < MTH_NUM_LOCALS; i++)
718    {
719        ObjDesc = WalkState->LocalVariables[i].Object;
720        AcpiOsPrintf ("Local%d: ", i);
721        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
722    }
723}
724
725
726/*******************************************************************************
727 *
728 * FUNCTION:    AcpiDbDisplayArguments
729 *
730 * PARAMETERS:  None
731 *
732 * RETURN:      None
733 *
734 * DESCRIPTION: Display all arguments for the currently running control method
735 *
736 ******************************************************************************/
737
738void
739AcpiDbDisplayArguments (void)
740{
741    UINT32                  i;
742    ACPI_WALK_STATE         *WalkState;
743    ACPI_OPERAND_OBJECT     *ObjDesc;
744    UINT32                  NumArgs;
745    UINT32                  Concurrency;
746    ACPI_NAMESPACE_NODE     *Node;
747
748
749    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
750    if (!WalkState)
751    {
752        AcpiOsPrintf ("There is no method currently executing\n");
753        return;
754    }
755
756    ObjDesc = WalkState->MethodDesc;
757    Node = WalkState->MethodNode;
758
759    NumArgs = ObjDesc->Method.ParamCount;
760    Concurrency = ObjDesc->Method.Concurrency;
761
762    AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &Node->Name, NumArgs, Concurrency);
763
764    for (i = 0; i < NumArgs; i++)
765    {
766        ObjDesc = WalkState->Arguments[i].Object;
767        AcpiOsPrintf ("Arg%d: ", i);
768        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
769    }
770}
771
772
773/*******************************************************************************
774 *
775 * FUNCTION:    AcpiDbDisplayResults
776 *
777 * PARAMETERS:  None
778 *
779 * RETURN:      None
780 *
781 * DESCRIPTION: Display current contents of a method result stack
782 *
783 ******************************************************************************/
784
785void
786AcpiDbDisplayResults (void)
787{
788    UINT32                  i;
789    ACPI_WALK_STATE         *WalkState;
790    ACPI_OPERAND_OBJECT     *ObjDesc;
791    UINT32                  NumResults = 0;
792    ACPI_NAMESPACE_NODE     *Node;
793
794
795    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
796    if (!WalkState)
797    {
798        AcpiOsPrintf ("There is no method currently executing\n");
799        return;
800    }
801
802    ObjDesc = WalkState->MethodDesc;
803    Node = WalkState->MethodNode;
804
805    if (WalkState->Results)
806    {
807        NumResults = WalkState->Results->Results.NumResults;
808    }
809
810    AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", &Node->Name, NumResults);
811
812    for (i = 0; i < NumResults; i++)
813    {
814        ObjDesc = WalkState->Results->Results.ObjDesc[i];
815        AcpiOsPrintf ("Result%d: ", i);
816        AcpiDbDisplayInternalObject (ObjDesc, WalkState);
817    }
818}
819
820
821/*******************************************************************************
822 *
823 * FUNCTION:    AcpiDbDisplayCallingTree
824 *
825 * PARAMETERS:  None
826 *
827 * RETURN:      None
828 *
829 * DESCRIPTION: Display current calling tree of nested control methods
830 *
831 ******************************************************************************/
832
833void
834AcpiDbDisplayCallingTree (void)
835{
836    UINT32                  i;
837    ACPI_WALK_STATE         *WalkState;
838    ACPI_OPERAND_OBJECT     *ObjDesc;
839    ACPI_NAMESPACE_NODE     *Node;
840
841
842    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
843    if (!WalkState)
844    {
845        AcpiOsPrintf ("There is no method currently executing\n");
846        return;
847    }
848
849    ObjDesc = WalkState->MethodDesc;
850    Node = WalkState->MethodNode;
851
852    AcpiOsPrintf ("Current Control Method Call Tree\n");
853
854    for (i = 0; WalkState; i++)
855    {
856        ObjDesc = WalkState->MethodDesc;
857        Node = WalkState->MethodNode;
858
859        AcpiOsPrintf ("    [%4.4s]\n", &Node->Name);
860
861        WalkState = WalkState->Next;
862    }
863}
864
865
866/*******************************************************************************
867 *
868 * FUNCTION:    AcpiDbDisplayResultObject
869 *
870 * PARAMETERS:  ObjDesc         - Object to be displayed
871 *              WalkState       - Current walk state
872 *
873 * RETURN:      None
874 *
875 * DESCRIPTION: Display the result of an AML opcode
876 *
877 ******************************************************************************/
878
879void
880AcpiDbDisplayResultObject (
881    ACPI_OPERAND_OBJECT     *ObjDesc,
882    ACPI_WALK_STATE         *WalkState)
883{
884
885    /* TBD: [Future] We don't always want to display the result.
886     * For now, only display if single stepping
887     * however, this output is very useful in other contexts also
888     */
889
890    if (!AcpiGbl_CmSingleStep)
891    {
892        return;
893    }
894
895    AcpiOsPrintf ("ResultObj: ");
896    AcpiDbDisplayInternalObject (ObjDesc, WalkState);
897    AcpiOsPrintf ("\n");
898}
899
900
901/*******************************************************************************
902 *
903 * FUNCTION:    AcpiDbDisplayArgumentObject
904 *
905 * PARAMETERS:  ObjDesc         - Object to be displayed
906 *              WalkState       - Current walk state
907 *
908 * RETURN:      None
909 *
910 * DESCRIPTION: Display the result of an AML opcode
911 *
912 ******************************************************************************/
913
914void
915AcpiDbDisplayArgumentObject (
916    ACPI_OPERAND_OBJECT     *ObjDesc,
917    ACPI_WALK_STATE         *WalkState)
918{
919
920
921    if (!AcpiGbl_CmSingleStep)
922    {
923        return;
924    }
925
926    AcpiOsPrintf ("ArgObj:    ");
927    AcpiDbDisplayInternalObject (ObjDesc, WalkState);
928}
929
930#endif /* ENABLE_DEBUGGER */
931
932