exdump.c revision 82367
1/******************************************************************************
2 *
3 * Module Name: exdump - Interpreter debug output routines
4 *              $Revision: 116 $
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 *              *AmlPtr             - 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 AmlPtr 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                   *AmlPtr,
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 (!AmlPtr)
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 = AmlPtr + ByteCount,
177            Value = 0;
178            CurrentAmlPtr > AmlPtr; )
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", *AmlPtr++));
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, "Node: \n"));
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 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_DEBUG_OP:
312
313            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n"));
314            break;
315
316
317        case AML_NAME_OP:
318
319            DUMP_PATHNAME (EntryDesc->Reference.Object, "Reference: Name: ",
320                            ACPI_LV_INFO, _COMPONENT);
321            DUMP_ENTRY (EntryDesc->Reference.Object, ACPI_LV_INFO);
322            break;
323
324
325        case AML_INDEX_OP:
326
327            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Index %p\n",
328                        EntryDesc->Reference.Object));
329            break;
330
331
332        case AML_ARG_OP:
333
334            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Arg%d",
335                        EntryDesc->Reference.Offset));
336
337            if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
338            {
339                /* Value is a Number */
340
341                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
342                                            EntryDesc->Integer.Value));
343            }
344
345            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
346            break;
347
348
349        case AML_LOCAL_OP:
350
351            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Local%d",
352                        EntryDesc->Reference.Offset));
353
354            if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
355            {
356
357                /* Value is a Number */
358
359                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%ld]",
360                                            EntryDesc->Integer.Value));
361            }
362
363            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
364            break;
365
366
367        case AML_INT_NAMEPATH_OP:
368            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %x\n",
369                        EntryDesc->Reference.Node->Name));
370            break;
371
372        default:
373
374            /*  unknown opcode  */
375
376            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_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        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_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            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: "));
403
404            for (Buf = EntryDesc->Buffer.Pointer; Length--; ++Buf)
405            {
406                ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
407                    Length ? " %02x" : " %02x", *Buf));
408            }
409            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n"));
410        }
411
412        break;
413
414
415    case ACPI_TYPE_INTEGER:
416
417        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Number %lX\n",
418                    EntryDesc->Integer.Value));
419        break;
420
421
422    case INTERNAL_TYPE_IF:
423
424        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Number] %lX\n",
425                    EntryDesc->Integer.Value));
426        break;
427
428
429    case INTERNAL_TYPE_WHILE:
430
431        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Number] %lX\n",
432                    EntryDesc->Integer.Value));
433        break;
434
435
436    case ACPI_TYPE_PACKAGE:
437
438        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_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                AcpiExDumpOperand (*Element);
458            }
459        }
460
461        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
462
463        break;
464
465
466    case ACPI_TYPE_REGION:
467
468        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)",
469            AcpiUtGetRegionName (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            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
479        }
480        else
481        {
482            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_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        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_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            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c",
496                        EntryDesc->String.Pointer[i]));
497        }
498
499        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n\n"));
500        break;
501
502
503    case INTERNAL_TYPE_BANK_FIELD:
504
505        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "BankField\n"));
506        break;
507
508
509    case INTERNAL_TYPE_REGION_FIELD:
510
511        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
512            "RegionField: bits=%X  bitaccwidth=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
513            EntryDesc->Field.BitLength,      EntryDesc->Field.AccessBitWidth,
514            EntryDesc->Field.LockRule,       EntryDesc->Field.UpdateRule,
515            EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset));
516        DUMP_STACK_ENTRY (EntryDesc->Field.RegionObj);
517        break;
518
519
520    case INTERNAL_TYPE_INDEX_FIELD:
521
522        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "IndexField\n"));
523        break;
524
525
526    case ACPI_TYPE_BUFFER_FIELD:
527
528        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
529            "BufferField: %X bits at byte %lX bit %X of \n",
530            EntryDesc->BufferField.BitLength, EntryDesc->BufferField.BaseByteOffset,
531            EntryDesc->BufferField.StartFieldBitOffset));
532
533        if (!EntryDesc->BufferField.BufferObj)
534        {
535            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
536        }
537
538        else if (ACPI_TYPE_BUFFER !=
539                     EntryDesc->BufferField.BufferObj->Common.Type)
540        {
541            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n"));
542        }
543
544        else
545        {
546            DUMP_STACK_ENTRY (EntryDesc->BufferField.BufferObj);
547        }
548
549        break;
550
551
552    case ACPI_TYPE_EVENT:
553
554        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n"));
555        break;
556
557
558    case ACPI_TYPE_METHOD:
559
560        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
561            "Method(%X) @ %p:%lX\n",
562            EntryDesc->Method.ParamCount,
563            EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength));
564        break;
565
566
567    case ACPI_TYPE_MUTEX:
568
569        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Mutex\n"));
570        break;
571
572
573    case ACPI_TYPE_DEVICE:
574
575        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Device\n"));
576        break;
577
578
579    case ACPI_TYPE_POWER:
580
581        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Power\n"));
582        break;
583
584
585    case ACPI_TYPE_PROCESSOR:
586
587        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Processor\n"));
588        break;
589
590
591    case ACPI_TYPE_THERMAL:
592
593        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Thermal\n"));
594        break;
595
596
597    default:
598        /*  unknown EntryDesc->Common.Type value    */
599
600        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown Type %X\n",
601            EntryDesc->Common.Type));
602
603        /* Back up to previous entry */
604
605        EntryDesc--;
606
607
608        /* TBD: [Restructure]  Change to use dump object routine !! */
609        /*       What is all of this?? */
610
611        DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
612        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
613        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
614        break;
615
616    }
617
618    return (AE_OK);
619}
620
621
622/*****************************************************************************
623 *
624 * FUNCTION:    AcpiExDumpOperands
625 *
626 * PARAMETERS:  InterpreterMode      - Load or Exec
627 *              *Ident              - Identification
628 *              NumLevels           - # of stack entries to dump above line
629 *              *Note               - Output notation
630 *
631 * DESCRIPTION: Dump the object stack
632 *
633 ****************************************************************************/
634
635void
636AcpiExDumpOperands (
637    ACPI_OPERAND_OBJECT     **Operands,
638    OPERATING_MODE          InterpreterMode,
639    NATIVE_CHAR             *Ident,
640    UINT32                  NumLevels,
641    NATIVE_CHAR             *Note,
642    NATIVE_CHAR             *ModuleName,
643    UINT32                  LineNumber)
644{
645    NATIVE_UINT             i;
646    ACPI_OPERAND_OBJECT     **EntryDesc;
647
648
649    PROC_NAME ("AcpiExDumpOperands");
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        "************* AcpiExDumpOperands  Mode=%X ******************\n",
664        InterpreterMode));
665    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
666        "From %12s(%d)  %s: %s\n", ModuleName, LineNumber, Ident, Note));
667
668    if (NumLevels == 0)
669    {
670        NumLevels = 1;
671    }
672
673    /* Dump the stack starting at the top, working down */
674
675    for (i = 0; NumLevels > 0; i--, NumLevels--)
676    {
677        EntryDesc = &Operands[i];
678
679        if (ACPI_FAILURE (AcpiExDumpOperand (*EntryDesc)))
680        {
681            break;
682        }
683    }
684
685    return;
686}
687
688
689/*****************************************************************************
690 *
691 * FUNCTION:    AcpiExDumpNode
692 *
693 * PARAMETERS:  *Node           - Descriptor to dump
694 *              Flags               - Force display
695 *
696 * DESCRIPTION: Dumps the members of the given.Node
697 *
698 ****************************************************************************/
699
700void
701AcpiExDumpNode (
702    ACPI_NAMESPACE_NODE     *Node,
703    UINT32                  Flags)
704{
705
706    if (!Flags)
707    {
708        if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
709        {
710            return;
711        }
712    }
713
714
715    AcpiOsPrintf ("%20s : %4.4s\n", "Name",             &Node->Name);
716    AcpiOsPrintf ("%20s : %s\n",    "Type",             AcpiUtGetTypeName (Node->Type));
717    AcpiOsPrintf ("%20s : %X\n",    "Flags",            Node->Flags);
718    AcpiOsPrintf ("%20s : %X\n",    "Owner Id",         Node->OwnerId);
719    AcpiOsPrintf ("%20s : %X\n",    "Reference Count",  Node->ReferenceCount);
720    AcpiOsPrintf ("%20s : %p\n",    "Attached Object",  Node->Object);
721    AcpiOsPrintf ("%20s : %p\n",    "ChildList",        Node->Child);
722    AcpiOsPrintf ("%20s : %p\n",    "NextPeer",         Node->Peer);
723    AcpiOsPrintf ("%20s : %p\n",    "Parent",           AcpiNsGetParentObject (Node));
724}
725
726
727/*****************************************************************************
728 *
729 * FUNCTION:    AcpiExDumpObjectDescriptor
730 *
731 * PARAMETERS:  *Object             - Descriptor to dump
732 *              Flags               - Force display
733 *
734 * DESCRIPTION: Dumps the members of the object descriptor given.
735 *
736 ****************************************************************************/
737
738void
739AcpiExDumpObjectDescriptor (
740    ACPI_OPERAND_OBJECT     *ObjDesc,
741    UINT32                  Flags)
742{
743    ACPI_OPCODE_INFO        *OpInfo;
744
745
746    FUNCTION_TRACE ("ExDumpObjectDescriptor");
747
748
749    if (!Flags)
750    {
751        if (!((ACPI_DB_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
752        {
753            return;
754        }
755    }
756
757    if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)))
758    {
759        AcpiOsPrintf ("%p is not a valid ACPI object\n", ObjDesc);
760        return;
761    }
762
763    /* Common Fields */
764
765    AcpiOsPrintf ("%20s : %X\n",   "Reference Count", ObjDesc->Common.ReferenceCount);
766    AcpiOsPrintf ("%20s : %X\n",   "Flags", ObjDesc->Common.Flags);
767
768    /* Object-specific Fields */
769
770    switch (ObjDesc->Common.Type)
771    {
772    case ACPI_TYPE_INTEGER:
773
774        AcpiOsPrintf ("%20s : %s\n", "Type", "Integer");
775        AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value),
776                                                   LODWORD (ObjDesc->Integer.Value));
777        break;
778
779
780    case ACPI_TYPE_STRING:
781
782        AcpiOsPrintf ("%20s : %s\n", "Type", "String");
783        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->String.Length);
784        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->String.Pointer);
785        break;
786
787
788    case ACPI_TYPE_BUFFER:
789
790        AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer");
791        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length);
792        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer);
793        break;
794
795
796    case ACPI_TYPE_PACKAGE:
797
798        AcpiOsPrintf ("%20s : %s\n", "Type", "Package");
799        AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Package.Flags);
800        AcpiOsPrintf ("%20s : %X\n", "Count", ObjDesc->Package.Count);
801        AcpiOsPrintf ("%20s : %p\n", "Elements", ObjDesc->Package.Elements);
802        AcpiOsPrintf ("%20s : %p\n", "NextElement", ObjDesc->Package.NextElement);
803        break;
804
805
806    case ACPI_TYPE_BUFFER_FIELD:
807
808        AcpiOsPrintf ("%20s : %s\n", "Type", "BufferField");
809        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BufferField.BitLength);
810        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BufferField.StartFieldBitOffset);
811        AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset",ObjDesc->BufferField.BaseByteOffset);
812        AcpiOsPrintf ("%20s : %p\n", "BufferObj", ObjDesc->BufferField.BufferObj);
813        break;
814
815
816    case ACPI_TYPE_DEVICE:
817
818        AcpiOsPrintf ("%20s : %s\n", "Type", "Device");
819        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Device.AddrHandler);
820        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Device.SysHandler);
821        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Device.DrvHandler);
822        break;
823
824    case ACPI_TYPE_EVENT:
825
826        AcpiOsPrintf ("%20s : %s\n", "Type", "Event");
827        AcpiOsPrintf ("%20s : %X\n", "Semaphore", ObjDesc->Event.Semaphore);
828        break;
829
830
831    case ACPI_TYPE_METHOD:
832
833        AcpiOsPrintf ("%20s : %s\n", "Type", "Method");
834        AcpiOsPrintf ("%20s : %X\n", "ParamCount", ObjDesc->Method.ParamCount);
835        AcpiOsPrintf ("%20s : %X\n", "Concurrency", ObjDesc->Method.Concurrency);
836        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Method.Semaphore);
837        AcpiOsPrintf ("%20s : %X\n", "PcodeLength", ObjDesc->Method.PcodeLength);
838        AcpiOsPrintf ("%20s : %X\n", "Pcode", ObjDesc->Method.Pcode);
839        break;
840
841
842    case ACPI_TYPE_MUTEX:
843
844        AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex");
845        AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel);
846        AcpiOsPrintf ("%20s : %p\n", "Owner", ObjDesc->Mutex.Owner);
847        AcpiOsPrintf ("%20s : %X\n", "AcquisitionDepth", ObjDesc->Mutex.AcquisitionDepth);
848        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore);
849        break;
850
851
852    case ACPI_TYPE_REGION:
853
854        AcpiOsPrintf ("%20s : %s\n", "Type", "Region");
855        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->Region.SpaceId);
856        AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Region.Flags);
857        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Region.Address);
858        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Region.Length);
859        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Region.AddrHandler);
860        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->Region.Next);
861        break;
862
863
864    case ACPI_TYPE_POWER:
865
866        AcpiOsPrintf ("%20s : %s\n", "Type", "PowerResource");
867        AcpiOsPrintf ("%20s : %X\n", "SystemLevel", ObjDesc->PowerResource.SystemLevel);
868        AcpiOsPrintf ("%20s : %X\n", "ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
869        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->PowerResource.SysHandler);
870        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->PowerResource.DrvHandler);
871        break;
872
873
874    case ACPI_TYPE_PROCESSOR:
875
876        AcpiOsPrintf ("%20s : %s\n", "Type", "Processor");
877        AcpiOsPrintf ("%20s : %X\n", "Processor ID", ObjDesc->Processor.ProcId);
878        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Processor.Length);
879        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Processor.Address);
880        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Processor.SysHandler);
881        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Processor.DrvHandler);
882        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Processor.AddrHandler);
883        break;
884
885
886    case ACPI_TYPE_THERMAL:
887
888        AcpiOsPrintf ("%20s : %s\n", "Type", "ThermalZone");
889        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->ThermalZone.SysHandler);
890        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->ThermalZone.DrvHandler);
891        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler);
892        break;
893
894
895    case INTERNAL_TYPE_REGION_FIELD:
896
897        AcpiOsPrintf ("%20s : %p\n", "AccessBitWidth", ObjDesc->Field.AccessBitWidth);
898        AcpiOsPrintf ("%20s : %p\n", "BitLength", ObjDesc->Field.BitLength);
899        AcpiOsPrintf ("%20s : %p\n", "BaseByteOffset",ObjDesc->Field.BaseByteOffset);
900        AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.StartFieldBitOffset);
901        AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->Field.RegionObj);
902        break;
903
904
905    case INTERNAL_TYPE_BANK_FIELD:
906
907        AcpiOsPrintf ("%20s : %s\n", "Type", "BankField");
908        AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->BankField.AccessBitWidth);
909        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule);
910        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule);
911        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BankField.BitLength);
912        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.StartFieldBitOffset);
913        AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset", ObjDesc->BankField.BaseByteOffset);
914        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value);
915        AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->BankField.RegionObj);
916        AcpiOsPrintf ("%20s : %X\n", "BankRegisterObj", ObjDesc->BankField.BankRegisterObj);
917        break;
918
919
920    case INTERNAL_TYPE_INDEX_FIELD:
921
922        AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField");
923        AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->IndexField.AccessBitWidth);
924        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule);
925        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule);
926        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->IndexField.BitLength);
927        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.StartFieldBitOffset);
928        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value);
929        AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.IndexObj);
930        AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.DataObj);
931        break;
932
933
934    case INTERNAL_TYPE_REFERENCE:
935
936        OpInfo = AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode);
937
938        AcpiOsPrintf ("%20s : %s\n", "Type", "Reference");
939        AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType);
940        AcpiOsPrintf ("%20s : %s\n", "Opcode", OpInfo->Name);
941        AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset);
942        AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object);
943        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node);
944        AcpiOsPrintf ("%20s : %p\n", "Where", ObjDesc->Reference.Where);
945        break;
946
947
948    case INTERNAL_TYPE_ADDRESS_HANDLER:
949
950        AcpiOsPrintf ("%20s : %s\n", "Type", "Address Handler");
951        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId);
952        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->AddrHandler.Next);
953        AcpiOsPrintf ("%20s : %p\n", "RegionList", ObjDesc->AddrHandler.RegionList);
954        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->AddrHandler.Node);
955        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->AddrHandler.Handler);
956        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->AddrHandler.Context);
957        break;
958
959
960    case INTERNAL_TYPE_NOTIFY:
961
962        AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler");
963        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->NotifyHandler.Node);
964        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->NotifyHandler.Handler);
965        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->NotifyHandler.Context);
966        break;
967
968
969    case INTERNAL_TYPE_ALIAS:
970    case INTERNAL_TYPE_FIELD_DEFN:
971    case INTERNAL_TYPE_BANK_FIELD_DEFN:
972    case INTERNAL_TYPE_INDEX_FIELD_DEFN:
973    case INTERNAL_TYPE_IF:
974    case INTERNAL_TYPE_ELSE:
975    case INTERNAL_TYPE_WHILE:
976    case INTERNAL_TYPE_SCOPE:
977    case INTERNAL_TYPE_DEF_ANY:
978
979        AcpiOsPrintf ("*** Structure display not implemented for type %X! ***\n",
980            ObjDesc->Common.Type);
981        break;
982
983
984    default:
985
986        AcpiOsPrintf ("*** Cannot display unknown type %X! ***\n", ObjDesc->Common.Type);
987        break;
988    }
989
990    return_VOID;
991}
992
993#endif
994
995