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