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