exdump.c revision 83174
1/******************************************************************************
2 *
3 * Module Name: exdump - Interpreter debug output routines
4 *              $Revision: 122 $
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, "%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_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, "Integer %8.8X%8.8X\n",
418                    HIDWORD (EntryDesc->Integer.Value),
419                    LODWORD (EntryDesc->Integer.Value)));
420        break;
421
422
423    case INTERNAL_TYPE_IF:
424
425        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Integer] %8.8X%8.8X\n",
426                    HIDWORD (EntryDesc->Integer.Value),
427                    LODWORD (EntryDesc->Integer.Value)));
428        break;
429
430
431    case INTERNAL_TYPE_WHILE:
432
433        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Integer] %8.8X%8.8X\n",
434                    HIDWORD (EntryDesc->Integer.Value),
435                    LODWORD (EntryDesc->Integer.Value)));
436        break;
437
438
439    case ACPI_TYPE_PACKAGE:
440
441        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Package count %X @ %p\n",
442                    EntryDesc->Package.Count, EntryDesc->Package.Elements));
443
444        /*
445         * If elements exist, package vector pointer is valid,
446         * and debug_level exceeds 1, dump package's elements.
447         */
448        if (EntryDesc->Package.Count &&
449            EntryDesc->Package.Elements &&
450            AcpiDbgLevel > 1)
451        {
452            ACPI_OPERAND_OBJECT**Element;
453            UINT16              ElementIndex;
454
455            for (ElementIndex = 0, Element = EntryDesc->Package.Elements;
456                  ElementIndex < EntryDesc->Package.Count;
457                  ++ElementIndex, ++Element)
458            {
459                AcpiExDumpOperand (*Element);
460            }
461        }
462
463        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
464
465        break;
466
467
468    case ACPI_TYPE_REGION:
469
470        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)",
471            AcpiUtGetRegionName (EntryDesc->Region.SpaceId),
472            EntryDesc->Region.SpaceId));
473
474        /*
475         * If the address and length have not been evaluated,
476         * don't print them.
477         */
478        if (!(EntryDesc->Region.Flags & AOPOBJ_DATA_VALID))
479        {
480            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n"));
481        }
482        else
483        {
484            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %p Length %X\n",
485                EntryDesc->Region.Address, EntryDesc->Region.Length));
486        }
487        break;
488
489
490    case ACPI_TYPE_STRING:
491
492        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "String length %X @ %p \"",
493                    EntryDesc->String.Length, EntryDesc->String.Pointer));
494
495        for (i = 0; i < EntryDesc->String.Length; i++)
496        {
497            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c",
498                        EntryDesc->String.Pointer[i]));
499        }
500
501        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\"\n"));
502        break;
503
504
505    case INTERNAL_TYPE_BANK_FIELD:
506
507        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "BankField\n"));
508        break;
509
510
511    case INTERNAL_TYPE_REGION_FIELD:
512
513        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
514            "RegionField: bits=%X  bitaccwidth=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
515            EntryDesc->Field.BitLength,      EntryDesc->Field.AccessBitWidth,
516            EntryDesc->Field.LockRule,       EntryDesc->Field.UpdateRule,
517            EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset));
518        DUMP_STACK_ENTRY (EntryDesc->Field.RegionObj);
519        break;
520
521
522    case INTERNAL_TYPE_INDEX_FIELD:
523
524        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "IndexField\n"));
525        break;
526
527
528    case ACPI_TYPE_BUFFER_FIELD:
529
530        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
531            "BufferField: %X bits at byte %lX bit %X of \n",
532            EntryDesc->BufferField.BitLength, EntryDesc->BufferField.BaseByteOffset,
533            EntryDesc->BufferField.StartFieldBitOffset));
534
535        if (!EntryDesc->BufferField.BufferObj)
536        {
537            ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "*NULL* \n"));
538        }
539
540        else if (ACPI_TYPE_BUFFER !=
541                     EntryDesc->BufferField.BufferObj->Common.Type)
542        {
543            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n"));
544        }
545
546        else
547        {
548            DUMP_STACK_ENTRY (EntryDesc->BufferField.BufferObj);
549        }
550
551        break;
552
553
554    case ACPI_TYPE_EVENT:
555
556        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n"));
557        break;
558
559
560    case ACPI_TYPE_METHOD:
561
562        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
563            "Method(%X) @ %p:%lX\n",
564            EntryDesc->Method.ParamCount,
565            EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength));
566        break;
567
568
569    case ACPI_TYPE_MUTEX:
570
571        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Mutex\n"));
572        break;
573
574
575    case ACPI_TYPE_DEVICE:
576
577        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Device\n"));
578        break;
579
580
581    case ACPI_TYPE_POWER:
582
583        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Power\n"));
584        break;
585
586
587    case ACPI_TYPE_PROCESSOR:
588
589        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Processor\n"));
590        break;
591
592
593    case ACPI_TYPE_THERMAL:
594
595        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Thermal\n"));
596        break;
597
598
599    default:
600        /*  unknown EntryDesc->Common.Type value    */
601
602        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown Type %X\n",
603            EntryDesc->Common.Type));
604
605        /* Back up to previous entry */
606
607        EntryDesc--;
608
609
610        /* TBD: [Restructure]  Change to use dump object routine !! */
611        /*       What is all of this?? */
612
613        DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
614        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
615        DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
616        break;
617
618    }
619
620    return (AE_OK);
621}
622
623
624/*****************************************************************************
625 *
626 * FUNCTION:    AcpiExDumpOperands
627 *
628 * PARAMETERS:  InterpreterMode      - Load or Exec
629 *              *Ident              - Identification
630 *              NumLevels           - # of stack entries to dump above line
631 *              *Note               - Output notation
632 *
633 * DESCRIPTION: Dump the object stack
634 *
635 ****************************************************************************/
636
637void
638AcpiExDumpOperands (
639    ACPI_OPERAND_OBJECT     **Operands,
640    OPERATING_MODE          InterpreterMode,
641    NATIVE_CHAR             *Ident,
642    UINT32                  NumLevels,
643    NATIVE_CHAR             *Note,
644    NATIVE_CHAR             *ModuleName,
645    UINT32                  LineNumber)
646{
647    NATIVE_UINT             i;
648    ACPI_OPERAND_OBJECT     **EntryDesc;
649
650
651    PROC_NAME ("ExDumpOperands");
652
653
654    if (!Ident)
655    {
656        Ident = "?";
657    }
658
659    if (!Note)
660    {
661        Note = "?";
662    }
663
664
665    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
666        "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
667        Ident, NumLevels));
668
669    if (NumLevels == 0)
670    {
671        NumLevels = 1;
672    }
673
674    /* Dump the stack starting at the top, working down */
675
676    for (i = 0; NumLevels > 0; i--, NumLevels--)
677    {
678        EntryDesc = &Operands[i];
679
680        if (ACPI_FAILURE (AcpiExDumpOperand (*EntryDesc)))
681        {
682            break;
683        }
684    }
685
686    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
687        "************* Stack dump from %s(%d), %s\n",
688        ModuleName, LineNumber, Note));
689    return;
690}
691
692
693/*****************************************************************************
694 *
695 * FUNCTION:    AcpiExDumpNode
696 *
697 * PARAMETERS:  *Node           - Descriptor to dump
698 *              Flags               - Force display
699 *
700 * DESCRIPTION: Dumps the members of the given.Node
701 *
702 ****************************************************************************/
703
704void
705AcpiExDumpNode (
706    ACPI_NAMESPACE_NODE     *Node,
707    UINT32                  Flags)
708{
709
710    FUNCTION_ENTRY ();
711
712
713    if (!Flags)
714    {
715        if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
716        {
717            return;
718        }
719    }
720
721
722    AcpiOsPrintf ("%20s : %4.4s\n", "Name",             &Node->Name);
723    AcpiOsPrintf ("%20s : %s\n",    "Type",             AcpiUtGetTypeName (Node->Type));
724    AcpiOsPrintf ("%20s : %X\n",    "Flags",            Node->Flags);
725    AcpiOsPrintf ("%20s : %X\n",    "Owner Id",         Node->OwnerId);
726    AcpiOsPrintf ("%20s : %X\n",    "Reference Count",  Node->ReferenceCount);
727    AcpiOsPrintf ("%20s : %p\n",    "Attached Object",  Node->Object);
728    AcpiOsPrintf ("%20s : %p\n",    "ChildList",        Node->Child);
729    AcpiOsPrintf ("%20s : %p\n",    "NextPeer",         Node->Peer);
730    AcpiOsPrintf ("%20s : %p\n",    "Parent",           AcpiNsGetParentObject (Node));
731}
732
733
734/*****************************************************************************
735 *
736 * FUNCTION:    AcpiExDumpObjectDescriptor
737 *
738 * PARAMETERS:  *Object             - Descriptor to dump
739 *              Flags               - Force display
740 *
741 * DESCRIPTION: Dumps the members of the object descriptor given.
742 *
743 ****************************************************************************/
744
745void
746AcpiExDumpObjectDescriptor (
747    ACPI_OPERAND_OBJECT     *ObjDesc,
748    UINT32                  Flags)
749{
750    const ACPI_OPCODE_INFO  *OpInfo;
751
752
753    FUNCTION_TRACE ("ExDumpObjectDescriptor");
754
755
756    if (!Flags)
757    {
758        if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
759        {
760            return;
761        }
762    }
763
764    if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)))
765    {
766        AcpiOsPrintf ("%p is not a valid ACPI object\n", ObjDesc);
767        return;
768    }
769
770    /* Common Fields */
771
772    AcpiOsPrintf ("%20s : %X\n",   "Reference Count", ObjDesc->Common.ReferenceCount);
773    AcpiOsPrintf ("%20s : %X\n",   "Flags", ObjDesc->Common.Flags);
774
775    /* Object-specific Fields */
776
777    switch (ObjDesc->Common.Type)
778    {
779    case ACPI_TYPE_INTEGER:
780
781        AcpiOsPrintf ("%20s : %s\n", "Type", "Integer");
782        AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value),
783                                                   LODWORD (ObjDesc->Integer.Value));
784        break;
785
786
787    case ACPI_TYPE_STRING:
788
789        AcpiOsPrintf ("%20s : %s\n", "Type", "String");
790        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->String.Length);
791        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->String.Pointer);
792        break;
793
794
795    case ACPI_TYPE_BUFFER:
796
797        AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer");
798        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length);
799        AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer);
800        break;
801
802
803    case ACPI_TYPE_PACKAGE:
804
805        AcpiOsPrintf ("%20s : %s\n", "Type", "Package");
806        AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Package.Flags);
807        AcpiOsPrintf ("%20s : %X\n", "Count", ObjDesc->Package.Count);
808        AcpiOsPrintf ("%20s : %p\n", "Elements", ObjDesc->Package.Elements);
809        AcpiOsPrintf ("%20s : %p\n", "NextElement", ObjDesc->Package.NextElement);
810        break;
811
812
813    case ACPI_TYPE_BUFFER_FIELD:
814
815        AcpiOsPrintf ("%20s : %s\n", "Type", "BufferField");
816        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BufferField.BitLength);
817        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BufferField.StartFieldBitOffset);
818        AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset",ObjDesc->BufferField.BaseByteOffset);
819        AcpiOsPrintf ("%20s : %p\n", "BufferObj", ObjDesc->BufferField.BufferObj);
820        break;
821
822
823    case ACPI_TYPE_DEVICE:
824
825        AcpiOsPrintf ("%20s : %s\n", "Type", "Device");
826        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Device.AddrHandler);
827        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Device.SysHandler);
828        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Device.DrvHandler);
829        break;
830
831    case ACPI_TYPE_EVENT:
832
833        AcpiOsPrintf ("%20s : %s\n", "Type", "Event");
834        AcpiOsPrintf ("%20s : %X\n", "Semaphore", ObjDesc->Event.Semaphore);
835        break;
836
837
838    case ACPI_TYPE_METHOD:
839
840        AcpiOsPrintf ("%20s : %s\n", "Type", "Method");
841        AcpiOsPrintf ("%20s : %X\n", "ParamCount", ObjDesc->Method.ParamCount);
842        AcpiOsPrintf ("%20s : %X\n", "Concurrency", ObjDesc->Method.Concurrency);
843        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Method.Semaphore);
844        AcpiOsPrintf ("%20s : %X\n", "PcodeLength", ObjDesc->Method.PcodeLength);
845        AcpiOsPrintf ("%20s : %X\n", "Pcode", ObjDesc->Method.Pcode);
846        break;
847
848
849    case ACPI_TYPE_MUTEX:
850
851        AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex");
852        AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel);
853        AcpiOsPrintf ("%20s : %p\n", "Owner", ObjDesc->Mutex.Owner);
854        AcpiOsPrintf ("%20s : %X\n", "AcquisitionDepth", ObjDesc->Mutex.AcquisitionDepth);
855        AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore);
856        break;
857
858
859    case ACPI_TYPE_REGION:
860
861        AcpiOsPrintf ("%20s : %s\n", "Type", "Region");
862        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->Region.SpaceId);
863        AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Region.Flags);
864        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Region.Address);
865        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Region.Length);
866        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Region.AddrHandler);
867        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->Region.Next);
868        break;
869
870
871    case ACPI_TYPE_POWER:
872
873        AcpiOsPrintf ("%20s : %s\n", "Type", "PowerResource");
874        AcpiOsPrintf ("%20s : %X\n", "SystemLevel", ObjDesc->PowerResource.SystemLevel);
875        AcpiOsPrintf ("%20s : %X\n", "ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
876        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->PowerResource.SysHandler);
877        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->PowerResource.DrvHandler);
878        break;
879
880
881    case ACPI_TYPE_PROCESSOR:
882
883        AcpiOsPrintf ("%20s : %s\n", "Type", "Processor");
884        AcpiOsPrintf ("%20s : %X\n", "Processor ID", ObjDesc->Processor.ProcId);
885        AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Processor.Length);
886        AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Processor.Address);
887        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Processor.SysHandler);
888        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Processor.DrvHandler);
889        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Processor.AddrHandler);
890        break;
891
892
893    case ACPI_TYPE_THERMAL:
894
895        AcpiOsPrintf ("%20s : %s\n", "Type", "ThermalZone");
896        AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->ThermalZone.SysHandler);
897        AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->ThermalZone.DrvHandler);
898        AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler);
899        break;
900
901
902    case INTERNAL_TYPE_REGION_FIELD:
903
904        AcpiOsPrintf ("%20s : %p\n", "AccessBitWidth", ObjDesc->Field.AccessBitWidth);
905        AcpiOsPrintf ("%20s : %p\n", "BitLength", ObjDesc->Field.BitLength);
906        AcpiOsPrintf ("%20s : %p\n", "BaseByteOffset",ObjDesc->Field.BaseByteOffset);
907        AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.StartFieldBitOffset);
908        AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->Field.RegionObj);
909        break;
910
911
912    case INTERNAL_TYPE_BANK_FIELD:
913
914        AcpiOsPrintf ("%20s : %s\n", "Type", "BankField");
915        AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->BankField.AccessBitWidth);
916        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule);
917        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule);
918        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BankField.BitLength);
919        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.StartFieldBitOffset);
920        AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset", ObjDesc->BankField.BaseByteOffset);
921        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value);
922        AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->BankField.RegionObj);
923        AcpiOsPrintf ("%20s : %X\n", "BankRegisterObj", ObjDesc->BankField.BankRegisterObj);
924        break;
925
926
927    case INTERNAL_TYPE_INDEX_FIELD:
928
929        AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField");
930        AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->IndexField.AccessBitWidth);
931        AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule);
932        AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule);
933        AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->IndexField.BitLength);
934        AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.StartFieldBitOffset);
935        AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value);
936        AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.IndexObj);
937        AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.DataObj);
938        break;
939
940
941    case INTERNAL_TYPE_REFERENCE:
942
943        OpInfo = AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode);
944
945        AcpiOsPrintf ("%20s : %s\n", "Type", "Reference");
946        AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType);
947        AcpiOsPrintf ("%20s : %s\n", "Opcode", OpInfo->Name);
948        AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset);
949        AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object);
950        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node);
951        AcpiOsPrintf ("%20s : %p\n", "Where", ObjDesc->Reference.Where);
952        break;
953
954
955    case INTERNAL_TYPE_ADDRESS_HANDLER:
956
957        AcpiOsPrintf ("%20s : %s\n", "Type", "Address Handler");
958        AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId);
959        AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->AddrHandler.Next);
960        AcpiOsPrintf ("%20s : %p\n", "RegionList", ObjDesc->AddrHandler.RegionList);
961        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->AddrHandler.Node);
962        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->AddrHandler.Handler);
963        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->AddrHandler.Context);
964        break;
965
966
967    case INTERNAL_TYPE_NOTIFY:
968
969        AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler");
970        AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->NotifyHandler.Node);
971        AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->NotifyHandler.Handler);
972        AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->NotifyHandler.Context);
973        break;
974
975
976    case INTERNAL_TYPE_ALIAS:
977    case INTERNAL_TYPE_FIELD_DEFN:
978    case INTERNAL_TYPE_BANK_FIELD_DEFN:
979    case INTERNAL_TYPE_INDEX_FIELD_DEFN:
980    case INTERNAL_TYPE_IF:
981    case INTERNAL_TYPE_ELSE:
982    case INTERNAL_TYPE_WHILE:
983    case INTERNAL_TYPE_SCOPE:
984    case INTERNAL_TYPE_DEF_ANY:
985
986        AcpiOsPrintf ("*** Structure display not implemented for type %X! ***\n",
987            ObjDesc->Common.Type);
988        break;
989
990
991    default:
992
993        AcpiOsPrintf ("*** Cannot display unknown type %X! ***\n", ObjDesc->Common.Type);
994        break;
995    }
996
997    return_VOID;
998}
999
1000#endif
1001
1002