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