exdump.c revision 70243
1/******************************************************************************
2 *
3 * Module Name: amdump - Interpreter debug output routines
4 *              $Revision: 97 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 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#define __AMDUMP_C__
118
119#include "acpi.h"
120#include "acinterp.h"
121#include "amlcode.h"
122#include "acnamesp.h"
123#include "actables.h"
124
125#define _COMPONENT          INTERPRETER
126        MODULE_NAME         ("amdump")
127
128
129/*
130 * The following routines are used for debug output only
131 */
132
133#ifdef ACPI_DEBUG
134
135/*****************************************************************************
136 *
137 * FUNCTION:    AcpiAmlShowHexValue
138 *
139 * PARAMETERS:  ByteCount           - Number of bytes to print (1, 2, or 4)
140 *              *AmlPtr             - Address in AML stream of bytes to print
141 *              InterpreterMode     - Current running mode (load1/Load2/Exec)
142 *              LeadSpace           - # of spaces to print ahead of value
143 *                                    0 => none ahead but one behind
144 *
145 * DESCRIPTION: Print ByteCount byte(s) starting at AcpiAmlPtr as a single
146 *              value, in hex.  If ByteCount > 1 or the value printed is > 9, also
147 *              print in decimal.
148 *
149 ****************************************************************************/
150
151void
152AcpiAmlShowHexValue (
153    UINT32                  ByteCount,
154    UINT8                   *AmlPtr,
155    UINT32                  LeadSpace)
156{
157    UINT32                  Value;                  /*  Value retrieved from AML stream */
158    UINT32                  ShowDecimalValue;
159    UINT32                  Length;                 /*  Length of printed field */
160    UINT8                   *CurrentAmlPtr = NULL;  /*  Pointer to current byte of AML value    */
161
162
163    FUNCTION_TRACE ("AmlShowHexValue");
164
165
166    if (!AmlPtr)
167    {
168        REPORT_ERROR (("AmlShowHexValue: null pointer\n"));
169    }
170
171    /*
172     * AML numbers are always stored little-endian,
173     * even if the processor is big-endian.
174     */
175    for (CurrentAmlPtr = AmlPtr + ByteCount,
176            Value = 0;
177            CurrentAmlPtr > AmlPtr; )
178    {
179        Value = (Value << 8) + (UINT32)* --CurrentAmlPtr;
180    }
181
182    Length = LeadSpace * ByteCount + 2;
183    if (ByteCount > 1)
184    {
185        Length += (ByteCount - 1);
186    }
187
188    ShowDecimalValue = (ByteCount > 1 || Value > 9);
189    if (ShowDecimalValue)
190    {
191        Length += 3 + AcpiAmlDigitsNeeded (Value, 10);
192    }
193
194    DEBUG_PRINT (TRACE_LOAD, (""));
195
196    for (Length = LeadSpace; Length; --Length )
197    {
198        DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
199    }
200
201    while (ByteCount--)
202    {
203        DEBUG_PRINT_RAW (TRACE_LOAD, ("%02x", *AmlPtr++));
204
205        if (ByteCount)
206        {
207            DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
208        }
209    }
210
211    if (ShowDecimalValue)
212    {
213        DEBUG_PRINT_RAW (TRACE_LOAD, (" [%ld]", Value));
214    }
215
216    if (0 == LeadSpace)
217    {
218        DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
219    }
220
221    DEBUG_PRINT_RAW (TRACE_LOAD, ("\n"));
222    return_VOID;
223}
224
225
226/*****************************************************************************
227 *
228 * FUNCTION:    AcpiAmlDumpOperand
229 *
230 * PARAMETERS:  *EntryDesc          - Pointer to entry to be dumped
231 *
232 * RETURN:      Status
233 *
234 * DESCRIPTION: Dump a stack entry
235 *
236 ****************************************************************************/
237
238ACPI_STATUS
239AcpiAmlDumpOperand (
240    ACPI_OPERAND_OBJECT     *EntryDesc)
241{
242    UINT8                   *Buf = NULL;
243    UINT32                  Length;
244    UINT32                  i;
245
246
247    if (!EntryDesc)
248    {
249        /*
250         * This usually indicates that something serious is wrong --
251         * since most (if not all)
252         * code that dumps the stack expects something to be there!
253         */
254        DEBUG_PRINT (ACPI_INFO,
255            ("AmlDumpOperand: *** Possible error: Null stack entry ptr\n"));
256        return (AE_OK);
257    }
258
259    if (VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_NAMED))
260    {
261        DEBUG_PRINT (ACPI_INFO,
262            ("AmlDumpOperand: Node: \n"));
263        DUMP_ENTRY (EntryDesc, ACPI_INFO);
264        return (AE_OK);
265    }
266
267    if (AcpiTbSystemTablePointer (EntryDesc))
268    {
269        DEBUG_PRINT (ACPI_INFO,
270            ("AmlDumpOperand: %p is a Pcode pointer\n",
271            EntryDesc));
272        return (AE_OK);
273    }
274
275    if (!VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_INTERNAL))
276    {
277        DEBUG_PRINT (ACPI_INFO,
278            ("AmlDumpOperand: %p Not a local object \n", EntryDesc));
279        DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
280        return (AE_OK);
281    }
282
283    /*  EntryDesc is a valid object  */
284
285    DEBUG_PRINT (ACPI_INFO, ("AmlDumpOperand: %p ", EntryDesc));
286
287    switch (EntryDesc->Common.Type)
288    {
289    case INTERNAL_TYPE_REFERENCE:
290
291        switch (EntryDesc->Reference.OpCode)
292        {
293        case AML_ZERO_OP:
294
295            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Zero\n"));
296            break;
297
298
299        case AML_ONE_OP:
300
301            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: One\n"));
302            break;
303
304
305        case AML_ONES_OP:
306
307            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Ones\n"));
308            break;
309
310
311        case AML_DEBUG_OP:
312
313            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Debug\n"));
314            break;
315
316
317        case AML_NAME_OP:
318
319            DUMP_PATHNAME (EntryDesc->Reference.Object, "Reference: Name: ",
320                            ACPI_INFO, _COMPONENT);
321            DUMP_ENTRY (EntryDesc->Reference.Object, ACPI_INFO);
322            break;
323
324
325        case AML_INDEX_OP:
326
327            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Index %p\n",
328                        EntryDesc->Reference.Object));
329            break;
330
331
332        case AML_ARG_OP:
333
334            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Arg%d",
335                        EntryDesc->Reference.Offset));
336
337            if (ACPI_TYPE_NUMBER == EntryDesc->Common.Type)
338            {
339                /* Value is a Number */
340
341                DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
342                                            EntryDesc->Number.Value));
343            }
344
345            DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
346            break;
347
348
349        case AML_LOCAL_OP:
350
351            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Local%d",
352                        EntryDesc->Reference.Offset));
353
354            if (ACPI_TYPE_NUMBER == EntryDesc->Common.Type)
355            {
356
357                /* Value is a Number */
358
359                DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
360                                            EntryDesc->Number.Value));
361            }
362
363            DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
364            break;
365
366
367        case AML_NAMEPATH_OP:
368            DEBUG_PRINT_RAW (ACPI_INFO, ("Reference.Node->Name %x\n",
369                        EntryDesc->Reference.Node->Name));
370            break;
371
372        default:
373
374            /*  unknown opcode  */
375
376            DEBUG_PRINT_RAW (ACPI_INFO, ("Unknown opcode=%X\n",
377                EntryDesc->Reference.OpCode));
378            break;
379
380        }
381
382        break;
383
384
385    case ACPI_TYPE_BUFFER:
386
387        DEBUG_PRINT_RAW (ACPI_INFO, ("Buffer len %X @ %p \n",
388                    EntryDesc->Buffer.Length,
389                    EntryDesc->Buffer.Pointer));
390
391        Length = EntryDesc->Buffer.Length;
392
393        if (Length > 64)
394        {
395            Length = 64;
396        }
397
398        /* Debug only -- dump the buffer contents */
399
400        if (EntryDesc->Buffer.Pointer)
401        {
402            DEBUG_PRINT_RAW (ACPI_INFO, ("Buffer Contents: "));
403
404            for (Buf = EntryDesc->Buffer.Pointer; Length--; ++Buf)
405            {
406                DEBUG_PRINT_RAW (ACPI_INFO,
407                    (Length ? " %02x" : " %02x", *Buf));
408            }
409            DEBUG_PRINT_RAW (ACPI_INFO,("\n"));
410        }
411
412        break;
413
414
415    case ACPI_TYPE_NUMBER:
416
417        DEBUG_PRINT_RAW (ACPI_INFO, ("Number %lX\n",
418                    EntryDesc->Number.Value));
419        break;
420
421
422    case INTERNAL_TYPE_IF:
423
424        DEBUG_PRINT_RAW (ACPI_INFO, ("If [Number] %lX\n",
425                    EntryDesc->Number.Value));
426        break;
427
428
429    case INTERNAL_TYPE_WHILE:
430
431        DEBUG_PRINT_RAW (ACPI_INFO, ("While [Number] %lX\n",
432                    EntryDesc->Number.Value));
433        break;
434
435
436    case ACPI_TYPE_PACKAGE:
437
438        DEBUG_PRINT_RAW (ACPI_INFO, ("Package count %X @ %p\n",
439                    EntryDesc->Package.Count, EntryDesc->Package.Elements));
440
441
442        /*
443         * If elements exist, package vector pointer is valid,
444         * and debug_level exceeds 1, dump package's elements.
445         */
446        if (EntryDesc->Package.Count &&
447            EntryDesc->Package.Elements &&
448            GetDebugLevel () > 1)
449        {
450            ACPI_OPERAND_OBJECT**Element;
451            UINT16              ElementIndex;
452
453            for (ElementIndex = 0, Element = EntryDesc->Package.Elements;
454                  ElementIndex < EntryDesc->Package.Count;
455                  ++ElementIndex, ++Element)
456            {
457                AcpiAmlDumpOperand (*Element);
458            }
459        }
460
461        DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
462
463        break;
464
465
466    case ACPI_TYPE_REGION:
467
468        DEBUG_PRINT_RAW (ACPI_INFO, ("Region %s (%X)",
469            AcpiCmGetRegionName (EntryDesc->Region.SpaceId),
470            EntryDesc->Region.SpaceId));
471
472        /*
473         * If the address and length have not been evaluated,
474         * don't print them.
475         */
476        if (!(EntryDesc->Region.Flags & AOPOBJ_DATA_VALID))
477        {
478            DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
479        }
480        else
481        {
482            DEBUG_PRINT_RAW (ACPI_INFO, (" base %p Length %X\n",
483                EntryDesc->Region.Address, EntryDesc->Region.Length));
484        }
485        break;
486
487
488    case ACPI_TYPE_STRING:
489
490        DEBUG_PRINT_RAW (ACPI_INFO, ("String length %X @ %p\n\n",
491                    EntryDesc->String.Length, EntryDesc->String.Pointer));
492
493        for (i=0; i < EntryDesc->String.Length; i++)
494        {
495            DEBUG_PRINT_RAW (ACPI_INFO, ("%c",
496                        EntryDesc->String.Pointer[i]));
497        }
498
499        DEBUG_PRINT_RAW (ACPI_INFO, ("\n\n"));
500        break;
501
502
503    case INTERNAL_TYPE_BANK_FIELD:
504
505        DEBUG_PRINT_RAW (ACPI_INFO, ("BankField\n"));
506        break;
507
508
509    case INTERNAL_TYPE_DEF_FIELD:
510
511        DEBUG_PRINT_RAW (ACPI_INFO,
512            ("DefField: bits=%X  acc=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
513            EntryDesc->Field.Length,   EntryDesc->Field.Access,
514            EntryDesc->Field.LockRule, EntryDesc->Field.UpdateRule,
515            EntryDesc->Field.Offset,   EntryDesc->Field.BitOffset));
516        DUMP_STACK_ENTRY (EntryDesc->Field.Container);
517        break;
518
519
520    case INTERNAL_TYPE_INDEX_FIELD:
521
522        DEBUG_PRINT_RAW (ACPI_INFO, ("IndexField\n"));
523        break;
524
525
526    case ACPI_TYPE_FIELD_UNIT:
527
528        DEBUG_PRINT_RAW (ACPI_INFO,
529            ("FieldUnit: %X bits acc %X lock %X update %X at byte %lX bit %X of \n",
530            EntryDesc->FieldUnit.Length,   EntryDesc->FieldUnit.Access,
531            EntryDesc->FieldUnit.LockRule, EntryDesc->FieldUnit.UpdateRule,
532            EntryDesc->FieldUnit.Offset,   EntryDesc->FieldUnit.BitOffset));
533
534        if (!EntryDesc->FieldUnit.Container)
535        {
536            DEBUG_PRINT (ACPI_INFO, ("*NULL* \n"));
537        }
538
539        else if (ACPI_TYPE_BUFFER !=
540                     EntryDesc->FieldUnit.Container->Common.Type)
541        {
542            DEBUG_PRINT_RAW (ACPI_INFO, ("*not a Buffer* \n"));
543        }
544
545        else
546        {
547            DUMP_STACK_ENTRY (EntryDesc->FieldUnit.Container);
548        }
549
550        break;
551
552
553    case ACPI_TYPE_EVENT:
554
555        DEBUG_PRINT_RAW (ACPI_INFO, ("Event\n"));
556        break;
557
558
559    case ACPI_TYPE_METHOD:
560
561        DEBUG_PRINT_RAW (ACPI_INFO,
562            ("Method(%X) @ %p:%lX\n",
563            EntryDesc->Method.ParamCount,
564            EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength));
565        break;
566
567
568    case ACPI_TYPE_MUTEX:
569
570        DEBUG_PRINT_RAW (ACPI_INFO, ("Mutex\n"));
571        break;
572
573
574    case ACPI_TYPE_DEVICE:
575
576        DEBUG_PRINT_RAW (ACPI_INFO, ("Device\n"));
577        break;
578
579
580    case ACPI_TYPE_POWER:
581
582        DEBUG_PRINT_RAW (ACPI_INFO, ("Power\n"));
583        break;
584
585
586    case ACPI_TYPE_PROCESSOR:
587
588        DEBUG_PRINT_RAW (ACPI_INFO, ("Processor\n"));
589        break;
590
591
592    case ACPI_TYPE_THERMAL:
593
594        DEBUG_PRINT_RAW (ACPI_INFO, ("Thermal\n"));
595        break;
596
597
598    default:
599        /*  unknown EntryDesc->Common.Type value    */
600
601        DEBUG_PRINT_RAW (ACPI_INFO, ("Unknown Type %X\n",
602            EntryDesc->Common.Type));
603
604        /* Back up to previous entry */
605
606        EntryDesc--;
607
608
609        /* TBD: [Restructure]  Change to use dump object routine !! */
610        /*       What is all of this?? */
611
612        DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
613        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
614        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
615        break;
616
617    }
618
619    return (AE_OK);
620}
621
622
623/*****************************************************************************
624 *
625 * FUNCTION:    AcpiAmlDumpOperands
626 *
627 * PARAMETERS:  InterpreterMode      - Load or Exec
628 *              *Ident              - Identification
629 *              NumLevels           - # of stack entries to dump above line
630 *              *Note               - Output notation
631 *
632 * DESCRIPTION: Dump the object stack
633 *
634 ****************************************************************************/
635
636void
637AcpiAmlDumpOperands (
638    ACPI_OPERAND_OBJECT     **Operands,
639    OPERATING_MODE          InterpreterMode,
640    NATIVE_CHAR             *Ident,
641    UINT32                  NumLevels,
642    NATIVE_CHAR             *Note,
643    NATIVE_CHAR             *ModuleName,
644    UINT32                  LineNumber)
645{
646    NATIVE_UINT             i;
647    ACPI_OPERAND_OBJECT     **EntryDesc;
648
649
650    if (!Ident)
651    {
652        Ident = "?";
653    }
654
655    if (!Note)
656    {
657        Note = "?";
658    }
659
660
661    DEBUG_PRINT (ACPI_INFO,
662        ("************* AcpiAmlDumpOperands  Mode=%X ******************\n",
663        InterpreterMode));
664    DEBUG_PRINT (ACPI_INFO,
665        ("From %12s(%d)  %s: %s\n", ModuleName, LineNumber, Ident, Note));
666
667    if (NumLevels == 0)
668        NumLevels = 1;
669
670    /* Dump the stack starting at the top, working down */
671
672    for (i = 0; NumLevels > 0; i--, NumLevels--)
673    {
674        EntryDesc = &Operands[i];
675
676        if (ACPI_FAILURE (AcpiAmlDumpOperand (*EntryDesc)))
677        {
678            break;
679        }
680    }
681
682    return;
683}
684
685
686/*****************************************************************************
687 *
688 * FUNCTION:    AcpiAmlDumpNode
689 *
690 * PARAMETERS:  *Node           - Descriptor to dump
691 *              Flags               - Force display
692 *
693 * DESCRIPTION: Dumps the members of the given.Node
694 *
695 ****************************************************************************/
696
697void
698AcpiAmlDumpNode (
699    ACPI_NAMESPACE_NODE     *Node,
700    UINT32                  Flags)
701{
702
703    if (!Flags)
704    {
705        if (!((TRACE_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
706        {
707            return;
708        }
709    }
710
711
712    AcpiOsPrintf ("%20s : %4.4s\n", "Name",             &Node->Name);
713    AcpiOsPrintf ("%20s : %s\n",    "Type",             AcpiCmGetTypeName (Node->Type));
714    AcpiOsPrintf ("%20s : %X\n",    "Flags",            Node->Flags);
715    AcpiOsPrintf ("%20s : %X\n",    "Owner Id",         Node->OwnerId);
716    AcpiOsPrintf ("%20s : %X\n",    "Reference Count",  Node->ReferenceCount);
717    AcpiOsPrintf ("%20s : %p\n",    "Attached Object",  Node->Object);
718    AcpiOsPrintf ("%20s : %p\n",    "ChildList",        Node->Child);
719    AcpiOsPrintf ("%20s : %p\n",    "NextPeer",         Node->Peer);
720    AcpiOsPrintf ("%20s : %p\n",    "Parent",           AcpiNsGetParentObject (Node));
721}
722
723
724/*****************************************************************************
725 *
726 * FUNCTION:    AcpiAmlDumpObjectDescriptor
727 *
728 * PARAMETERS:  *Object             - Descriptor to dump
729 *              Flags               - Force display
730 *
731 * DESCRIPTION: Dumps the members of the object descriptor given.
732 *
733 ****************************************************************************/
734
735void
736AcpiAmlDumpObjectDescriptor (
737    ACPI_OPERAND_OBJECT     *ObjDesc,
738    UINT32                  Flags)
739{
740    FUNCTION_TRACE ("AmlDumpObjectDescriptor");
741
742
743    if (!Flags)
744    {
745        if (!((TRACE_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
746        {
747            return;
748        }
749    }
750
751    if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)))
752    {
753        AcpiOsPrintf ("%p is not a valid ACPI object\n", ObjDesc);
754        return;
755    }
756
757    /* Common Fields */
758
759    AcpiOsPrintf ("%20s : %X\n",   "Reference Count", ObjDesc->Common.ReferenceCount);
760    AcpiOsPrintf ("%20s : %X\n",   "Flags", ObjDesc->Common.Flags);
761
762    /* Object-specific Fields */
763
764    switch (ObjDesc->Common.Type)
765    {
766    case ACPI_TYPE_NUMBER:
767
768        AcpiOsPrintf ("%20s : %s\n", "Type", "Number");
769        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->Number.Value);
770        break;
771
772
773    case ACPI_TYPE_STRING:
774
775        AcpiOsPrintf ("%20s : %s\n", "Type", "String");
776        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->String.Length);
777        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->String.Pointer);
778        break;
779
780
781    case ACPI_TYPE_BUFFER:
782
783        AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer");
784        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length);
785        AcpiOsPrintf ("%20s : %X\n", "Sequence", ObjDesc->Buffer.Sequence);
786        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer);
787        break;
788
789
790    case ACPI_TYPE_PACKAGE:
791
792        AcpiOsPrintf ("%20s : %s\n", "Type", "Package");
793        AcpiOsPrintf ("%20s : %X\n", "Count", ObjDesc->Package.Count);
794        AcpiOsPrintf ("%20s : %p\n", "Elements", ObjDesc->Package.Elements);
795        AcpiOsPrintf ("%20s : %p\n", "NextElement", ObjDesc->Package.NextElement);
796        break;
797
798
799    case ACPI_TYPE_FIELD_UNIT:
800
801        AcpiOsPrintf ("%20s : %s\n", "Type", "FieldUnit");
802        AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->FieldUnit.Access);
803        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->FieldUnit.LockRule);
804        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->FieldUnit.UpdateRule);
805        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->FieldUnit.Length);
806        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->FieldUnit.BitOffset);
807        AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->FieldUnit.Offset);
808        AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->FieldUnit.Container);
809        break;
810
811
812    case ACPI_TYPE_DEVICE:
813
814        AcpiOsPrintf ("%20s : %s\n", "Type", "Device");
815        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Device.AddrHandler);
816        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Device.SysHandler);
817        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Device.DrvHandler);
818        break;
819
820    case ACPI_TYPE_EVENT:
821
822        AcpiOsPrintf ("%20s : %s\n", "Type", "Event");
823        AcpiOsPrintf ("%20s : %X\n", "Semaphore", ObjDesc->Event.Semaphore);
824        break;
825
826
827    case ACPI_TYPE_METHOD:
828
829        AcpiOsPrintf ("%20s : %s\n", "Type", "Method");
830        AcpiOsPrintf ("%20s : %X\n", "ParamCount", ObjDesc->Method.ParamCount);
831        AcpiOsPrintf ("%20s : %X\n", "Concurrency", ObjDesc->Method.Concurrency);
832        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Method.Semaphore);
833        AcpiOsPrintf ("%20s : %X\n", "PcodeLength", ObjDesc->Method.PcodeLength);
834        AcpiOsPrintf ("%20s : %X\n", "Pcode", ObjDesc->Method.Pcode);
835        break;
836
837
838    case ACPI_TYPE_MUTEX:
839
840        AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex");
841        AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel);
842        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore);
843        break;
844
845
846    case ACPI_TYPE_REGION:
847
848        AcpiOsPrintf ("%20s : %s\n", "Type", "Region");
849        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->Region.SpaceId);
850        AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Region.Flags);
851        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Region.Address);
852        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Region.Length);
853        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Region.AddrHandler);
854        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->Region.Next);
855        break;
856
857
858    case ACPI_TYPE_POWER:
859
860        AcpiOsPrintf ("%20s : %s\n", "Type", "PowerResource");
861        AcpiOsPrintf ("%20s : %X\n", "SystemLevel", ObjDesc->PowerResource.SystemLevel);
862        AcpiOsPrintf ("%20s : %X\n", "ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
863        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->PowerResource.SysHandler);
864        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->PowerResource.DrvHandler);
865        break;
866
867
868    case ACPI_TYPE_PROCESSOR:
869
870        AcpiOsPrintf ("%20s : %s\n", "Type", "Processor");
871        AcpiOsPrintf ("%20s : %X\n", "Processor ID", ObjDesc->Processor.ProcId);
872        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Processor.Length);
873        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Processor.Address);
874        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Processor.SysHandler);
875        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Processor.DrvHandler);
876        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Processor.AddrHandler);
877        break;
878
879
880    case ACPI_TYPE_THERMAL:
881
882        AcpiOsPrintf ("%20s : %s\n", "Type", "ThermalZone");
883        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->ThermalZone.SysHandler);
884        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->ThermalZone.DrvHandler);
885        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler);
886        break;
887
888    case INTERNAL_TYPE_BANK_FIELD:
889
890        AcpiOsPrintf ("%20s : %s\n", "Type", "BankField");
891        AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->BankField.Access);
892        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule);
893        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule);
894        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->BankField.Length);
895        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.BitOffset);
896        AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->BankField.Offset);
897        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value);
898        AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->BankField.Container);
899        AcpiOsPrintf ("%20s : %X\n", "BankSelect", ObjDesc->BankField.BankSelect);
900        break;
901
902
903    case INTERNAL_TYPE_INDEX_FIELD:
904
905        AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField");
906        AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->IndexField.Access);
907        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule);
908        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule);
909        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->IndexField.Length);
910        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.BitOffset);
911        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value);
912        AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.Index);
913        AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.Data);
914        break;
915
916
917    case INTERNAL_TYPE_REFERENCE:
918
919        AcpiOsPrintf ("%20s : %s\n", "Type", "Reference");
920        AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType);
921        AcpiOsPrintf ("%20s : %X\n", "OpCode", ObjDesc->Reference.OpCode);
922        AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset);
923        AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object);
924        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node);
925        AcpiOsPrintf ("%20s : %p\n", "Where", ObjDesc->Reference.Where);
926        break;
927
928
929    case INTERNAL_TYPE_ADDRESS_HANDLER:
930
931        AcpiOsPrintf ("%20s : %s\n", "Type", "Address Handler");
932        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId);
933        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->AddrHandler.Next);
934        AcpiOsPrintf ("%20s : %p\n", "RegionList", ObjDesc->AddrHandler.RegionList);
935        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->AddrHandler.Node);
936        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->AddrHandler.Handler);
937        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->AddrHandler.Context);
938        break;
939
940
941    case INTERNAL_TYPE_NOTIFY:
942
943        AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler");
944        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->NotifyHandler.Node);
945        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->NotifyHandler.Handler);
946        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->NotifyHandler.Context);
947        break;
948
949
950    case INTERNAL_TYPE_DEF_FIELD:
951
952        AcpiOsPrintf ("%20s : %p\n", "Granularity", ObjDesc->Field.Granularity);
953        AcpiOsPrintf ("%20s : %p\n", "Length", ObjDesc->Field.Length);
954        AcpiOsPrintf ("%20s : %p\n", "Offset", ObjDesc->Field.Offset);
955        AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.BitOffset);
956        AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->Field.Container);
957        break;
958
959
960    case INTERNAL_TYPE_ALIAS:
961    case INTERNAL_TYPE_DEF_FIELD_DEFN:
962    case INTERNAL_TYPE_BANK_FIELD_DEFN:
963    case INTERNAL_TYPE_INDEX_FIELD_DEFN:
964    case INTERNAL_TYPE_IF:
965    case INTERNAL_TYPE_ELSE:
966    case INTERNAL_TYPE_WHILE:
967    case INTERNAL_TYPE_SCOPE:
968    case INTERNAL_TYPE_DEF_ANY:
969
970        AcpiOsPrintf ("*** Structure display not implemented for type %X! ***\n",
971            ObjDesc->Common.Type);
972        break;
973
974
975    default:
976
977        AcpiOsPrintf ("*** Cannot display unknown type %X! ***\n", ObjDesc->Common.Type);
978        break;
979    }
980
981    return_VOID;
982}
983
984#endif
985
986